!11 同步3.14.2.7到3.14.2.9的修改

* Add a changlog 2022.07.11 3.1.4.1~0509-ok6
* add system window move function for wayland, require qt 5.15 or higher version
This commit is contained in:
xibowen 2022-07-11 09:12:45 +00:00 committed by 邹畅
parent 20fc0a0cc1
commit 6d68e344bd
47 changed files with 607 additions and 215 deletions

19
debian/changelog vendored
View File

@ -1,3 +1,22 @@
qt5-ukui-platformtheme (3.1.4.1~0509-ok6) yangtze; urgency=medium
* 改动:
BUG号
需求号123164修改lineedit与spinbox边框像素为2px
90109,配置QAbstractItemView控件输入方式属性WA_InputMethodEnabled使得其满足亚洲文字习惯
125796,调整spinbox按钮样式增加focus模式下的hover状态与非focus状态下的hover状态样式
100756修改高屏幕比例下checkbox的边框问题
其他改同步wayland窗口移动代码适配qt5.15与wayland
添加高比例下屏幕图标锯齿问题处理
修改ukui-default模式下主题框架黑名单失效的问题
添加圆形按钮接口
修改按钮check模式的样式
同步修改qml主题框架模块名为ukui并加载
根据设计稿,调整和印色板数值
影响域wayland下的窗口移动高比例图标显示QMessagebox样式checkbox样式button样式spinbox按钮样式qml加载
-- xibowen <xibowen@kylinos.cn> Mon, 11 Jul 2022 11:12:00 +0800
qt5-ukui-platformtheme (3.1.4.1~0509-ok5) yangtze; urgency=medium
* 改动:

24
debian/control vendored
View File

@ -21,12 +21,9 @@ Build-Depends: debhelper-compat (=12),
qtquickcontrols2-5-dev,
qtdeclarative5-dev,
dbus-x11,
kirigami2-dev (>= 5.68.0~),
libkf5iconthemes-dev (>= 5.68.0~),
libqt5x11extras5-dev (>= 5.8.0~),
qtdeclarative5-dev (>= 5.8.0~),
qtquickcontrols2-5-dev (>= 5.8.0~),
libqt5svg5-dev (>= 5.8.0~)
kirigami2-dev,
libkf5iconthemes-dev,
libqt5svg5-dev
Standards-Version: 4.5.1
Rules-Requires-Root: no
Homepage: https://www.ukui.org
@ -107,8 +104,23 @@ Depends: qml-module-qtgraphicaleffects,
qml-module-qtquick-templates2,
qml-module-qtquick-window2,
qml-module-qtquick2,
qml-module-org-ukui-stylehelper,
${misc:Depends},
${shlibs:Depends},
Description: Qt Quick Controls 2: Kylin Style
Small style written in QML for QtQuickControls2 intended to be used
by default in QQC2-based apps when used in the Kylin tablet desktop
Package: qml-module-org-ukui-stylehelper
Architecture: any
Depends: qml-module-qtgraphicaleffects,
qml-module-qtqml-models2,
qml-module-qtquick-controls2,
qml-module-qtquick-layouts,
qml-module-qtquick-templates2,
qml-module-qtquick-window2,
qml-module-qtquick2,
${misc:Depends},
${shlibs:Depends},
Description: qml stylehelper
The external dependency Lib of qml theme framework

View File

@ -1,3 +1 @@
usr/lib/*/qt5/qml/org/kylin/qqc2style/*
usr/lib/*/qt5/qml/QtQuick/Controls.2/*

View File

@ -0,0 +1 @@
usr/lib/*/qt5/qml/org/ukui/qqc2style/*

View File

@ -1,2 +0,0 @@
module org.kylin.qqc2style.private
plugin qqc2-style-plugin

View File

@ -327,7 +327,7 @@ bool DefaultSlideAnimator::filterTmpPage(QObject *obj, QEvent *e)
if (this->state() == QAbstractAnimation::Running) {
QPainter p(w);
auto value = this->currentValue().toDouble();
p.setRenderHints(QPainter::Antialiasing);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_Source);
//do a horizon slide.

View File

@ -186,8 +186,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
return pixmap;
QPainter p(&target);
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
if (option->state & QStyle::State_MouseOver ||
option->state & QStyle::State_Selected ||
@ -246,8 +245,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
return target;
QPainter p(&target);
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), option->palette.highlightedText());
return target;
@ -260,8 +258,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
return target;
QPainter p(&target);
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark(option));
return target;
@ -303,8 +300,7 @@ QPixmap HighLightEffect::ordinaryGeneratePixmap(const QPixmap &pixmap, const QSt
}
QPainter p(&target);
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), color.isValid() ? color : (mode ? option->palette.text() : defaultStyleDark(option)));
return target;
@ -338,8 +334,7 @@ QPixmap HighLightEffect::hoverGeneratePixmap(const QPixmap &pixmap, const QStyle
QPainter p(&target);
if (overOrDown) {
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), color.isValid() ? color : option->palette.highlightedText());
}
@ -377,13 +372,11 @@ QPixmap HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixma
QPainter p(&target);
if (overOrDown) {
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), hoverColor.isValid() ? hoverColor : option->palette.highlightedText());
} else {
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), defaultColor.isValid() ? defaultColor : (mode ? option->palette.text() : defaultStyleDark(option)));
}

View File

@ -1,7 +1,7 @@
<schemalist>
<schema id="org.ukui.style" path="/org/ukui/style/" gettext-domain="style">
<key type="s" name="style-name">
<default>"ukui-default"</default>
<default>"ukui-light"</default>
<summary>Current Qt Style</summary>
<description>Set style for UKUI desktop environment. Have ukui-dark ukui-default ukui-light</description>
</key>

View File

@ -140,6 +140,7 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
QApplication::setFont(oldFont);
}
}
});
}
@ -147,7 +148,7 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
// if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) {
// QQuickStyle::setStyle("org.kylin.style");
// }
QQuickStyle::setStyle("org.kylin.style");
QQuickStyle::setStyle("org.ukui.style");
}
Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme()
@ -201,6 +202,10 @@ QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const
case QPlatformTheme::IconThemeSearchPaths:
//FIXME:
return QStringList()<<".local/share/icons"<<"/usr/share/icons"<<"/usr/local/share/icons";
// case WheelScrollLines:
// {
// return QVariant(1);
// }break;
default:
break;
}

View File

@ -793,7 +793,7 @@ void MessageBoxPrivate::setupLayout()
layout->setSpacing(4);
// layout->addWidget(mCloseButtton, 0, Qt::AlignRight);
layout->addLayout(titleLayout);
layout->addSpacing(20);
layout->addSpacing(5);
layout->addLayout(contentLayout);
q->setLayout(layout);
@ -1300,6 +1300,8 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
if (parent) {
if (QWidget *p = mMessageBox->find(parent->winId())) {
//QMessageBox checkbox
if (p->findChild<QCheckBox *>()) {
for (QMessageBox *mb : p->findChildren<QMessageBox *>()) {
if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text()
@ -1312,8 +1314,22 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
}
}
}
//QMessageBox custom icon
if (mMessageBox->icon() == QMessageBox::NoIcon) {
for (QMessageBox *mb : p->findChildren<QMessageBox *>()) {
if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text()
&& mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) {
if (!mb->iconPixmap().isNull()) {
mMessageBox->setIconPixmap(mb->iconPixmap());
}
}
}
}
}
}
mMessageBox->setuplayout();
if (parent && !mMessageBox->isVisible()) {

View File

@ -1,7 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += \
kylin-qqc2-style \
ukui-qqc2-style \
ukui-qml-style-helper \
qt5-ukui-platformtheme \
ukui-styles \
libqt5-ukui-style \

View File

@ -1474,18 +1474,17 @@ void KyQuickStyleItem::paint(QPainter *painter)
switch (m_itemType) {
case Button:{
QWidget wid;
if(m_control->property("buttonType").isValid()){
QVariant prop= m_control->property("buttonType");
if(prop.toString()=="MaxButton" || prop.toString()=="MinButton" ){
wid.setProperty("isWindowButton", QVariant(0x01));
}
if(prop.toString()=="CloseButton"){
wid.setProperty("isWindowButton", QVariant(0x02));
}
if(prop.toString()=="blueButton"){
wid.setProperty("isImportant",true);
}
if(m_buttonType=="MaxButton" || m_buttonType=="MinButton" ){
wid.setProperty("isWindowButton", QVariant(0x01));
}
if(m_buttonType=="CloseButton"){
wid.setProperty("isWindowButton", QVariant(0x02));
}
if(m_buttonType=="blueButton"){
wid.setProperty("isImportant",true);
}
KyQuickStyleItem::style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter,&wid);
}
break;

View File

@ -65,6 +65,8 @@ class KyQuickStyleItem: public QQuickItem
Q_PROPERTY( int rightPadding READ rightPadding NOTIFY rightPaddingChanged)
Q_PROPERTY( int bottomPadding READ bottomPadding NOTIFY bottomPaddingChanged)
Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged)
Q_PROPERTY( QQuickItem *control READ control WRITE setControl NOTIFY controlChanged)
KyQuickPadding* border() { return &m_border; }
@ -191,6 +193,12 @@ public:
static QStyle *style();
QString buttonType() const { return m_buttonType;}
void setbuttonType(QString buttonType) {
m_buttonType = buttonType ;
emit buttonTypeChanged();
}
public Q_SLOTS:
int pixelMetric(const QString&);
QVariant styleHint(const QString&);
@ -239,6 +247,8 @@ Q_SIGNALS:
void rightPaddingChanged();
void bottomPaddingChanged();
void buttonTypeChanged();
protected:
bool event(QEvent *) override;
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
@ -293,6 +303,8 @@ protected:
KyQuickPadding m_border;
static QStyle *s_style;
QString m_buttonType;
};
#endif // KYQUICKSTYLEITEM_H

View File

@ -33,12 +33,20 @@ class KyStyleHelper : public QQuickItem
Q_PROPERTY(QColor linkcolorrole READ linkcolor NOTIFY qcolorChanged)
Q_PROPERTY(QColor linkvisitedcolorrole READ linkvisitedcolor NOTIFY qcolorChanged)
Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged)
public:
explicit KyStyleHelper(QQuickItem *parent = nullptr);
~KyStyleHelper() override;
static KyStyleHelper* qmlAttachedProperties(QObject* parent);
QString buttonType() const { return m_buttonType;}
void setbuttonType(QString buttonType) {
m_buttonType = buttonType ;
emit buttonTypeChanged();
}
/* Get palette */
QPalette palette() {
return qApp->palette();
@ -110,6 +118,10 @@ signals:
void paletteChanged();
void fontChanged();
void qcolorChanged();
void buttonTypeChanged();
protected:
QString m_buttonType;
};
QML_DECLARE_TYPEINFO(KyStyleHelper, QML_HAS_ATTACHED_PROPERTIES)

