commite8e9f986a6e4b4f13372532d07752e9e5af7b6ee BUG190068,fix tooltips size error

This commit is contained in:
xibowen 2023-09-12 16:08:14 +08:00
parent a87d8c5a1c
commit 4ce8839047
4 changed files with 2 additions and 4266 deletions

View File

@ -284,7 +284,7 @@ public:
bool TabBar_SplitLine = true;
// tooltip
int ToolTip_DefaultMargin = 8;
int ToolTip_DefaultMargin = 10;
int ToolTip_Height = 36;
int ToolTip_Height_origin = 36;

File diff suppressed because it is too large Load Diff

View File

@ -1,311 +0,0 @@
/*
* Qt5-UKUI's Library
*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: xibowen <xibowen@kylinos.cn>
*
*/
#ifndef KABSTRACTSTYLEPARAMETERS_H
#define KABSTRACTSTYLEPARAMETERS_H
#include <QObject>
#include <QPalette>
#include <QStyleOption>
#include "pushbutton-parameters.h"
#include "toolbutton-parameters.h"
#include "lineedit-parameters.h"
#include "spinbox-parameters.h"
#include "combobox-parameters.h"
#include "list-parameters.h"
#include "tree-parameters.h"
#include "table-parameters.h"
#include "checkbox-parameters.h"
#include "radiobutton-parameters.h"
#include "slider-parameters.h"
#include "progressbar-parameters.h"
#include "scrollbar-parameters.h"
#include "tooltip-parameters.h"
#include "tabwidget-parameters.h"
#include "menu-parameters.h"
class KAbstractStyleParameters: public QObject
{
Q_OBJECT
public:
KAbstractStyleParameters(QObject *parent, bool isDark);
enum SpinBoxControlLayout {
Horizontal,
Vertical
};
Q_ENUM(SpinBoxControlLayout)
void updateParameters(bool isTabletMode);
// radius
int radius = 6;
// common
int SmallIcon_Size = 16;
int IconButton_Distance = 8;
// button
int Button_MarginHeight = 0;
int ToolButton_MarginWidth = 8;
int Button_MarginWidth = 8;
int Button_IconSize = 16;
int Button_IndicatorSize = 16;
int Button_DefaultIndicatorSize = 0;
int Button_DefaultWidth = 96;
int Button_DefaultHeight = 36;
int Button_DefaultHeight_origin = 36;
int ToolButton_DefaultWidth = 60;
int IconButton_DefaultWidth = 36;
int IconButton_DefaultWidth_origin = 36;
QColor ColoseButtonColor;
// menu
int Menu_MarginHeight = 4 + 8;
int Menu_Combobox_Popup_MarginHeight = 4;
int Menu_MarginWidth = 4 + 2;
int Menu_MarginPanelWidth = 0;
// menu-item
int MenuItem_MarginHeight = 2;
int MenuItem_MarginWidth = 12 + 4;
int MenuItemSeparator_MarginHeight = 4;
int MenuItemSeparator_MarginHeight_origin = 4;
int MenuItemSeparator_MarginWidth = 4;
int MenuItem_DefaultHeight = 36;
int MenuItem_DefaultHeight_origin = 36;
int MenuItem_DefaultWidght = 152;
// scrollbar
int ScroolBar_Width = 16;
int ScroolBar_Width_origin = 16;
int ScroolBar_Height = 68;
// progressbar
int ProgressBar_DefaultLength = 388;
int ProgressBar_DefaultThick = 16;
// slider
int Slider_DefaultLength = 94;
int Slider_DefaultLength_origin = 94;
int Slider_Length = 20;
int Slider_Length_origin = 20;
int Slider_GrooveLength = 4;
int Slider_GrooveLength_origin = 4;
int Slider_Margin = 2;
// radiobutton
int ExclusiveIndicator_Width = 16;
int ExclusiveIndicator_Height = 16;
int RadioButtonLabel_Spacing = 8;
int RadioButton_DefaultHeight = 36;
int RadioButton_DefaultHeight_origin = 36;
// checkbox
int Indicator_Width = 16;
int Indicator_Height = 16;
int CheckBox_DefaultHeight = 36;
int CheckBox_DefaultHeight_origin = 36;
int CheckBox_Radius = 4;
// lineedit
int LineEdit_DefaultWidth = 160;
int LineEdit_DefaultWidth_origin = 160;
int LineEdit_DefaultHeight = 36;
int LineEdit_DefaultHeight_origin = 36;
// combobox
int ComboBox_DefaultWidth = 160;
int ComboBox_DefaultHeight = 36;
int ComboBox_DefaultHeight_origin = 36;
int ComboBox_DefaultMenuItemHeight = 36;
int ComboBox_DefaultMenuItemHeight_original = 36;
int ComboBox_FrameWidth = 2;
int ComboBox_VMargin = 1;
// spinbox
int SpinBox_DefaultWidth = 160;
int SpinBox_DefaultHeight = 36;
int SpinBox_DefaultHeight_origin = 36;
int SpinBox_FrameWidth = 2;
// tabbar
int TabBar_DefaultMinWidth = 168;
int TabBar_DefaultMaxWidth = 248;
int TabBar_DefaultHeight = 40;
int TabBar_DefaultHeight_origin = 40;
int TabBar_ScrollButtonWidth = 16;
int TabBar_ScrollButtonOverlap = 2;
// tooltip
int ToolTip_DefaultMargin = 8;
int ToolTip_Height = 36;
int ToolTip_Height_origin = 36;
//viewitem FIXSeparate to list,tree and table after
int ViewItem_DefaultHeight = 36;
int ViewItem_DefaultHeight_origin = 36;
//table
int Table_HeaderHeight = 36;
int Table_HeaderHeight_origin = 36;
float m_scaleRatio4_3 = 1.0;
float m_scaleRatio3_2 = 1.0;
float m_scaleRatio2_1 = 1.0;
int m_headerDefaultSectionSizeVertical = 36;
int m_headerDefaultSectionSizeVertical1_1 = 36;
int m_headerDefaultSectionSizeVertical4_3 = 48;
bool m_isTableMode = false;
bool m_isInitial = true;
float m_scaleSliderDefaultLength = 1.0;
float m_ScaleComboBoxDefaultLength = 1.0;
float m_ScaleLineEditDefaultLength = 1.0;
float m_scaleTabBarHeight6_5 = 1.0;
QPalette defaultPalette;
PushButtonParameters pushButtonParameters;
ToolButtonParameters toolButtonParameters;
LineEditParameters lineEditParameters;
SpinBoxParameters spinBoxParameters;
ComboBoxParameters comboBoxParameters;
ListParameters listParameters;
TreeParameters treeParameters;
TableParameters tableParameters;
CheckBoxParameters checkBoxParameters;
RadioButtonParameters radioButtonParameters;
SliderParameters sliderParameters;
ProgressBarParameters progressBarParameters;
ScrollBarParameters scrollBarParameters;
ToolTipParameters toolTipParameters;
TabWidgetParameters tabWidgetParameters;
MenuParameters menuParameters;
QPalette setPalette(QPalette &palette);
int getSpinBoxControlLayout();
virtual void initPalette(bool isDark) = 0;
virtual void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false) = 0;
virtual void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
virtual void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
private:
int m_spinBoxControlLayout = SpinBoxControlLayout::Vertical;
};
class KDefaultStyleParameters : public KAbstractStyleParameters
{
public:
KDefaultStyleParameters(QObject *parent, bool isDark);
void initPalette(bool isDark) override;
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false) override;
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
};
class KClassicalStyleParameters : public KAbstractStyleParameters
{
public:
KClassicalStyleParameters(QObject *parent, bool isDark);
void initPalette(bool isDark) override;
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false) override;
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
};
class KFashionStyleParameters : public KAbstractStyleParameters
{
public:
KFashionStyleParameters(QObject *parent, bool isDark);
void initPalette(bool isDark) override;
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false) override;
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
};
#endif // KABSTRACTSTYLEPARAMETERS_H

View File

@ -189,7 +189,7 @@ public:
bool TabBar_BorderLine = false;
// tooltip
int ToolTip_DefaultMargin = 8;
int ToolTip_DefaultMargin = 10;
int ToolTip_Height = 36;
int ToolTip_Height_origin = 36;