View File

@ -0,0 +1,2 @@
module org.ukui.qqc2style.private
plugin ukui-qml-style-helper

View File

@ -5,8 +5,8 @@
void Qqc2StylePlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kylin.qqc2style.private"));
// @uri org.kylin.qqc2style.private
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.ukui.qqc2style.private"));
// @uri org.ukui.qqc2style.private
qmlRegisterType<KyQuickStyleItem>(uri, 1, 0, "StyleItem");
qmlRegisterType<KyStyleHelper>(uri, 1, 0, "StyleHelper");
qmlRegisterType<KyIcon>(uri, 1, 0, "KyIcon");

View File

@ -1,17 +1,17 @@
TEMPLATE = lib
TARGET = qqc2-style-plugin
QT += KConfigCore Kirigami2 quick widgets
TARGET = ukui-qml-style-helper
QT += KConfigCore Kirigami2 quick
CONFIG += plugin c++11 link_pkgconfig
TARGET = $$qtLibraryTarget($$TARGET)
uri = org.kylin.qqc2style.private
uri = org.ukui.qqc2style.private
PKGCONFIG += gsettings-qt
INCLUDEPATH += /usr/include/KF5/Kirigami2
LIBS += -L/usr/lib -L$$[QT_INSTALL_LIBS] -lKF5Kirigami2
include(../../libqt5-ukui-style/effects/effects.pri)
include(../libqt5-ukui-style/effects/effects.pri)
# Input
SOURCES += \
@ -40,7 +40,7 @@ DISTFILES = qmldir
qmldir.files = qmldir
unix {
# installPath = $$[QT_INSTALL_QML]/$$replace(uri, \., /)
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/org/kylin/qqc2style/private/
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/org/ukui/qqc2style/private/
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir

View File

@ -4,7 +4,7 @@ import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.impl 2.12
import QtQuick.Templates 2.12 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.ApplicationWindow {
id: window

View File

@ -1,16 +1,15 @@
import QtQuick 2.6
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.Button {
id: controlRoot
palette: StylePrivate.StyleHelper.palette
/* The value type of buttonType are "CloseButton","MaxButton","MinButton","Default". */
property string buttonType
buttonType: "Default"
/* The value type of buttonType are "CloseButton","MaxButton","MinButton","blueButton","Default". */
StylePrivate.StyleHelper.buttonType: "Default"
implicitWidth: background.implicitWidth
@ -23,6 +22,7 @@ T.Button {
background: StylePrivate.StyleItem {
id: styleitem
anchors.fill: parent
buttonType: controlRoot.StylePrivate.StyleHelper.buttonType
control: controlRoot
elementType: "button"
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)

View File

@ -4,7 +4,7 @@ import QtQuick.Controls 2.12
import QtQuick.Controls.impl 2.12
import QtQuick.Templates 2.12 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.Label {
id:control

View File

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.5
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.Menu {
id: control

View File

@ -2,7 +2,7 @@
import QtQuick 2.6
import QtQuick.Layouts 1.2
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
import QtQuick.Controls 2.5
T.MenuItem {

View File

@ -2,7 +2,7 @@
import QtQuick 2.6
import QtGraphicalEffects 1.0
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.Popup {
id: control

View File

@ -3,7 +3,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.impl 2.12
import QtQuick.Templates 2.12 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.ScrollBar {
id: control

View File

@ -2,7 +2,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.ScrollView {

View File

@ -2,7 +2,7 @@
import QtQuick 2.6
import QtQml.Models 2.1
import QtQuick.Controls 2.5
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
import QtQuick.Templates 2.5 as T
T.TabButton {

View File

@ -1,7 +1,7 @@
import QtQuick.Controls 2.5
import QtQuick 2.6
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.ToolButton {
id: controlRoot

View File

@ -3,7 +3,7 @@ import QtQuick 2.6
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.5 as Controls
import QtQuick.Templates 2.5 as T
import org.kylin.qqc2style.private 1.0 as StylePrivate
import org.ukui.qqc2style.private 1.0 as StylePrivate
T.ToolTip {

View File

@ -1,13 +1,10 @@
TEMPLATE = subdirs
SUBDIRS += \
qqc2-style-plugin
DISTFILES += org.kylin.style/*
DISTFILES += org.ukui.style/*
unix {
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/QtQuick/Controls.2/org.kylin.style/
template.files = org.kylin.style/*
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/QtQuick/Controls.2/org.ukui.style/
template.files = org.ukui.style/*
template.path = $$installPath
INSTALLS += template
}

View File

@ -220,7 +220,7 @@ void KDefaultStyleParameters::initPalette(bool isDark)
windowText_dis.setRgb(255, 255, 255, 255 * 0.3);
button_at.setRgb(55, 55, 59);
button_iat.setRgb(55, 55, 59);
button_dis.setRgb(46, 46, 48);
button_dis.setRgb(46, 46, 46);
light_at.setRgb(255, 255, 255),
light_iat.setRgb(255, 255, 255),
light_dis.setRgb(242, 242, 242),
@ -379,21 +379,32 @@ void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyle
QBrush clickBrush;
QBrush hoverBrush;
QBrush disableBrush;
QBrush disableOnBrush;
QBrush checkBrush;
QBrush checkHoverBrush;
QBrush checkClickBrush;
QBrush checkDisableBrush;
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
if (isDark) {
hoverBrush = QBrush(mixColor(highlight, mix, 0.2));
clickBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
hoverBrush = QBrush(mixColor(highlight, mix, 0.05));
}
if (isDark) {
clickBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
clickBrush = QBrush(mixColor(highlight, mix, 0.2));
}
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
checkHoverBrush = hoverBrush;
checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
if (qobject_cast<const QPushButton *>(widget)) {
bool isWindowButton = false;
@ -456,11 +467,14 @@ void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyle
}
}
pushButtonParameters.pushButtonDefaultBrush = defaultBrush;
pushButtonParameters.pushButtonClickBrush = clickBrush;
pushButtonParameters.pushButtonHoverBrush = hoverBrush;
pushButtonParameters.pushButtonDisableBrush = disableBrush;
pushButtonParameters.pushButtonDisableOnBrush = disableOnBrush;
pushButtonParameters.pushButtonDefaultBrush = defaultBrush;
pushButtonParameters.pushButtonClickBrush = clickBrush;
pushButtonParameters.pushButtonHoverBrush = hoverBrush;
pushButtonParameters.pushButtonDisableBrush = disableBrush;
pushButtonParameters.pushButtonCheckBrush = checkBrush;
pushButtonParameters.pushButtonCheckHoverBrush = checkHoverBrush;
pushButtonParameters.pushButtonCheckClickBrush = checkClickBrush;
pushButtonParameters.pushButtonCheckDisableBrush = checkDisableBrush;
}
void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -471,7 +485,12 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
QBrush clickBrush;
QBrush hoverBrush;
QBrush disableBrush;
QBrush disableOnBrush;
QBrush checkBrush;
QBrush checkHoverBrush;
QBrush checkClickBrush;
QBrush checkDisableBrush;
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
@ -484,7 +503,11 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
}
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
checkHoverBrush = hoverBrush;
checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
if (qobject_cast<const QToolButton *>(widget)) {
bool isWindowButton = false;
@ -539,11 +562,14 @@ void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyle
}
}
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
toolButtonParameters.toolButtonClickBrush = clickBrush;
toolButtonParameters.toolButtonHoverBrush = hoverBrush;
toolButtonParameters.toolButtonDisableBrush = disableBrush;
toolButtonParameters.toolButtonDisableOnBrush = disableOnBrush;
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
toolButtonParameters.toolButtonClickBrush = clickBrush;
toolButtonParameters.toolButtonHoverBrush = hoverBrush;
toolButtonParameters.toolButtonDisableBrush = disableBrush;
toolButtonParameters.toolButtonCheckBrush = checkBrush;
toolButtonParameters.toolButtonCheckHoverBrush = checkHoverBrush;
toolButtonParameters.toolButtonCheckClickBrush = checkClickBrush;
toolButtonParameters.toolButtonCheckDisableBrush = checkDisableBrush;
}
void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -563,6 +589,7 @@ void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
hoverBrush = defaultBrush;
@ -576,6 +603,7 @@ void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
lineEditParameters.lineEditDefaultBrush = defaultBrush;
@ -603,9 +631,18 @@ void KDefaultStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
QPen focusPen;
QPen disablePen;
QBrush upHoverBrush;
QBrush upFocusHoverBrush;
QBrush upClickBrush;
QBrush downHoverBrush;
QBrush downFocusHoverBrush;
QBrush downClickBrush;
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
hoverBrush = defaultBrush;
@ -619,6 +656,53 @@ void KDefaultStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor button = option->palette.color(QPalette::Active, QPalette::Button);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
//up hover
if (isDark) {
upHoverBrush = QBrush(mixColor(button, mix, 0.2));
} else {
upHoverBrush = QBrush(mixColor(button, mix, 0.05));
}
//up focus hover
if (isDark) {
upFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.2));
} else {
upFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.05));
}
//up click
if (isDark) {
upClickBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
upClickBrush = QBrush(mixColor(highlight, mix, 0.2));
}
//down hover
if (isDark) {
downHoverBrush = QBrush(mixColor(button, mix, 0.2));
} else {
downHoverBrush = QBrush(mixColor(button, mix, 0.05));
}
//down focus hover
if (isDark) {
downFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.2));
} else {
downFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.05));
}
//down click
if (isDark) {
downClickBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
downClickBrush = QBrush(mixColor(highlight, mix, 0.2));
}
spinBoxParameters.spinBoxDefaultBrush = defaultBrush;
@ -630,6 +714,13 @@ void KDefaultStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
spinBoxParameters.spinBoxHoverPen = hoverPen;
spinBoxParameters.spinBoxFocusPen = focusPen;
spinBoxParameters.spinBoxDisablePen = disablePen;
spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush;
spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush;
spinBoxParameters.spinBoxUpClickBrush = upClickBrush;
spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush;
spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush;
spinBoxParameters.spinBoxDownClickBrush = downClickBrush;
}
void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -654,6 +745,7 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
if (isDark) {
@ -662,6 +754,7 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
hoverBrush = QBrush(mixColor(button, mix, 0.05));
}
hoverPen = QPen(Qt::NoPen);
hoverPen.setWidth(0);
//on state
if (isDark) {
@ -670,6 +763,7 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
onBrush = QBrush(mixColor(button, mix, 0.2));
}
onPen = QPen(Qt::NoPen);
onPen.setWidth(0);
//focus and on state,edit mode
editBrush = option->palette.brush(QPalette::Active, QPalette::Base);
@ -679,7 +773,7 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
comboBoxParameters.comboBoxDefaultBrush = defaultBrush;
comboBoxParameters.comboBoxHoverBrush = hoverBrush;
@ -850,10 +944,12 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//on default
onDefaultPen = QPen(Qt::NoPen);
onDefaultPen.setWidth(0);
onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight);
//on hover
onHoverPen = QPen(Qt::NoPen);
onHoverPen.setWidth(0);
if (isDark) {
onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2));
} else {
@ -862,6 +958,7 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//on click
onClickPen = QPen(Qt::NoPen);
onClickPen.setWidth(0);
if (isDark) {
onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05));
} else {
@ -939,10 +1036,12 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//on default
onDefaultPen = QPen(Qt::NoPen);
onDefaultPen.setWidth(0);
onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight);
//on hover
onHoverPen = QPen(Qt::NoPen);
onHoverPen.setWidth(0);
if (isDark) {
onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2));
} else {
@ -951,6 +1050,7 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//on click
onClickPen = QPen(Qt::NoPen);
onClickPen.setWidth(0);
if (isDark) {
onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05));
} else {
@ -1060,10 +1160,10 @@ void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
//groove value default
grooveValueDefaultBrush = handleHoverBrush;
grooveValueDefaultBrush = QBrush(highlight);
//groove value hover
grooveValueHoverBrush = handleClickBrush;
grooveValueHoverBrush = QBrush(highlight);
//groove value disable
grooveValueDisableBrush = handleDisableBrush;
@ -1267,14 +1367,14 @@ void KDefaultStyleParameters::initMenuParameters(bool isDark, const QStyleOption
QPainter pixmapPainter(&framePixmap);
pixmapPainter.setPen(Qt::NoPen);
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(300));
pixmapPainter.setRenderHint(QPainter::Antialiasing, true);
pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter.drawRoundedRect(option->rect, frameradius, frameradius);
} else {
int rander = 5;
// Draw a black floor
QPainter pixmapPainter(&framePixmap);
pixmapPainter.setRenderHint(QPainter::Antialiasing, true);
pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter.setPen(Qt::transparent);
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText));
pixmapPainter.drawRoundedRect(option->rect.adjusted(+rander, +rander, -rander, -rander), frameradius, frameradius);
@ -1287,7 +1387,7 @@ void KDefaultStyleParameters::initMenuParameters(bool isDark, const QStyleOption
// Dig out the center part, Shadow rendering
framePixmap = QPixmap::fromImage(img);
QPainter pixmapPainter2(&framePixmap);
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
pixmapPainter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear);
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(Qt::transparent);
@ -1329,7 +1429,7 @@ void KDefaultStyleParameters::initMenuParameters(bool isDark, const QStyleOption
//draw blur background
QPainter pixmapPainter3(&framePixmap);
pixmapPainter3.setRenderHint(QPainter::Antialiasing);
pixmapPainter3.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter3.setPen(Qt::transparent);
pixmapPainter3.setBrush(color);
pixmapPainter3.drawPath(path);
@ -1664,18 +1764,18 @@ void KFashionStyleParameters::initPalette(bool isDark)
// shadow_at(214, 214, 214),
// shadow_iat(214, 214, 214),
// shadow_dis(201, 201, 201),
highLight_at(55, 144, 250),
highLight_iat(55, 144, 250),
highLight_at(120, 115, 245),
highLight_iat(120, 115, 245),
highLight_dis(233, 233, 233),
highLightText_at(255, 255, 255),
highLightText_iat(255, 255, 255),
highLightText_dis(179, 179, 179),
link_at(55, 144, 250),
link_iat(55, 144, 250),
link_dis(55, 144, 250),
linkVisited_at(114, 46, 209),
linkVisited_iat(114, 46, 209),
linkVisited_dis(114, 46, 209),
link_at(120, 115, 245),
link_iat(120, 115, 245),
link_dis(120, 115, 245),
linkVisited_at(62, 118, 247),
linkVisited_iat(62, 118, 247),
linkVisited_dis(62, 118, 247),
alternateBase_at(245, 245, 245),
alternateBase_iat(245, 245, 245),
alternateBase_dis(245, 245, 245),
@ -1699,7 +1799,7 @@ void KFashionStyleParameters::initPalette(bool isDark)
windowText_dis.setRgb(255, 255, 255, 255 * 0.3);
button_at.setRgb(55, 55, 59);
button_iat.setRgb(55, 55, 59);
button_dis.setRgb(46, 46, 48);
button_dis.setRgb(46, 46, 46);
light_at.setRgb(255, 255, 255),
light_iat.setRgb(255, 255, 255),
light_dis.setRgb(242, 242, 242),
@ -1733,18 +1833,18 @@ void KFashionStyleParameters::initPalette(bool isDark)
// shadow_at.setRgb(214, 214, 214);
// shadow_iat.setRgb(214, 214, 214);
// shadow_dis.setRgb(201, 201, 201);
highLight_at.setRgb(55, 144, 250);
highLight_iat.setRgb(55, 144, 250);
highLight_at.setRgb(120, 115, 245);
highLight_iat.setRgb(120, 115, 245);
highLight_dis.setRgb(46, 46, 46);
highLightText_at.setRgb(255, 255, 255);
highLightText_iat.setRgb(255, 255, 255);
highLightText_dis.setRgb(77, 77, 77);
link_at.setRgb(55, 144, 250);
link_iat.setRgb(55, 144, 250);
link_dis.setRgb(55, 144, 250);
linkVisited_at.setRgb(114, 46, 209);
linkVisited_iat.setRgb(114, 46, 209);
linkVisited_dis.setRgb(114, 46, 209);
link_at.setRgb(120, 115, 245);
link_iat.setRgb(120, 115, 245);
link_dis.setRgb(120, 115, 245);
linkVisited_at.setRgb(62, 118, 247);
linkVisited_iat.setRgb(62, 118, 247);
linkVisited_dis.setRgb(62, 118, 247);
alternateBase_at.setRgb(38, 38, 38);
alternateBase_iat.setRgb(38, 38, 38);
alternateBase_dis.setRgb(38, 38, 38);
@ -1857,7 +1957,11 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
QBrush clickBrush;
QBrush hoverBrush;
QBrush disableBrush;
QBrush disableOnBrush;
QBrush checkBrush;
QBrush checkHoverBrush;
QBrush checkClickBrush;
QBrush checkDisableBrush;
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
@ -1883,7 +1987,11 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
clickBrush = QBrush(mixColor(highlight, mix, 0.1));
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
checkHoverBrush = hoverBrush;
checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
if (qobject_cast<const QPushButton *>(widget)) {
bool isWindowButton = false;
@ -1960,11 +2068,14 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle
}
}
pushButtonParameters.pushButtonDefaultBrush = defaultBrush;
pushButtonParameters.pushButtonClickBrush = clickBrush;
pushButtonParameters.pushButtonHoverBrush = hoverBrush;
pushButtonParameters.pushButtonDisableBrush = disableBrush;
pushButtonParameters.pushButtonDisableOnBrush = disableOnBrush;
pushButtonParameters.pushButtonDefaultBrush = defaultBrush;
pushButtonParameters.pushButtonClickBrush = clickBrush;
pushButtonParameters.pushButtonHoverBrush = hoverBrush;
pushButtonParameters.pushButtonDisableBrush = disableBrush;
pushButtonParameters.pushButtonCheckBrush = checkBrush;
pushButtonParameters.pushButtonCheckHoverBrush = checkHoverBrush;
pushButtonParameters.pushButtonCheckClickBrush = checkClickBrush;
pushButtonParameters.pushButtonCheckDisableBrush = checkDisableBrush;
}
void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -1975,7 +2086,12 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
QBrush clickBrush;
QBrush hoverBrush;
QBrush disableBrush;
QBrush disableOnBrush;
QBrush checkBrush;
QBrush checkHoverBrush;
QBrush checkClickBrush;
QBrush checkDisableBrush;
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
@ -2001,7 +2117,11 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
clickBrush = QBrush(mixColor(highlight, mix, 0.1));
defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
checkHoverBrush = hoverBrush;
checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
if (qobject_cast<const QToolButton *>(widget)) {
bool isWindowButton = false;
@ -2070,11 +2190,14 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
}
}
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
toolButtonParameters.toolButtonClickBrush = clickBrush;
toolButtonParameters.toolButtonHoverBrush = hoverBrush;
toolButtonParameters.toolButtonDisableBrush = disableBrush;
toolButtonParameters.toolButtonDisableOnBrush = disableOnBrush;
toolButtonParameters.toolButtonDefaultBrush = defaultBrush;
toolButtonParameters.toolButtonClickBrush = clickBrush;
toolButtonParameters.toolButtonHoverBrush = hoverBrush;
toolButtonParameters.toolButtonDisableBrush = disableBrush;
toolButtonParameters.toolButtonCheckBrush = checkBrush;
toolButtonParameters.toolButtonCheckHoverBrush = checkHoverBrush;
toolButtonParameters.toolButtonCheckClickBrush = checkClickBrush;
toolButtonParameters.toolButtonCheckDisableBrush = checkDisableBrush;
}
void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -2094,6 +2217,7 @@ void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
hoverBrush = defaultBrush;
@ -2102,11 +2226,12 @@ void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
//focus state
focusBrush = option->palette.brush(QPalette::Active, QPalette::Base);
focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
lineEditParameters.lineEditDefaultBrush = defaultBrush;
@ -2134,9 +2259,17 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
QPen focusPen;
QPen disablePen;
QBrush upHoverBrush;
QBrush upFocusHoverBrush;
QBrush upClickBrush;
QBrush downHoverBrush;
QBrush downFocusHoverBrush;
QBrush downClickBrush;
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
hoverBrush = defaultBrush;
@ -2145,11 +2278,81 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
//focus state
focusBrush = option->palette.brush(QPalette::Active, QPalette::Base);
focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor button = option->palette.color(QPalette::Active, QPalette::Button);
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
QColor startColor;
QColor endColor;
QLinearGradient upLinearGradient;
upLinearGradient.setStart(option->rect.left(), option->rect.top());
upLinearGradient.setFinalStop(option->rect.left(), option->rect.center().y());
//up hover
if (isDark) {
startColor = mixColor(button, QColor(Qt::white), 0.2);
endColor = mixColor(button, QColor(Qt::white), 0.05);
} else {
startColor = mixColor(button, QColor(Qt::black), 0.05);
endColor = mixColor(button, QColor(Qt::black), 0.2);
}
upLinearGradient.setColorAt(0, startColor);
upLinearGradient.setColorAt(1, endColor);
upHoverBrush = QBrush(upLinearGradient);
//up focus hover
if (isDark) {
startColor = mixColor(highlight, QColor(Qt::white), 0.2);
endColor = mixColor(highlight, QColor(Qt::black), 0.05);
} else {
startColor = mixColor(highlight, QColor(Qt::white), 0.05);
endColor = mixColor(highlight, QColor(Qt::black), 0.2);
}
upLinearGradient.setColorAt(0, startColor);
upLinearGradient.setColorAt(1, endColor);
upFocusHoverBrush = QBrush(upLinearGradient);
//up click
upClickBrush = QBrush(mixColor(highlight, mix, 0.1));
QLinearGradient downLinearGradient;
downLinearGradient.setStart(option->rect.left(), option->rect.center().y());
downLinearGradient.setFinalStop(option->rect.left(), option->rect.bottom());
//down hover
if (isDark) {
startColor = mixColor(button, QColor(Qt::white), 0.2);
endColor = mixColor(button, QColor(Qt::white), 0.05);
} else {
startColor = mixColor(button, QColor(Qt::black), 0.05);
endColor = mixColor(button, QColor(Qt::black), 0.2);
}
downLinearGradient.setColorAt(0, startColor);
downLinearGradient.setColorAt(1, endColor);
downHoverBrush = QBrush(downLinearGradient);
//down focus hover
if (isDark) {
startColor = mixColor(highlight, QColor(Qt::white), 0.2);
endColor = mixColor(highlight, QColor(Qt::black), 0.05);
} else {
startColor = mixColor(highlight, QColor(Qt::white), 0.05);
endColor = mixColor(highlight, QColor(Qt::black), 0.2);
}
downLinearGradient.setColorAt(0, startColor);
downLinearGradient.setColorAt(1, endColor);
downFocusHoverBrush = QBrush(downLinearGradient);
//down click
downClickBrush = QBrush(mixColor(highlight, mix, 0.1));
spinBoxParameters.spinBoxDefaultBrush = defaultBrush;
@ -2161,6 +2364,13 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
spinBoxParameters.spinBoxHoverPen = hoverPen;
spinBoxParameters.spinBoxFocusPen = focusPen;
spinBoxParameters.spinBoxDisablePen = disablePen;
spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush;
spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush;
spinBoxParameters.spinBoxUpClickBrush = upClickBrush;
spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush;
spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush;
spinBoxParameters.spinBoxDownClickBrush = downClickBrush;
}
void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -2185,6 +2395,7 @@ void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
defaultPen = QPen(Qt::NoPen);
defaultPen.setWidth(0);
//hover state
if (isDark) {
@ -2193,6 +2404,7 @@ void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
hoverBrush = QBrush(mixColor(button, mix, 0.05));
}
hoverPen = QPen(Qt::NoPen);
hoverPen.setWidth(0);
//on state
if (isDark) {
@ -2201,15 +2413,17 @@ void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp
onBrush = QBrush(mixColor(button, mix, 0.2));
}
onPen = QPen(Qt::NoPen);
onPen.setWidth(0);
//focus and on state,edit mode
editBrush = option->palette.brush(QPalette::Active, QPalette::Base);
editPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
//disable state
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
comboBoxParameters.comboBoxDefaultBrush = defaultBrush;
@ -2426,10 +2640,12 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//on default
onDefaultPen = QPen(Qt::NoPen);
onDefaultPen.setWidth(0);
onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight);
//on hover
onHoverPen = QPen(Qt::NoPen);
onHoverPen.setWidth(0);
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
@ -2448,6 +2664,7 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//on click
onClickPen = QPen(Qt::NoPen);
onClickPen.setWidth(0);
onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.1));
checkBoxParameters.checkBoxDefaultPen = defaultPen;
@ -2521,10 +2738,12 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//on default
onDefaultPen = QPen(Qt::NoPen);
onDefaultPen.setWidth(0);
onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight);
//on hover
onHoverPen = QPen(Qt::NoPen);
onHoverPen.setWidth(0);
if (isDark) {
onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2));
} else {
@ -2533,6 +2752,7 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//on click
onClickPen = QPen(Qt::NoPen);
onClickPen.setWidth(0);
if (isDark) {
onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05));
} else {
@ -2656,10 +2876,10 @@ void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
//groove value default
grooveValueDefaultBrush = handleHoverBrush;
grooveValueDefaultBrush = QBrush(highlight);
//groove value hover
grooveValueHoverBrush = handleClickBrush;
grooveValueHoverBrush = QBrush(highlight);
//groove value disable
grooveValueDisableBrush = handleDisableBrush;
@ -2889,7 +3109,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
QPainter pixmapPainter(&framePixmap);
pixmapPainter.setPen(Qt::NoPen);
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(300));
pixmapPainter.setRenderHint(QPainter::Antialiasing, true);
pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter.drawPath(drawRectPath);
pixmapPainter.end();
@ -2909,7 +3129,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
linearGradient.setColorAt(1, endColor);
linearGradient.setStart(drawRect.right(), drawRect.bottom() - 28);
linearGradient.setFinalStop(drawRect.right(), drawRect.bottom());
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
pixmapPainter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(linearGradient);
pixmapPainter2.drawPath(drawRightBottomPath);
@ -2919,7 +3139,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
// Draw a black floor
QPainter pixmapPainter(&framePixmap);
pixmapPainter.setRenderHint(QPainter::Antialiasing, true);
pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter.setPen(Qt::transparent);
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText));
pixmapPainter.drawRoundedRect(drawRect.adjusted(1, 1, -1, -1), frameradius, frameradius);
@ -2932,7 +3152,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
// Dig out the center part, Shadow rendering
framePixmap = QPixmap::fromImage(img);
QPainter pixmapPainter2(&framePixmap);
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
pixmapPainter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear);
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(Qt::transparent);
@ -2990,7 +3210,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
//draw blur background
QPainter pixmapPainter3(&framePixmap);
pixmapPainter3.setRenderHint(QPainter::Antialiasing);
pixmapPainter3.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter3.setPen(Qt::transparent);
pixmapPainter3.setBrush(color);
pixmapPainter3.drawPath(path);
@ -3011,7 +3231,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
//draw blur background
QPainter pixmapPainter3(&framePixmap);
pixmapPainter3.setRenderHint(QPainter::Antialiasing);
pixmapPainter3.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter3.setPen(Qt::transparent);
pixmapPainter3.setBrush(color);
pixmapPainter3.drawPath(drawRectPath);
@ -3031,7 +3251,7 @@ void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption
linearGradient.setStart(drawRect.right(), drawRect.bottom() - 28);
linearGradient.setFinalStop(drawRect.right(), drawRect.bottom());
QPainter pixmapPainter4(&framePixmap);
pixmapPainter4.setRenderHint(QPainter::Antialiasing);
pixmapPainter4.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter4.setPen(Qt::transparent);
pixmapPainter4.setBrush(linearGradient);
pixmapPainter4.drawPath(drawRightBottomPath);

View File

@ -40,7 +40,11 @@ public:
QBrush pushButtonHoverBrush;
QBrush pushButtonClickBrush;
QBrush pushButtonDisableBrush;
QBrush pushButtonDisableOnBrush;
QBrush pushButtonCheckBrush;
QBrush pushButtonCheckHoverBrush;
QBrush pushButtonCheckClickBrush;
QBrush pushButtonCheckDisableBrush;
// QColor PushButtonInactiveColor;

View File

@ -131,13 +131,13 @@ Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxySty
}
if (m_type == "default") {
sp = new KDefaultStyleParameters(this, dark);
sp = new KDefaultStyleParameters(this, isUseDarkPalette());
} else if (m_type == "classical") {
sp = new KClassicalStyleParameters(this, dark);
sp = new KClassicalStyleParameters(this, isUseDarkPalette());
} else if (m_type == "fashion"){
sp = new KFashionStyleParameters(this, dark);
sp = new KFashionStyleParameters(this, isUseDarkPalette());
} else {
sp = new KDefaultStyleParameters(this, dark);
sp = new KDefaultStyleParameters(this, isUseDarkPalette());
}
if (auto settings = UKUIStyleSettings::globalInstance()) {
@ -458,6 +458,7 @@ void Qt5UKUIStyle::polish(QWidget *widget)
if (auto v = qobject_cast<QAbstractItemView *>(widget)) {
v->viewport()->setAttribute(Qt::WA_Hover);
v->setAttribute(Qt::WA_InputMethodEnabled);
}
if(qobject_cast<QToolButton*>(widget))
@ -671,7 +672,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
{
sp->initMenuParameters(isUseDarkPalette(), option, widget);
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(option->rect, sp->menuParameters.menuFramePixmap, sp->menuParameters.menuFramePixmap.rect());;
painter->restore();
return;
@ -700,16 +701,22 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
const bool hover = button->state & State_MouseOver;
const bool sunken = button->state & State_Sunken;
const bool on = button->state & State_On;
bool roundButton = false;
if (widget && widget->property("isRoundButton").isValid()) {
roundButton = widget->property("isRoundButton").toBool();
}
painter->save();
painter->setPen(Qt::NoPen);
if (!enable) {
// if (animator) {
// animator->stopAnimator("SunKen");
// animator->stopAnimator("MouseOver");
// }
painter->save();
painter->setPen(Qt::NoPen);
if (on) {
painter->setBrush(sp->pushButtonParameters.pushButtonDisableOnBrush);
painter->setBrush(sp->pushButtonParameters.pushButtonCheckDisableBrush);
}
else if (button->features & QStyleOptionButton::Flat) {
painter->setBrush(Qt::NoBrush);
@ -721,23 +728,36 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
painter->drawRoundedRect(option->rect, sp->pushButtonParameters.radius, sp->pushButtonParameters.radius);
painter->restore();
return;
}
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setPen(Qt::NoPen);
if (sunken || on) {
painter->setBrush(sp->pushButtonParameters.pushButtonClickBrush);
} else if (hover) {
painter->setBrush(sp->pushButtonParameters.pushButtonHoverBrush);
} else {
if (button->features & QStyleOptionButton::Flat) {
painter->setBrush(Qt::NoBrush);
if (on) {
if (sunken) {
painter->setBrush(sp->pushButtonParameters.pushButtonCheckClickBrush);
} else if (hover) {
painter->setBrush(sp->pushButtonParameters.pushButtonCheckHoverBrush);
} else {
painter->setBrush(sp->pushButtonParameters.pushButtonCheckBrush);
}
} else {
painter->setBrush(sp->pushButtonParameters.pushButtonDefaultBrush);
if (sunken) {
painter->setBrush(sp->pushButtonParameters.pushButtonClickBrush);
} else if (hover) {
painter->setBrush(sp->pushButtonParameters.pushButtonHoverBrush);
} else {
if (button->features & QStyleOptionButton::Flat) {
painter->setBrush(Qt::NoBrush);
} else {
painter->setBrush(sp->pushButtonParameters.pushButtonDefaultBrush);
}
}
}
}
painter->drawRoundedRect(option->rect, sp->pushButtonParameters.radius, sp->pushButtonParameters.radius);
painter->setRenderHint(QPainter::Antialiasing, true);
if (roundButton) {
painter->drawEllipse(option->rect);
} else {
painter->drawRoundedRect(option->rect, sp->pushButtonParameters.radius, sp->pushButtonParameters.radius);
}
painter->restore();
return;
@ -843,7 +863,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QStyleOption opt = *option;
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QPainterPath rectPath;
rectPath.addRoundedRect(option->rect.adjusted(+3, +3, -3, -3), sp->toolTipParameters.radius, sp->toolTipParameters.radius);
@ -851,7 +871,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QPixmap pixmap(option->rect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
pixmapPainter.setRenderHint(QPainter::Antialiasing);
pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter.setPen(Qt::transparent);
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText));
pixmapPainter.drawPath(rectPath);
@ -864,7 +884,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
// Dig out the center part
pixmap = QPixmap::fromImage(img);
QPainter pixmapPainter2(&pixmap);
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
pixmapPainter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear);
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(Qt::transparent);
@ -893,7 +913,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
}
opt.palette.setColor(QPalette::ToolTipBase, color);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QPen pen(opt.palette.toolTipBase().color().darker(150), 1);
pen.setCapStyle(Qt::RoundCap);
pen.setJoinStyle(Qt::RoundJoin);
@ -950,43 +970,56 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
const bool sunken = option->state & State_Sunken;
const bool hover = option->state & State_MouseOver;
const bool on = option->state & State_On;
bool roundButton = false;
if (widget && widget->property("isRoundButton").isValid()) {
roundButton = widget->property("isRoundButton").toBool();
}
painter->save();
painter->setPen(Qt::NoPen);
if (!enable) {
// if (animator) {
// animator->stopAnimator("SunKen");
// animator->stopAnimator("MouseOver");
// }
painter->save();
painter->setPen(Qt::NoPen);
if (on) {
painter->setBrush(sp->toolButtonParameters.toolButtonDisableOnBrush);
painter->setBrush(sp->toolButtonParameters.toolButtonCheckDisableBrush);
} else if (raise) {
painter->setBrush(Qt::NoBrush);
} else {
painter->setBrush(sp->toolButtonParameters.toolButtonDisableBrush);
}
painter->setRenderHint(QPainter::Antialiasing, true);
painter->drawRoundedRect(option->rect, sp->toolButtonParameters.radius, sp->toolButtonParameters.radius);
painter->restore();
return;
}
painter->save();
painter->setPen(Qt::NoPen);
if (sunken || on) {
painter->setBrush(sp->toolButtonParameters.toolButtonClickBrush);
} else if (hover) {
painter->setBrush(sp->toolButtonParameters.toolButtonHoverBrush);
} else {
if (raise) {
painter->setBrush(Qt::NoBrush);
if (on) {
if (sunken) {
painter->setBrush(sp->toolButtonParameters.toolButtonCheckClickBrush);
} else if (hover) {
painter->setBrush(sp->toolButtonParameters.toolButtonCheckHoverBrush);
} else {
painter->setBrush(sp->toolButtonParameters.toolButtonCheckBrush);
}
} else {
painter->setBrush(sp->toolButtonParameters.toolButtonDefaultBrush);
if (sunken) {
painter->setBrush(sp->toolButtonParameters.toolButtonClickBrush);
} else if (hover) {
painter->setBrush(sp->toolButtonParameters.toolButtonHoverBrush);
} else {
if (raise) {
painter->setBrush(Qt::NoBrush);
} else {
painter->setBrush(sp->toolButtonParameters.toolButtonDefaultBrush);
}
}
}
}
painter->setRenderHint(QPainter::Antialiasing, true);
painter->drawRoundedRect(option->rect, sp->toolButtonParameters.radius, sp->toolButtonParameters.radius);
if (roundButton) {
painter->drawEllipse(option->rect);
} else {
painter->drawRoundedRect(option->rect, sp->toolButtonParameters.radius, sp->toolButtonParameters.radius);
}
painter->restore();
return;
@ -1067,7 +1100,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
{
painter->save();
painter->setPen(Qt::NoPen);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->setBrush(option->palette.brush(QPalette::Active, QPalette::Text));
if (option->state & (State_On | State_Sunken)) {
painter->setOpacity(0.15);
@ -1227,6 +1260,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
painter->restore();
return;
@ -1248,6 +1282,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
painter->restore();
return;
@ -1269,6 +1304,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
painter->restore();
return;
@ -1290,6 +1326,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
painter->restore();
return;
@ -1370,62 +1407,81 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
bool noChange = checkbox->state & State_NoChange;
QRectF rect = checkbox->rect;
int width = rect.width();
int heigth = rect.height();
QRectF pathrect = rect.adjusted(1, 1, -1, -1);
double width = pathrect.width();
double heigth = pathrect.height();
int margin = 0;
QPainterPath path;
if (on) {
path.moveTo(width / 4 + checkbox->rect.left(), heigth / 2 + checkbox->rect.top());
path.lineTo(width * 0.45 + checkbox->rect.left(), heigth * 3 / 4 + checkbox->rect.top());
path.lineTo(width * 3 / 4 + checkbox->rect.left(), heigth / 4 + checkbox->rect.top());
path.moveTo(pathrect.left() + width / 4, pathrect.top() + heigth / 2);
path.lineTo(pathrect.left() + width * 0.45, pathrect.bottom() - heigth / 3);
path.lineTo(pathrect.right() - width / 4, pathrect.top() + heigth / 3);
} else if (noChange) {
path.moveTo(rect.left() + width / 4, rect.center().y());
path.lineTo(rect.right() - width / 4 , rect.center().y());
path.moveTo(pathrect.left() + width / 4, pathrect.center().y());
path.lineTo(pathrect.right() - width / 4, pathrect.center().y());
}
painter->save();
painter->setClipRect(rect);
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setRenderHint(QPainter::Antialiasing);
if (enable) {
if (on | noChange) {
if (sunKen) {
margin = sp->checkBoxParameters.checkBoxOnClickPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxOnClickPen);
painter->setBrush(sp->checkBoxParameters.checkBoxOnClickBrush);
} else if (mouseOver) {
margin = sp->checkBoxParameters.checkBoxOnHoverPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxOnHoverPen);
painter->setBrush(sp->checkBoxParameters.checkBoxOnHoverBrush);
} else {
margin = sp->checkBoxParameters.checkBoxOnDefaultPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxOnDefaultPen);
painter->setBrush(sp->checkBoxParameters.checkBoxOnDefaultBrush);
}
painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
painter->drawRoundedRect(rect.adjusted(margin, margin, -margin, -margin), sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
//draw path
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
if (on) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 1.5,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
} else if (noChange) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
painter->setBrush(Qt::NoBrush);
painter->drawPath(path);
} else {
if (sunKen) {
margin = sp->checkBoxParameters.checkBoxClickPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxClickPen);
painter->setBrush(sp->checkBoxParameters.checkBoxClickBrush);
} else if (mouseOver) {
margin = sp->checkBoxParameters.checkBoxHoverPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxHoverPen);
painter->setBrush(sp->checkBoxParameters.checkBoxHoverBrush);
} else {
margin = sp->checkBoxParameters.checkBoxDefaultPen.width();
painter->setPen(sp->checkBoxParameters.checkBoxDefaultPen);
painter->setBrush(sp->checkBoxParameters.checkBoxDefaultBrush);
}
painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
painter->drawRoundedRect(rect.adjusted(margin, margin, -margin, -margin), sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
}
} else {
margin = sp->checkBoxParameters.checkBoxDisablePen.width();
painter->setPen(sp->checkBoxParameters.checkBoxDisablePen);
painter->setBrush(sp->checkBoxParameters.checkBoxDisableBrush);
painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
painter->drawRoundedRect(rect.adjusted(margin, margin, -margin, -margin), sp->checkBoxParameters.radius, sp->checkBoxParameters.radius);
if (on | noChange) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Disabled, QPalette::ButtonText), 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
if (on) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 1.5,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
} else if (noChange) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
painter->setBrush(Qt::NoBrush);
painter->drawPath(path);
}
@ -2044,10 +2100,15 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty
upPath.lineTo(upRect.left(), upRect.top() - sp->spinBoxParameters.radius);
upOption.state |= State_Enabled;
if (up && enable) {
painter->setBrush(this->highLight_Hover(option));
upOption.state |= State_MouseOver;
if (focus) {
painter->setBrush(sp->spinBoxParameters.spinBoxUpFocusHoverBrush);
upOption.state |= State_MouseOver;
} else {
painter->setBrush(sp->spinBoxParameters.spinBoxUpHoverBrush);
}
if (option->state & State_Sunken) {
painter->setBrush(this->highLight_Click(option));
painter->setBrush(sp->spinBoxParameters.spinBoxUpClickBrush);
upOption.state |= State_Sunken;
}
painter->drawPath(upPath);
@ -2069,10 +2130,15 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty
downPath.lineTo(downRect.left(), downRect.bottom() - sp->spinBoxParameters.radius);
downOption.state |= State_Enabled;
if (down && enable) {
painter->setBrush(this->highLight_Hover(option));
downOption.state |= State_MouseOver;
if (focus) {
painter->setBrush(sp->spinBoxParameters.spinBoxDownFocusHoverBrush);
downOption.state |= State_MouseOver;
} else {
painter->setBrush(sp->spinBoxParameters.spinBoxDownHoverBrush);
}
if (option->state & State_Sunken) {
painter->setBrush(this->highLight_Click(option));
painter->setBrush(sp->spinBoxParameters.spinBoxDownClickBrush);
downOption.state |= State_Sunken;
}
painter->drawPath(downPath);
@ -2411,7 +2477,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
QStyleOption sub = *option;
if (isImportant && !(button->features & QStyleOptionButton::Flat)) {
sub.state = option->state | State_On;
} else if (isWindowButton || useButtonPalette) {
} else if ((isWindowButton || useButtonPalette) && !(button->state & State_On)) {
sub.state = enable ? State_Enabled : State_None;
} else {
sub.state = option->state;
@ -2474,7 +2540,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
if (widget && !widget->property("useIconHighlightEffect").isValid()) {
if (isImportant || isWindowColoseButton) {
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &sub, widget);
} else if (useButtonPalette || isWindowButton) {
} else if ((isWindowButton || useButtonPalette) && !(button->state & State_On)) {
pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, &sub, widget);
} else {
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &sub, widget);
@ -2482,12 +2548,15 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
} else {
pixmap = HighLightEffect::generatePixmap(pixmap, &sub, widget);
}
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QStyle::drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
painter->restore();
}
if (textRect.isValid()) {
if (enable) {
if (isWindowButton || useButtonPalette) {
if ((isWindowButton || useButtonPalette) && !(button->state & State_On)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
} else {
if (isImportant) {
@ -2549,7 +2618,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
QRect drawRect = tb->rect;
QStyleOption sub = *option;
sub.state = (isWindowButton || useButtonPalette) ? (enable ? State_Enabled : State_None) : (option->state);
sub.state = ((isWindowButton || useButtonPalette) && !(option->state & State_On)) ? (enable ? State_Enabled : State_None) : (option->state);
if (arrow) {
int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, option, widget);
drawRect.adjust(ToolButton_MarginWidth, Margin_Height, -ToolButton_MarginWidth, -Margin_Height);
@ -2628,7 +2697,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
if (textRect.isValid()) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, enable, tb->text,
(isWindowButton || useButtonPalette) ? QPalette::ButtonText
((isWindowButton || useButtonPalette) && !(option->state & State_On)) ? QPalette::ButtonText
: (option->state & (State_On | State_Sunken | State_MouseOver) && (option->state & State_Enabled))
? QPalette::HighlightedText : QPalette::ButtonText);
}
@ -2662,7 +2731,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
if (widget && !widget->property("useIconHighlightEffect").isValid()) {
if (isWindowColoseButton) {
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &sub, widget);
} else if (useButtonPalette || isWindowButton) {
} else if ((isWindowButton || useButtonPalette) && !(option->state & State_On)) {
pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, &sub, widget);
} else {
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &sub, widget);
@ -2670,7 +2739,10 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
} else {
pixmap = HighLightEffect::generatePixmap(pixmap, &sub, widget);
}
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QStyle::drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
painter->restore();
}
return;
}
@ -2839,6 +2911,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
}
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
if (verticalTabs) {
int newX, newY, newRot;
if (tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::TriangularEast) {
@ -2907,6 +2980,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrow, painter, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
if (!comboBox->currentIcon.isNull()) {
QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
@ -2970,6 +3044,8 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
alignment |= Qt::TextHideMnemonic;
QPixmap pixmap;
QRect textRect = button->rect;
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
if (!button->icon.isNull()) {
pixmap = button->icon.pixmap(button->iconSize, enable ? QIcon::Normal : QIcon::Disabled);
proxy()->drawItemPixmap(painter, button->rect, alignment, pixmap);
@ -2982,6 +3058,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
button->palette, button->state & State_Enabled, button->text, QPalette::WindowText);
}
painter->restore();
return;
}
break;
@ -3002,7 +3079,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
{
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
{
QStyleOptionMenuItem item = *mbi;
@ -3116,7 +3193,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(Qt::NoBrush);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(iconRect, drawPixmap);
painter->restore();
}
@ -3132,7 +3209,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(Qt::NoBrush);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(iconRect, drawPixmap);
painter->restore();
}
@ -3152,7 +3229,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
painter->save();
painter->setPen(menuItem->palette.color(QPalette::Active, QPalette::Text));
painter->setBrush(Qt::NoBrush);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(iconRect, target);
painter->restore();
}
@ -3293,8 +3370,12 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
QString txt = tb->fontMetrics.elidedText(tb->text, Qt::ElideRight, tr.width());
if (ih)
if (ih) {
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm);
painter->restore();
}
int alignment = Qt::AlignCenter | Qt::AlignVCenter | Qt::TextShowMnemonic;
if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
@ -3491,7 +3572,10 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
textRect.setRect(iconRect.right() + 1 + 8, textRect.y(), textRect.width() - iconRect.width() - 8, textRect.height());
iconRect = visualRect(header->direction, rect, iconRect);
textRect = visualRect(header->direction, rect, textRect);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(iconRect, pixmap);
painter->restore();
}
if (header->state & QStyle::State_On) {
@ -3559,6 +3643,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
QIcon::State state = vi->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
QPixmap pixmap = vi->icon.pixmap(vi->decorationSize, mode, state);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QStyle::drawItemPixmap(painter, iconRect, vi->decorationAlignment, HighLightEffect::generatePixmap(pixmap, vi, widget));
}
@ -4327,7 +4412,7 @@ QRect Qt5UKUIStyle::subElementRect(SubElement element, const QStyleOption *optio
{
QRect rect;
int h = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
rect.setRect(option->rect.x(), option->rect.y() + ((option->rect.height() - h) / 2),
rect.setRect(option->rect.x() + 1, option->rect.y() + ((option->rect.height() - h) / 2),
proxy()->pixelMetric(PM_IndicatorWidth, option, widget), h);
rect = visualRect(option->direction, option->rect, rect);
return rect;

View File

@ -187,7 +187,7 @@ QPixmap ShadowHelper::getShadowPixmap(QColor color, /*ShadowHelper::State state,
QPixmap target = QPixmap::fromImage(rawImg);
QPainter painter2(&target);
painter2.save();
painter2.setRenderHint(QPainter::Antialiasing);
painter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter2.translate(shadow_border, shadow_border);
painter2.setCompositionMode(QPainter::CompositionMode_Clear);
painter2.fillPath(windowRelativePath, Qt::transparent);

View File

@ -44,6 +44,15 @@ public:
QPen spinBoxHoverPen;
QPen spinBoxFocusPen;
QPen spinBoxDisablePen;
QBrush spinBoxUpHoverBrush;
QBrush spinBoxUpFocusHoverBrush;
QBrush spinBoxUpClickBrush;
QBrush spinBoxDownHoverBrush;
QBrush spinBoxDownFocusHoverBrush;
QBrush spinBoxDownClickBrush;
};
#endif // SPINBOXPARAMETERS_H

View File

@ -38,7 +38,11 @@ public:
QBrush toolButtonHoverBrush;
QBrush toolButtonClickBrush;
QBrush toolButtonDisableBrush;
QBrush toolButtonDisableOnBrush;
QBrush toolButtonCheckBrush;
QBrush toolButtonCheckHoverBrush;
QBrush toolButtonCheckClickBrush;
QBrush toolButtonCheckDisableBrush;
};
#endif // TOOLBUTTONPARAMETERS_H

View File

@ -122,6 +122,11 @@ void Qt5UKUIStyle::viewItemDrawText(QPainter *painter, const QStyleOptionViewIte
const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
QTextOption textOption;
textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
//FIX ME,bug106749::QTablewidget text cannot be aligned, forced changed it wrap mode to wrapanywhere
if(wrapText && (widget->inherits("QTableWidget") || widget->inherits("QTableView")))
{
textOption.setWrapMode(QTextOption::WrapAnywhere);
}
textOption.setTextDirection(option->direction);
textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment));