Add a changelog 2022.10.20 3.20.1.1-0k3

This commit is contained in:
谭静 2022-10-20 16:16:39 +08:00
parent d5e5b7d6ce
commit 8cadc24763
28 changed files with 397 additions and 37327 deletions

10
debian/changelog vendored
View File

@ -1,3 +1,13 @@
qt5-ukui-platformtheme (3.20.1.1-0k3) yangtze; urgency=medium
* 改动:
BUG号
需求号:无
其他改:无(同步upstream分支更新、打tag)
影响域:无
-- tanjing <tanjing@kylinos.cn> Thu, 20 Oct 2022 16:07:38 +0800
qt5-ukui-platformtheme (3.20.1.1-0k2) yangtze; urgency=medium
* 改动:

81
debian/copyright vendored Normal file
View File

@ -0,0 +1,81 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qt5-ukui-platformtheme
Source: <https://github.com/ukui/qt5-ukui-platformtheme>
Files: *
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: debian/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: GPL-3.0+
Files: libqt5-ukui-style/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: qt5-ukui-platformtheme/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: qt5-ukui-platformtheme/ukui.json
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: qt5-ukui-platformtheme/widget/*
Copyright: 2020, KylinSoft Co., Ltd.
License: GPL-3.0+
Files: test/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: GPL-3.0+
Files: test/messagebox/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: GPL-3.0+
Files: ukui-styles/*
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: ukui-styles/proxy-style/ukui-style.json
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
Files: ukui-styles/qt5-style-ukui/qt5-style-ukui.json
Copyright: 2020, Tianjin KYLIN Information Technology Co., Ltd.
License: LGPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program 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 General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public License
Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
License: LGPL-3.0+
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/>.
.
On Debian systems, the complete text of the GNU Lesser General Public License
Version 3 can be found in `/usr/share/common-licenses/LGPL-3'.

2
debian/libqt5-ukui-style1.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/*/*.so.*
usr/share/glib-2.0/schemas/org.ukui.style.gschema.xml

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
From: cckylin-cibot <cckylin-cibot@kylinos.cn>
Date: Sun, 19 Jun 2022 04:32:20 +0000
Subject: =?utf-8?b?ITgg5L+u5aSNUU1M57yW6K+R6ZSZ6K+v5LiOcW1s5Yqg6L295bSp5rqD?=
=?utf-8?b?55qE6Zeu6aKYIE1lcmdlIHB1bGwgcmVxdWVzdCAhOCBmcm9tIHhpYm93ZW4vb3Bl?=
=?utf-8?b?bmt5bGluL3lhbmd0emU=?=
---
kylin-qqc2-style/qqc2-style-plugin/qqc2-style-plugin.pro | 2 +-
qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/kylin-qqc2-style/qqc2-style-plugin/qqc2-style-plugin.pro b/kylin-qqc2-style/qqc2-style-plugin/qqc2-style-plugin.pro
index 652308a..36fe868 100644
--- a/kylin-qqc2-style/qqc2-style-plugin/qqc2-style-plugin.pro
+++ b/kylin-qqc2-style/qqc2-style-plugin/qqc2-style-plugin.pro
@@ -1,6 +1,6 @@
TEMPLATE = lib
TARGET = qqc2-style-plugin
-QT += KConfigCore Kirigami2 quick
+QT += KConfigCore Kirigami2 quick widgets
CONFIG += plugin c++11 link_pkgconfig
diff --git a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
index 6b8a23b..e19126f 100644
--- a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
+++ b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
@@ -129,10 +129,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
});
}
- // add qqc2 style
- if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) {
- QQuickStyle::setStyle("org.kylin.style");
- }
+// // add qqc2 style
+// 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");
}
Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme()

View File

@ -1,23 +0,0 @@
From: cckylin-cibot <cckylin-cibot@kylinos.cn>
Date: Wed, 22 Jun 2022 11:44:03 +0000
Subject: update changelog.
---
ukui-styles/proxy-style/blur-helper.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ukui-styles/proxy-style/blur-helper.cpp b/ukui-styles/proxy-style/blur-helper.cpp
index 9f3da22..d847bdb 100644
--- a/ukui-styles/proxy-style/blur-helper.cpp
+++ b/ukui-styles/proxy-style/blur-helper.cpp
@@ -110,8 +110,8 @@ bool BlurHelper::eventFilter(QObject *obj, QEvent *e)
void BlurHelper::registerWidget(QWidget *widget)
{
// FIXME: how to blur window on wayland?
- if (!QX11Info::isPlatformX11())
- return;
+ //if (!QX11Info::isPlatformX11())
+ //return;
if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind))
return;

View File

@ -1,241 +0,0 @@
From: cckylin-cibot <cckylin-cibot@kylinos.cn>
Date: Fri, 24 Jun 2022 08:13:30 +0000
Subject: Add a changlog 2022.06.24 3.1.4.1~0509-ok5
---
qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp | 16 ++++++++-
qt5-ukui-platformtheme/widget/message-box.cpp | 39 ++++++++++++++--------
qt5-ukui-platformtheme/widget/message-box.h | 2 +-
ukui-styles/proxy-style/window-manager.cpp | 6 ++++
.../qt5-style-ukui/kabstract-style-parameters.cpp | 2 +-
ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 2 +-
6 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
index e19126f..bebefc4 100644
--- a/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
+++ b/qt5-ukui-platformtheme/qt5-ukui-platform-theme.cpp
@@ -87,7 +87,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
* become very small. I handle the wizard title
* in ProxyStyle::polish().
*/
- QApplication::setFont(m_system_font);
+ //Skip QGuiApplication avoid it crash when we setfont
+ auto *app = qobject_cast<QApplication *>(qApp);
+ if(app != nullptr) {
+ QApplication::setFont(m_system_font);
+ }
connect(settings, &QGSettings::changed, this, [=](const QString &key){
if (key == "iconThemeName") {
@@ -104,6 +108,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
}
if (key == "systemFont") {
+ //Skip QGuiApplication avoid it crash when we setfont
+ auto *app = qobject_cast<QApplication *>(qApp);
+ if(app == nullptr)
+ return;
+
QString font = settings->get("system-font").toString();
QFontDatabase db;
if (db.families().contains(font)) {
@@ -115,6 +124,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
}
}
if (key == "systemFontSize") {
+ //Skip QGuiApplication avoid it crash when we setfont
+ auto *app = qobject_cast<QApplication *>(qApp);
+ if(app == nullptr)
+ return;
+
if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool())
return;
double fontSize = settings->get("system-font-size").toString().toDouble();
diff --git a/qt5-ukui-platformtheme/widget/message-box.cpp b/qt5-ukui-platformtheme/widget/message-box.cpp
index 47e96fb..1ad1253 100644
--- a/qt5-ukui-platformtheme/widget/message-box.cpp
+++ b/qt5-ukui-platformtheme/widget/message-box.cpp
@@ -51,7 +51,7 @@
#include <QGridLayout>
#include <QSpacerItem>
#include <QScrollArea>
-
+#include <QDebug>
enum Button
@@ -114,7 +114,8 @@ public:
QLabel* mIconLabel; // qt 显示图标
QDialogButtonBox* mButtonBox; // qt 按钮框
QPushButton* mDetailButton; // 详细情况按钮
- QPushButton *mCloseButtton;
+ QPushButton* mCloseButtton; //标题栏关闭按钮
+ QLabel* mTitleText; //标题文本
QByteArray mMemberToDisconnectOnClose;
QByteArray mSignalToDisconnectOnClose;
@@ -244,6 +245,7 @@ void MessageBox::addButton(QAbstractButton *button, QMessageBox::ButtonRole role
return;
removeButton(button);
+ d->mOptions->addButton(button->text(), static_cast<QPlatformDialogHelper::ButtonRole>(role), button);
d->mButtonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);
d->mCustomButtonList.append(button);
d->mAutoAddOkButton = false;
@@ -466,11 +468,8 @@ void MessageBox::setDetailedText(const QString &text)
void MessageBox::setWindowTitle(const QString &title)
{
-#ifndef Q_OS_MAC
- QDialog::setWindowTitle(title);
-#else
- Q_UNUSED(title);
-#endif
+ Q_D(MessageBox);
+ d->mTitleText->setText(title);
}
void MessageBox::setWindowModality(Qt::WindowModality windowModality)
@@ -552,8 +551,9 @@ void MessageBox::showEvent(QShowEvent *event)
addButton(QMessageBox::Ok);
}
- if (d->mDetailButton)
+ if (d->mDetailButton) {
addButton(d->mDetailButton, QMessageBox::ActionRole);
+ }
d->detectEscapeButton();
d->updateSize();
@@ -730,10 +730,11 @@ void MessageBoxPrivate::init(const QString &title, const QString &text)
q->close();
});
+ mTitleText = new QLabel(q);
+ mTitleText->setText(title);
+
q->setModal(true);
mIcon = QMessageBox::NoIcon;
-
- Q_UNUSED(title);
}
void MessageBoxPrivate::setupLayout()
@@ -782,10 +783,17 @@ void MessageBoxPrivate::setupLayout()
contentLayout->addWidget(mDetail);
}
+ QHBoxLayout *titleLayout = new QHBoxLayout;
+ titleLayout->setContentsMargins(20,0,4,0);
+ titleLayout->addWidget(mTitleText, Qt::AlignLeft);
+ titleLayout->addWidget(mCloseButtton, Qt::AlignRight);
+
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(4, 4, 4, 4);
layout->setSpacing(4);
- layout->addWidget(mCloseButtton, 0, Qt::AlignRight);
+// layout->addWidget(mCloseButtton, 0, Qt::AlignRight);
+ layout->addLayout(titleLayout);
+ layout->addSpacing(20);
layout->addLayout(contentLayout);
q->setLayout(layout);
@@ -1288,7 +1296,7 @@ void MessageBoxHelper::hide()
bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
- initDialog();
+ initDialog(windowFlags, windowModality, parent);
if (parent) {
if (QWidget *p = mMessageBox->find(parent->winId())) {
@@ -1308,7 +1316,7 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
}
mMessageBox->setuplayout();
- if (parent) {
+ if (parent && !mMessageBox->isVisible()) {
mMessageBox->move(QPoint((parent->width() - mMessageBox->width()) / 2, (parent->height() - mMessageBox->height()) / 2)
+ QPoint(parent->x(), parent->y()));
}
@@ -1338,8 +1346,11 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
return true;
}
-void MessageBoxHelper::initDialog()
+void MessageBoxHelper::initDialog(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
+ if(!mMessageBox->isVisible())
+ mMessageBox->setWindowModality(windowModality);
+
mMessageBox->setIcon((QMessageBox::Icon)options()->icon());
mMessageBox->setText(options()->text());
mMessageBox->setInformativeText(options()->informativeText());
diff --git a/qt5-ukui-platformtheme/widget/message-box.h b/qt5-ukui-platformtheme/widget/message-box.h
index 7bc8b32..bda5d2a 100644
--- a/qt5-ukui-platformtheme/widget/message-box.h
+++ b/qt5-ukui-platformtheme/widget/message-box.h
@@ -153,7 +153,7 @@ Q_SIGNALS:
void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
private:
- void initDialog ();
+ void initDialog (Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
private:
MessageBox* mMessageBox = nullptr;
diff --git a/ukui-styles/proxy-style/window-manager.cpp b/ukui-styles/proxy-style/window-manager.cpp
index 7840342..67e117f 100644
--- a/ukui-styles/proxy-style/window-manager.cpp
+++ b/ukui-styles/proxy-style/window-manager.cpp
@@ -31,6 +31,7 @@
#include <xcb/xcb.h>
#include <QApplication>
+#include <QWindow>
#include <QDebug>
@@ -233,10 +234,15 @@ void WindowManager::mouseMoveEvent(QObject *obj, QMouseEvent *e)
auto widget = qobject_cast<QWidget *>(obj);
auto topLevel = widget->topLevelWidget();
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
+ topLevel->windowHandle()->startSystemMove();
+#else
auto shellSurface = KWayland::Client::ShellSurface::fromWindow(topLevel->windowHandle());
if (!shellSurface)
return;
shellSurface->requestMove(m_seat, m_serial);
+#endif
+
}
return;
diff --git a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp
index ebc2860..4222e52 100644
--- a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp
+++ b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp
@@ -2030,7 +2030,7 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle
endColor = mixColor(ColoseButton, QColor(Qt::black), 0.05);
} else {
startColor = mixColor(ColoseButton, QColor(Qt::white), 0.05);
- endColor = mixColor(ColoseButton, QColor(Qt::black), 0.02);
+ endColor = mixColor(ColoseButton, QColor(Qt::black), 0.2);
}
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
index 74e1dc0..b586c6c 100644
--- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
+++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
@@ -4150,7 +4150,7 @@ QRect Qt5UKUIStyle::subElementRect(SubElement element, const QStyleOption *optio
{
if (qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
const QRect rect = proxy()->subElementRect(SE_TabWidgetTabPane, option, widget);
- int TabWidget_Margin = 4;
+ int TabWidget_Margin = 1;
return rect.adjusted(TabWidget_Margin, TabWidget_Margin, -TabWidget_Margin, -TabWidget_Margin);
}
break;

View File

@ -1,59 +0,0 @@
From: cckylin-cibot <cckylin-cibot@kylinos.cn>
Date: Wed, 13 Jul 2022 10:53:54 +0000
Subject: Add a changlog 2022.07.13 3.1.4.1~0509-ok7
---
libqt5-ukui-style/settings/org.ukui.style.gschema.xml | 4 ++--
ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml
index 82412cc..9ece344 100644
--- a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml
+++ b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml
@@ -68,9 +68,9 @@
</description>
</key>
<key type="s" name="theme-color">
- <default>"default"</default>
+ <default>"daybreakBlue"</default>
<summary> theme color</summary>
- <description>Set theme color for UKUI desktop environment.</description>
+ <description>Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen</description>
</key>
<key type="b" name="cursor-blink">
<default>true</default>
diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
index 292b760..915f55b 100644
--- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
+++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
@@ -3256,10 +3256,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
drawRect = visualRect(menuItem->direction, drawRect, drawRect.adjusted(0, 0, -(indWidth + MenuItem_Spacing), 0));
}
- //set text rect
- MenuItem_HMargin = 4;
- drawRect = drawRect.adjusted(MenuItem_HMargin, 0, -MenuItem_HMargin, 0);
-
+ //text
if (!menuItem->text.isEmpty()) {
QString text = menuItem->text;
painter->save();
@@ -4235,7 +4232,7 @@ QRect Qt5UKUIStyle::subElementRect(SubElement element, const QStyleOption *optio
{
if (qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
const QRect rect = proxy()->subElementRect(SE_TabWidgetTabPane, option, widget);
- int TabWidget_Margin = 1;
+ int TabWidget_Margin = 0;
return rect.adjusted(TabWidget_Margin, TabWidget_Margin, -TabWidget_Margin, -TabWidget_Margin);
}
break;
@@ -4828,7 +4825,7 @@ QSize Qt5UKUIStyle::sizeFromContents(ContentsType ct, const QStyleOption *option
QSize newSize = size;
int indicator = proxy()->pixelMetric(PM_MenuButtonIndicator, option, widget);
int comboBox_Margin = proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget);
- int comboBox_MarginWidth = 8 + 8 + 8 + 4;
+ int comboBox_MarginWidth = 8 + 8 + 8 + 4 + 4;
newSize.setWidth(qMax(newSize.width() + indicator + comboBox_MarginWidth, sp->ComboBox_DefaultWidth));
newSize.setHeight(qMax(newSize.height() + comboBox_Margin * 2, sp->ComboBox_DefaultHeight));
return newSize;

View File

@ -1,91 +0,0 @@
From: xibowen <xibowen@kylinos.cn>
Date: Thu, 14 Jul 2022 17:35:17 +0800
Subject: Add a changlog 2022.07.14 3.1.4.1~0509-ok8
---
ukui-qml-style-helper/ukui-qml-style-helper.pro | 2 +-
ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 45 ++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/ukui-qml-style-helper/ukui-qml-style-helper.pro b/ukui-qml-style-helper/ukui-qml-style-helper.pro
index cb09c9a..05779dc 100644
--- a/ukui-qml-style-helper/ukui-qml-style-helper.pro
+++ b/ukui-qml-style-helper/ukui-qml-style-helper.pro
@@ -1,6 +1,6 @@
TEMPLATE = lib
TARGET = ukui-qml-style-helper
-QT += KConfigCore Kirigami2 quick
+QT += KConfigCore Kirigami2 quick widgets
CONFIG += plugin c++11 link_pkgconfig
diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
index 915f55b..9cface9 100644
--- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
+++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
@@ -88,6 +88,7 @@
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusReply>
+#include <qdrawutil.h>
#define DBUS_STATUS_MANAGER_IF "com.kylin.statusmanager.interface"
@@ -3672,6 +3673,48 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
break;
}
+ case CE_ShapedFrame:
+ if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+ int frameShape = f->frameShape;
+ int frameShadow = QFrame::Plain;
+ if (f->state & QStyle::State_Sunken) {
+ frameShadow = QFrame::Sunken;
+ } else if (f->state & QStyle::State_Raised) {
+ frameShadow = QFrame::Raised;
+ }
+
+ int lw = f->lineWidth;
+ int mlw = f->midLineWidth;
+
+ switch (frameShape) {
+ case QFrame::HLine:
+ case QFrame::VLine: {
+ QPoint p1, p2;
+ if (frameShape == QFrame::HLine) {
+ p1 = QPoint(option->rect.x(), option->rect.y() + option->rect.height() / 2);
+ p2 = QPoint(option->rect.x() + option->rect.width(), p1.y());
+ } else {
+ p1 = QPoint(option->rect.x() + option->rect.width() / 2, option->rect.y());
+ p2 = QPoint(p1.x(), p1.y() + option->rect.height());
+ }
+ if (frameShadow == QFrame::Plain) {
+ QPen oldPen = painter->pen();
+ painter->setPen(QPen(QBrush(f->palette.color(QPalette::Active, QPalette::Window)), lw));
+ painter->drawLine(p1, p2);
+ painter->setPen(oldPen);
+ } else {
+ qDrawShadeLine(painter, p1, p2, f->palette, frameShadow == QFrame::Sunken, lw, mlw);
+ }
+ break;
+ }
+ case QFrame::WinPanel:
+ case QFrame::Panel:
+ case QFrame::StyledPanel:
+ case QFrame::Box:
+ Style::drawControl(element, option, painter, widget);
+ }
+ }
+ break;
default:
return Style::drawControl(element, option, painter, widget);
}
@@ -4821,7 +4864,7 @@ QSize Qt5UKUIStyle::sizeFromContents(ContentsType ct, const QStyleOption *option
case CT_ComboBox:
{
- if (qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
+ if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
QSize newSize = size;
int indicator = proxy()->pixelMetric(PM_MenuButtonIndicator, option, widget);
int comboBox_Margin = proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget);

View File

@ -1,73 +0,0 @@
From: xibowen <xibowen@kylinos.cn>
Date: Fri, 15 Jul 2022 09:53:17 +0000
Subject: =?utf-8?b?ITE0IOS4u+mimOahhuaetlFNZXNzYWdlYm945re75Yqgd2F5bGFuZA==?=
=?utf-8?b?5Y675qCH6aKY5qCP5aSE55CGICogQWRkIGEgY2hhbmdsb2cgMjAyMi4wNy4xNSAz?=
=?utf-8?b?LjEuNC4xfjA1MDktb2s5ICogUU1lc3NhZ2Vib3ggYWRkIGhlYWRlciByZW1vdmUg?=
=?utf-8?b?Zm9yIHdheWxhbmQ=?=
---
qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro | 4 ++--
qt5-ukui-platformtheme/widget/message-box.cpp | 21 ++++++++++++++-------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro b/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro
index 95327d2..504e9b7 100644
--- a/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro
+++ b/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
-QT += widgets dbus gui-private widgets-private x11extras quick quickcontrols2
+QT += widgets dbus gui-private widgets-private x11extras quick quickcontrols2 KWindowSystem
greaterThan(QT_MAJOR_VERSION, 5)|greaterThan(QT_MINOR_VERSION, 7): \
QT += theme_support-private
@@ -15,7 +15,7 @@ TARGET = qt5-ukui-platformtheme
TEMPLATE = lib
CONFIG += plugin
CONFIG += c++11 link_pkgconfig
-PKGCONFIG += gsettings-qt Qt5XdgIconLoader
+PKGCONFIG += gsettings-qt Qt5XdgIconLoader kysdk-waylandhelper
include(../libqt5-ukui-style/libqt5-ukui-style.pri)
diff --git a/qt5-ukui-platformtheme/widget/message-box.cpp b/qt5-ukui-platformtheme/widget/message-box.cpp
index 98ca3f0..134853c 100644
--- a/qt5-ukui-platformtheme/widget/message-box.cpp
+++ b/qt5-ukui-platformtheme/widget/message-box.cpp
@@ -32,6 +32,8 @@
#include <QStyleOption>
#include <qpa/qplatformdialoghelper.h>
#include <QtWidgets/qdialogbuttonbox.h>
+#include "ukuistylehelper/ukuistylehelper.h"
+#include "windowmanager/windowmanager.h"
#include "private/qlabel_p.h"
#include "private/qdialog_p.h"
@@ -1337,13 +1339,18 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
+ QPoint(parent->x(), parent->y()));
}
- //mMessageBox->setWindowModality(windowModality);
-
- MotifWmHints hints;
- hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
- hints.functions = MWM_FUNC_ALL;
- hints.decorations = MWM_DECOR_BORDER;
- XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
+ //remove header
+ QString platform = QGuiApplication::platformName();
+ if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
+ {
+ kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox);
+ } else {
+ MotifWmHints hints;
+ hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
+ hints.functions = MWM_FUNC_ALL;
+ hints.decorations = MWM_DECOR_BORDER;
+ XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
+ }
foreach (QAbstractButton *ab, mMessageBox->buttons()) {
if (QPushButton *pb = qobject_cast<QPushButton *>(ab)) {

View File

@ -1,25 +0,0 @@
From: xibowen <xibowen@kylinos.cn>
Date: Mon, 18 Jul 2022 10:40:44 +0800
Subject: Add a changlog 2022.07.18 3.1.4.1~0509-ok10
---
ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
index 9cface9..73453bf 100644
--- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
+++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp
@@ -287,7 +287,11 @@ QPalette Qt5UKUIStyle::standardPalette() const
bool Qt5UKUIStyle::isUseDarkPalette() const
{
- return (!useDefaultPaletteList().contains(qAppName()) && (m_drak_palette || (m_default_palette && useDarkPaletteList().contains(qAppName()))));
+ bool usedark = (!useDefaultPaletteList().contains(qAppName()) && (m_drak_palette || (m_default_palette && useDarkPaletteList().contains(qAppName()))));
+ if (qAppName() == "kylin-video") {
+ usedark = true;
+ }
+ return usedark;
}

File diff suppressed because it is too large Load Diff

1
debian/qt5-styles-ukui.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/*/qt5/plugins/styles/*.so

3
debian/watch vendored Normal file
View File

@ -0,0 +1,3 @@
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/qt5-ukui-platformtheme-$1\.tar\.gz/ \
https://github.com/ukui/qt5-ukui-platformtheme/releases .*/v?(\d\S+)\.tar\.gz

View File

@ -28,6 +28,7 @@
static const QStringList blackAppList() {
QStringList l;
//l<<"ukui-control-center";
l<<"kylin-software-center.py";
l<<"ubuntu-kylin-software-center.py";
// l<<"kylin-burner";
l<<"assistant";

View File

@ -246,8 +246,8 @@ bool Qt5UKUIPlatformTheme::usePlatformNativeDialog(DialogType type) const
case QPlatformTheme::ColorDialog:
return false;
case QPlatformTheme::MessageDialog:
if (qAppName() == "ukui-control-center")
return false;
// if (qAppName() == "ukui-control-center")
// return false;
return true;
default:
break;

View File

@ -15,7 +15,7 @@ TARGET = qt5-ukui-platformtheme
TEMPLATE = lib
CONFIG += plugin
CONFIG += c++11 link_pkgconfig lrelease
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony
PKGCONFIG += gsettings-qt Qt5XdgIconLoader peony kysdk-waylandhelper
LIBS += -lX11
include(../libqt5-ukui-style/libqt5-ukui-style.pri)

View File

@ -20,7 +20,6 @@ NullDebug & operator <<(const T&){return *this;}
inline NullDebug nullDebug(){return NullDebug();}
#define LOG_TIMI
#ifdef LOG_TIMI

View File

@ -32,6 +32,8 @@
#include <QStyleOption>
#include <qpa/qplatformdialoghelper.h>
#include <QtWidgets/qdialogbuttonbox.h>
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"
#include "private/qlabel_p.h"
#include "private/qdialog_p.h"
@ -1378,11 +1380,17 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
+ QPoint(parent->x(), parent->y()));
}
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
QString platform = QGuiApplication::platformName();
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
{
kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox);
} else {
MotifWmHints hints;
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
hints.functions = MWM_FUNC_ALL;
hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
}
foreach (QAbstractButton *ab, mMessageBox->buttons()) {
if (QPushButton *pb = qobject_cast<QPushButton *>(ab)) {

View File

@ -46,7 +46,7 @@ ProxyStylePlugin::ProxyStylePlugin()
auto settings = UKUIStyleSettings::globalInstance();
connect(settings, &UKUIStyleSettings::changed, this, [=](const QString &key) {
if (key == "styleName" || key == "widgetThemeName" || key == "themeColor") {
if (blackList().contains(qAppName()) || qAppName() == "kylin-software-center.py")
if (blackList().contains(qAppName()))
return;
//We should not swich a application theme which use internal style.
@ -58,7 +58,6 @@ ProxyStylePlugin::ProxyStylePlugin()
return;
auto styleName = settings->get("styleName").toString();
auto themeName = settings->get("widget-theme-name").toString();
if (styleName == "ukui-default" || styleName == "ukui-dark" || styleName == "ukui-white"
|| styleName == "ukui-black" || styleName == "ukui-light" || styleName == "ukui") {
@ -71,15 +70,16 @@ ProxyStylePlugin::ProxyStylePlugin()
styleName = "ukui-light";
if (themeName == "default" || themeName == "classical" || themeName == "fashion") {
qApp->setProperty("widgetThemeName", themeName);
} else {
qApp->setProperty("widgetThemeName", "default");
if (qApp->property("customStyleName").isValid()) {
if (qApp->property("customStyleName").toString() == "ukui-light") {
styleName = "ukui-light";
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
styleName = "ukui-dark";
}
}
// tableModeChanged(false);
qApp->setStyle(new ProxyStyle(styleName));
return;
}
//other style
@ -111,12 +111,6 @@ ProxyStylePlugin::ProxyStylePlugin()
QDBusConnection::sessionBus());
if(interFace->isValid()){
connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(tableModeChanged(bool)));
// {
// auto settings = UKUIStyleSettings::globalInstance();
// auto styleName = settings->get("styleName").toString();
// qApp->setStyle(new ProxyStyle(styleName));
// return;
// });
}
}
@ -126,36 +120,36 @@ QStyle *ProxyStylePlugin::create(const QString &key)
return new QProxyStyle("fusion");
if (key == "ukui") {
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
m_current_style_name = UKUIStyleSettings::globalInstance()->get("styleName").toString();
m_current_theme_name = UKUIStyleSettings::globalInstance()->get("widgetThemeName").toString();
auto styleName = UKUIStyleSettings::globalInstance()->get("styleName").toString();
if (m_current_style_name == "ukui-default" || m_current_style_name == "ukui-dark"
|| m_current_style_name == "ukui-white" || m_current_style_name == "ukui-black"
|| m_current_style_name == "ukui-light" || m_current_style_name == "ukui") {
if (styleName == "ukui-default" || styleName == "ukui-dark"
|| styleName == "ukui-white" || styleName == "ukui-black"
|| styleName == "ukui-light" || styleName == "ukui") {
if (m_current_style_name == "ukui")
m_current_style_name = "ukui-default";
else if (m_current_style_name == "ukui-black")
m_current_style_name = "ukui-dark";
else if (m_current_style_name == "ukui-white")
m_current_style_name = "ukui-light";
if (styleName == "ukui")
styleName = "ukui-default";
else if (styleName == "ukui-black")
styleName = "ukui-dark";
else if (styleName == "ukui-white")
styleName = "ukui-light";
if (m_current_theme_name == "default" ||
m_current_theme_name == "classical" ||
m_current_theme_name == "fashion") {
qApp->setProperty("widgetThemeName", m_current_theme_name);
} else {
qApp->setProperty("widgetThemeName", "default");
if (qApp->property("customStyleName").isValid()) {
if (qApp->property("customStyleName").toString() == "ukui-light") {
styleName = "ukui-light";
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
styleName = "ukui-dark";
}
}
return new ProxyStyle(m_current_style_name);
return new ProxyStyle(styleName);
}
for (auto styleName : QStyleFactory::keys()) {
if (styleName.toLower() == m_current_style_name.toLower())
return new QProxyStyle(m_current_style_name);
if (styleName.toLower() == styleName.toLower())
return new QProxyStyle(styleName);
}
}
return new QProxyStyle("fusion");
}
return new QProxyStyle("fusion");
@ -183,11 +177,36 @@ void ProxyStylePlugin::onSystemPaletteChanged()
void ProxyStylePlugin::tableModeChanged(bool isTableMode)
{
if (blackList().contains(qAppName()))
return;
//We should not swich a application theme which use internal style.
if (QApplication::style()->inherits("InternalStyle"))
return;
auto appStyleSettings = ApplicationStyleSettings::getInstance();
if (appStyleSettings->currentStyleStretagy() != ApplicationStyleSettings::Default)
return;
auto settings = UKUIStyleSettings::globalInstance();
auto styleName = settings->get("styleName").toString();
qApp->setProperty("isInitial", false);
qApp->setStyle(new ProxyStyle(styleName));
/*
if (styleName == "ukui-default" || styleName == "ukui-dark" || styleName == "ukui-white"
|| styleName == "ukui-black" || styleName == "ukui-light" || styleName == "ukui")
{
if (qApp->property("customStyleName").isValid()) {
if (qApp->property("customStyleName").toString() == "ukui-light") {
styleName = "ukui-light";
} else if (qApp->property("customStyleName").toString() == "ukui-dark") {
styleName = "ukui-dark";
}
}
qApp->setProperty("isInitial", false);
qApp->setStyle(new ProxyStyle(styleName));
}
/*
foreach (QObject *obj, qApp->children()) {
if(qobject_cast<const QVBoxLayout*>(obj))//obj->inherits("QVBoxLayout"))
{

View File

@ -47,8 +47,7 @@ public slots:
void tableModeChanged(bool isTableMode);
private:
QString m_current_style_name;
QString m_current_theme_name;
};
}

View File

@ -105,6 +105,7 @@ KAbstractStyleParameters::KAbstractStyleParameters(QObject *parent, bool isDark)
LineEdit_DefaultWidth = LineEdit_DefaultWidth * m_ScaleLineEditDefaultLength;
TabBar_DefaultHeight = TabBar_DefaultHeight * m_scaleTabBarHeight6_5;
ViewItem_DefaultHeight = ViewItem_DefaultHeight * m_scaleRatio4_3;
ToolTip_Height = ToolTip_Height * m_scaleRatio4_3;
}
QPalette KAbstractStyleParameters::setPalette(QPalette &palette)
@ -292,9 +293,9 @@ void KDefaultStyleParameters::initPalette(bool isDark)
button_at.setRgb(55, 55, 59);
button_iat.setRgb(55, 55, 59);
button_dis.setRgb(46, 46, 46);
light_at.setRgb(255, 255, 255),
light_iat.setRgb(255, 255, 255),
light_dis.setRgb(242, 242, 242),
light_at.setRgb(255, 255, 255);
light_iat.setRgb(255, 255, 255);
light_dis.setRgb(242, 242, 242);
midlight_at.setRgb(95, 95, 98);
midlight_iat.setRgb(95, 95, 98);
midlight_dis.setRgb(79, 79, 82);
@ -319,9 +320,9 @@ void KDefaultStyleParameters::initPalette(bool isDark)
window_at.setRgb(35, 36, 38);
window_iat.setRgb(26, 26, 26);
window_dis.setRgb(18, 18, 18);
shadow_at.setRgb(0, 0, 0, 255 * 0.16),
shadow_iat.setRgb(0, 0, 0, 255 * 0.16),
shadow_dis.setRgb(0, 0, 0, 255 * 0.21),
shadow_at.setRgb(0, 0, 0, 255 * 0.16);
shadow_iat.setRgb(0, 0, 0, 255 * 0.16);
shadow_dis.setRgb(0, 0, 0, 255 * 0.21);
// shadow_at.setRgb(214, 214, 214);
// shadow_iat.setRgb(214, 214, 214);
// shadow_dis.setRgb(201, 201, 201);
@ -733,7 +734,7 @@ void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -996,7 +997,7 @@ void KDefaultStyleParameters::initListParameters(bool isDark, const QStyleOption
QPen textHoverPen = QPen(Qt::NoPen);
QPen textSelectPen = QPen(Qt::NoPen);
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -1139,7 +1140,7 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
QBrush onClickBrush;
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -1147,10 +1148,11 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//default
if (isDark) {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
col.setAlphaF(0.15);
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
} else {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText),
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
}
defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200));
@ -1202,7 +1204,7 @@ void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//disable
disablePen = defaultPen;
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
//on default
onDefaultPen = QPen(Qt::NoPen);
@ -1286,10 +1288,11 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//default
if (isDark) {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
col.setAlphaF(0.15);
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
} else {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText),
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
}
defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200));
@ -1312,7 +1315,7 @@ void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//disable
disablePen = defaultPen;
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
//on default
onDefaultPen = QPen(Qt::NoPen);
@ -1421,7 +1424,7 @@ void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -1446,10 +1449,14 @@ void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
//groove value default
grooveValueDefaultBrush = QBrush(highlight);
if (isDark) {
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2));
}
//groove value hover
grooveValueHoverBrush = QBrush(highlight);
grooveValueHoverBrush = grooveValueDefaultBrush;
//groove value disable
grooveValueDisableBrush = handleDisableBrush;
@ -1492,7 +1499,7 @@ void KDefaultStyleParameters::initProgressBarParameters(bool isDark, const QStyl
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -1559,7 +1566,7 @@ void KDefaultStyleParameters::initScrollBarParameters(bool isDark, const QStyleO
QBrush sliderDisableBrush;
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -2133,9 +2140,9 @@ void KFashionStyleParameters::initPalette(bool isDark)
button_at.setRgb(55, 55, 59);
button_iat.setRgb(55, 55, 59);
button_dis.setRgb(46, 46, 46);
light_at.setRgb(255, 255, 255),
light_iat.setRgb(255, 255, 255),
light_dis.setRgb(242, 242, 242),
light_at.setRgb(255, 255, 255);
light_iat.setRgb(255, 255, 255);
light_dis.setRgb(242, 242, 242);
midlight_at.setRgb(95, 95, 98);
midlight_iat.setRgb(95, 95, 98);
midlight_dis.setRgb(79, 79, 82);
@ -2160,9 +2167,9 @@ void KFashionStyleParameters::initPalette(bool isDark)
window_at.setRgb(35, 36, 38);
window_iat.setRgb(26, 26, 26);
window_dis.setRgb(18, 18, 18);
shadow_at.setRgb(0, 0, 0, 255 * 0.16),
shadow_iat.setRgb(0, 0, 0, 255 * 0.16),
shadow_dis.setRgb(0, 0, 0, 255 * 0.21),
shadow_at.setRgb(0, 0, 0, 255 * 0.16);
shadow_iat.setRgb(0, 0, 0, 255 * 0.16);
shadow_dis.setRgb(0, 0, 0, 255 * 0.21);
// shadow_at.setRgb(214, 214, 214);
// shadow_iat.setRgb(214, 214, 214);
// shadow_dis.setRgb(201, 201, 201);
@ -2658,7 +2665,7 @@ void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOp
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -2740,9 +2747,11 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
QBrush upHoverBrush;
QBrush upFocusHoverBrush;
QBrush upClickBrush;
QBrush upDefaultBrush;
QBrush downHoverBrush;
QBrush downFocusHoverBrush;
QBrush downClickBrush;
QBrush downDefaultBrush;
//default state
defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
@ -2752,6 +2761,8 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
//hover state
hoverBrush = defaultBrush;
hoverPen = defaultPen;
if(isHorizonLayout)
hoverPen.setWidth(2);
//focus state
focusBrush = option->palette.brush(QPalette::Active, QPalette::Base);
@ -2763,6 +2774,16 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
disablePen = QPen(Qt::NoPen);
disablePen.setWidth(0);
if(isHorizonLayout)
{
upDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
downDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button);
}
else
{
upDefaultBrush = QBrush(Qt::NoBrush);
downDefaultBrush = QBrush(Qt::NoBrush);
}
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
QColor button = option->palette.color(QPalette::Active, QPalette::Button);
@ -2843,12 +2864,14 @@ void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt
spinBoxParameters.spinBoxFocusPen = focusPen;
spinBoxParameters.spinBoxDisablePen = disablePen;
spinBoxParameters.spinBoxUpDefaultBrush = upDefaultBrush;
spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush;
spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush;
spinBoxParameters.spinBoxUpClickBrush = upClickBrush;
spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush;
spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush;
spinBoxParameters.spinBoxDownClickBrush = downClickBrush;
spinBoxParameters.spinBoxDownDefaultBrush = downDefaultBrush;
}
void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
@ -2928,7 +2951,7 @@ void KFashionStyleParameters::initListParameters(bool isDark, const QStyleOption
QPen textHoverPen = QPen(Qt::NoPen);
QPen textSelectPen = QPen(Qt::NoPen);
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -3128,7 +3151,7 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
QBrush onClickBrush;
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -3136,8 +3159,9 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//default
if (isDark) {
defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
col.setAlphaF(0.15);
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
} else {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
@ -3202,7 +3226,7 @@ void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOp
//disable
disablePen = defaultPen;
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
//on default
onDefaultPen = QPen(Qt::NoPen);
@ -3292,8 +3316,9 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//default
if (isDark) {
defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QColor col = option->palette.color(QPalette::Active, QPalette::BrightText);
col.setAlphaF(0.15);
defaultPen = QPen(col, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
} else {
defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText),
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
@ -3318,7 +3343,7 @@ void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyl
//disable
disablePen = defaultPen;
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button);
//on default
onDefaultPen = QPen(Qt::NoPen);
@ -3424,7 +3449,7 @@ void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -3466,10 +3491,14 @@ void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOpti
handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
//groove value default
grooveValueDefaultBrush = QBrush(highlight);
if (isDark) {
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05));
} else {
grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2));
}
//groove value hover
grooveValueHoverBrush = QBrush(highlight);
grooveValueHoverBrush = grooveValueDefaultBrush;
//groove value disable
grooveValueDisableBrush = handleDisableBrush;
@ -3512,7 +3541,7 @@ void KFashionStyleParameters::initProgressBarParameters(bool isDark, const QStyl
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}
@ -3580,7 +3609,7 @@ void KFashionStyleParameters::initScrollBarParameters(bool isDark, const QStyleO
bool needTranslucent = false;
if (widget->property("needTranslucent").isValid()) {
if (widget && widget->property("needTranslucent").isValid()) {
needTranslucent = widget->property("needTranslucent").toBool();
}

View File

@ -141,6 +141,7 @@ public:
// tooltip
int ToolTip_DefaultMargin = 8;
int ToolTip_Height = 36;
//viewItem
int ViewItem_DefaultHeight = 36;

View File

@ -74,12 +74,7 @@ QStyle *Qt5UKUIStylePlugin::create(const QString &key)
useDefault = true;
}
if (qApp->property("widgetThemeName").isValid()) {
type = qApp->property("widgetThemeName").toString();
}
return new Qt5UKUIStyle(dark, useDefault, type);
return new Qt5UKUIStyle(dark, useDefault);
}
const QStringList Qt5UKUIStylePlugin::blackList()

View File

@ -102,14 +102,17 @@ static QWindow *qt_getWindow(const QWidget *widget)
}
#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0))
Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QFusionStyle()
Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault) : QFusionStyle()
#else
Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxyStyle("fusion")
#endif
{
m_default_palette = useDefault;
m_drak_palette = dark;
m_type = type;
if (auto settings = UKUIStyleSettings::globalInstance()) {
m_widget_theme = settings->get("widgetThemeName").toString();
}
m_tab_animation_helper = new TabWidgetAnimationHelper(this);
m_scrollbar_animation_helper = new ScrollBarAnimationHelper(this);
@ -132,11 +135,11 @@ Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxySty
}
}
if (m_type == "default") {
if (m_widget_theme == "default") {
sp = new KDefaultStyleParameters(this, isUseDarkPalette());
} else if (m_type == "classical") {
} else if (m_widget_theme == "classical") {
sp = new KClassicalStyleParameters(this, isUseDarkPalette());
} else if (m_type == "fashion"){
} else if (m_widget_theme == "fashion"){
sp = new KFashionStyleParameters(this, isUseDarkPalette());
} else {
sp = new KDefaultStyleParameters(this, isUseDarkPalette());
@ -191,6 +194,13 @@ bool Qt5UKUIStyle::eventFilter(QObject *obj, QEvent *e)
// }
// return false;
// }
if (obj != nullptr && obj->inherits("QTipLabel"))
{
auto label = qobject_cast<QLabel *>(obj);
if(label != nullptr && !(label->alignment() & Qt::AlignVCenter)){
label->setAlignment(Qt::AlignVCenter);
}
}
if (qobject_cast<QSlider *>(obj)) {
if (e->type() == QEvent::Wheel) {
@ -496,6 +506,15 @@ void Qt5UKUIStyle::polish(QWidget *widget)
auto label = qobject_cast<QLabel *>(widget);
label->setWordWrap(true);
label->setScaledContents(true);
if(sp->m_isTableMode){
QFontMetrics fm = label->fontMetrics();
int textHeight = fm.height();
if(textHeight < sp->ToolTip_Height)
{
//PE_PanelTipLabel rec adjusted 8
label->setMinimumHeight(sp->ToolTip_Height + 8);
}
}
}
if (qobject_cast<QMessageBox *>(widget)) {
@ -645,51 +664,64 @@ QPixmap Qt5UKUIStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &p
QStyleOption tmp = *option;
tmp.state = State_Enabled;
QPixmap target = HighLightEffect::ordinaryGeneratePixmap(pixmap, &tmp);
QImage im = target.toImage().convertToFormat(QImage::Format_ARGB32);
// Create a colortable based on the background (black -> bg -> white)
QColor bg = option->palette.color(QPalette::Disabled, QPalette::Window);
int red = bg.red();
int green = bg.green();
int blue = bg.blue();
uchar reds[256], greens[256], blues[256];
for (int i=0; i<128; ++i) {
reds[i] = uchar((red * (i<<1)) >> 8);
greens[i] = uchar((green * (i<<1)) >> 8);
blues[i] = uchar((blue * (i<<1)) >> 8);
}
for (int i=0; i<128; ++i) {
reds[i+128] = uchar(qMin(red + (i << 1), 255));
greens[i+128] = uchar(qMin(green + (i << 1), 255));
blues[i+128] = uchar(qMin(blue + (i << 1), 255));
}
// //Fix me:QT original code
// QImage im = target.toImage().convertToFormat(QImage::Format_ARGB32);
int intensity = qt_intensity(red, green, blue);
const int factor = 191;
// // Create a colortable based on the background (black -> bg -> white)
// QColor bg = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
// int red = bg.red();
// int green = bg.green();
// int blue = bg.blue();
// uchar reds[256], greens[256], blues[256];
// for (int i=0; i<128; ++i) {
// reds[i] = uchar((red * (i<<1)) >> 8);
// greens[i] = uchar((green * (i<<1)) >> 8);
// blues[i] = uchar((blue * (i<<1)) >> 8);
// }
// for (int i=0; i<128; ++i) {
// reds[i+128] = uchar(qMin(red + (i << 1), 255));
// greens[i+128] = uchar(qMin(green + (i << 1), 255));
// blues[i+128] = uchar(qMin(blue + (i << 1), 255));
// }
// High intensity colors needs dark shifting in the color table, while
// low intensity colors needs light shifting. This is to increase the
// perceived contrast.
if ((red - factor > green && red - factor > blue)
|| (green - factor > red && green - factor > blue)
|| (blue - factor > red && blue - factor > green))
intensity = qMin(255, intensity + 91);
// else if (intensity <= 128)
// intensity -= 51;
// int intensity = qt_intensity(red, green, blue);
// const int factor = 191;
for (int y=0; y<im.height(); ++y) {
QRgb *scanLine = (QRgb*)im.scanLine(y);
for (int x=0; x<im.width(); ++x) {
QRgb pixel = *scanLine;
// Calculate color table index, taking intensity adjustment
// and a magic offset into account.
uint ci = uint(qGray(pixel)/3 + (130 - intensity / 3));
*scanLine = qRgba(reds[ci], greens[ci], blues[ci], qAlpha(pixel));
++scanLine;
}
}
// // High intensity colors needs dark shifting in the color table, while
// // low intensity colors needs light shifting. This is to increase the
// // perceived contrast.
// if ((red - factor > green && red - factor > blue)
// || (green - factor > red && green - factor > blue)
// || (blue - factor > red && blue - factor > green))
// intensity = qMin(255, intensity + 91);
//// else if (intensity <= 128)
//// intensity -= 51;
return QPixmap::fromImage(im);
// for (int y=0; y<im.height(); ++y) {
// QRgb *scanLine = (QRgb*)im.scanLine(y);
// for (int x=0; x<im.width(); ++x) {
// QRgb pixel = *scanLine;
// // Calculate color table index, taking intensity adjustment
// // and a magic offset into account.
// uint ci = uint(qGray(pixel)/3 + (130 - intensity / 3));
// *scanLine = qRgba(reds[ci], greens[ci], blues[ci], qAlpha(pixel));
// ++scanLine;
// }
// }
// return QPixmap::fromImage(im);
//set same color to text when set icon mode disable
QColor bg = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
QPainter p(&target);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
p.fillRect(target.rect(), bg);
p.end();
return target;
}
default:
@ -1300,6 +1332,17 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
case PE_IndicatorArrowUp:
{
QIcon icon = QIcon::fromTheme("ukui-up-symbolic");
if(sp->m_isTableMode){
if(qobject_cast<const QSpinBox *>(widget))
{
icon = QIcon::fromTheme("list-add-symbolic");
}
else if(qobject_cast<const QDoubleSpinBox *>(widget))
{
icon = QIcon::fromTheme("list-add-symbolic");
}
}
if(!icon.isNull()) {
int indWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
int indHight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
@ -1309,7 +1352,9 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
const bool enable(option->state & State_Enabled);
QIcon::Mode mode = enable ? QIcon::Normal : QIcon::Disabled;
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
QPixmap target = pixmap;
if(!sp->m_isTableMode)
target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
@ -1322,6 +1367,17 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
case PE_IndicatorArrowDown:
{
QIcon icon = QIcon::fromTheme("ukui-down-symbolic");
if(sp->m_isTableMode){
if(qobject_cast<const QSpinBox *>(widget))
{
icon = QIcon::fromTheme("list-remove-symbolic");
}
else if(qobject_cast<const QDoubleSpinBox *>(widget))
{
icon = QIcon::fromTheme("list-remove-symbolic");
}
}
if(!icon.isNull()) {
int indWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
int indHight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
@ -1331,7 +1387,9 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
const bool enable(option->state & State_Enabled);
QIcon::Mode mode = enable ? QIcon::Normal : QIcon::Disabled;
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
QPixmap target = pixmap;
if(!sp->m_isTableMode)
target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter->drawPixmap(drawRect, target);
@ -1388,8 +1446,9 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
case PE_IndicatorRadioButton:
{
if (const QStyleOptionButton* radiobutton = qstyleoption_cast<const QStyleOptionButton*>(option)) {
QRectF rect = radiobutton->rect.adjusted(1, 1, -1, -1);
sp->initRadioButtonParameters(isUseDarkPalette(), option, widget);
QRectF rect = radiobutton->rect.adjusted(1, 1, -1, -1);
bool enable = radiobutton->state & State_Enabled;
bool mouseOver = radiobutton->state & State_MouseOver;
bool sunKen = radiobutton->state & State_Sunken;
@ -1411,7 +1470,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
}
painter->drawEllipse(rect);
QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 2, (rect.height() / 2) - 2);
QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 1, (rect.height() / 2) - 1);
childRect.moveCenter(rect.center());
painter->setPen(Qt::NoPen);
painter->setBrush(radiobutton->palette.brush(QPalette::Active, QPalette::HighlightedText));
@ -1435,8 +1494,9 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
painter->drawEllipse(rect);
if (on) {
QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 2, (rect.height() / 2) - 2);
QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 1, (rect.height() / 2) - 1);
childRect.moveCenter(rect.center());
painter->setPen(Qt::NoPen);
painter->setBrush(radiobutton->palette.brush(QPalette::Disabled, QPalette::ButtonText));
painter->drawEllipse(childRect);
}
@ -1527,10 +1587,10 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
if (on | noChange) {
if (on) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 1.5,
painter->setPen(QPen(checkbox->palette.brush(QPalette::Disabled, QPalette::ButtonText), 1.5,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
} else if (noChange) {
painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 2,
painter->setPen(QPen(checkbox->palette.brush(QPalette::Disabled, QPalette::ButtonText), 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
painter->setBrush(Qt::NoBrush);
@ -2163,6 +2223,7 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(Qt::NoBrush);
painter->setRenderHint(QPainter::Antialiasing, true);
int lineWidth = hasBorder ? 2 : 0;
int radius= sp->spinBoxParameters.radius;
if (sb->subControls & (SC_SpinBoxUp | SC_SpinBoxDown)) {
@ -2651,6 +2712,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
state = QIcon::On;
}
pixmap = button->icon.pixmap(button->iconSize, mode, state);
pixmap = proxy()->generatedIconPixmap(mode, pixmap, button);
}
QFontMetrics fm = button->fontMetrics;
@ -2695,16 +2757,16 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
if (textRect.isValid()) {
if (enable) {
if ((isWindowButton || useButtonPalette) && (button->state & State_Sunken)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
}
else if ((isWindowButton || useButtonPalette) && (button->state & State_MouseOver)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::BrightText);
}
else if ((isWindowButton || useButtonPalette) && !(button->state & State_On)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
} else {
if (isImportant) {
if (isWindowButton || useButtonPalette) {
if (button->state & State_On) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::HighlightedText);
}
else if (button->state & State_MouseOver) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::BrightText);
} else {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
}
} else if (isImportant) {
if (button->features & QStyleOptionButton::Flat) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
} else {
@ -2713,12 +2775,11 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
if (button->state & (State_MouseOver | State_Sunken | State_On)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::HighlightedText);
}
} else {
if (button->state & (State_MouseOver | State_Sunken | State_On)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::HighlightedText);
} else {
if (button->state & (State_MouseOver | State_Sunken | State_On)) {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::HighlightedText);
} else {
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
}
proxy()->drawItemText(painter, textRect, tf, button->palette, true, button->text, QPalette::ButtonText);
}
}
} else {
@ -2799,6 +2860,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
else
mode = QIcon::Normal;
pixmap = tb->icon.pixmap(tb->iconSize, mode, state);
pixmap = proxy()->generatedIconPixmap(mode, pixmap, tb);
}
if (tb->toolButtonStyle == Qt::ToolButtonTextOnly && text) {
@ -2841,18 +2903,25 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
}
if (textRect.isValid()) {
if ((isWindowButton || useButtonPalette) && (tb->state & State_Sunken) && enable) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::ButtonText);
}
else if ((isWindowButton || useButtonPalette) && (tb->state & State_MouseOver) && enable) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::BrightText);
}
else
{
proxy()->drawItemText(painter, textRect, alignment, tb->palette, enable, tb->text,
((isWindowButton || useButtonPalette) && !(option->state & State_On)) ? QPalette::ButtonText
: (option->state & (State_On | State_Sunken | State_MouseOver) && (option->state & State_Enabled))
? QPalette::HighlightedText : QPalette::ButtonText);
if (enable) {
if (isWindowButton || useButtonPalette) {
if (tb->state & State_On) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::HighlightedText);
}
else if (tb->state & State_MouseOver) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::BrightText);
} else {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::ButtonText);
}
} else {
if (tb->state & (State_MouseOver | State_Sunken | State_On)) {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::HighlightedText);
} else {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, true, tb->text, QPalette::ButtonText);
}
}
} else {
proxy()->drawItemText(painter, textRect, alignment, tb->palette, false, tb->text, QPalette::ButtonText);
}
}
if (iconRect.isValid()) {
@ -3163,7 +3232,6 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
case CE_RadioButton:
{
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
sp->initRadioButtonParameters(isUseDarkPalette(), option, widget);
QStyleOptionButton subopt = *button;
subopt.rect = proxy()->subElementRect(SE_RadioButtonIndicator, option, widget);
proxy()->drawPrimitive(PE_IndicatorRadioButton, &subopt, painter, widget);
@ -3725,8 +3793,9 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
painter->setPen(header->palette.color(QPalette::Active, QPalette::Midlight));
painter->setBrush(Qt::NoBrush);
if (header->orientation == Qt::Horizontal) {
int iconSize = proxy()->pixelMetric(PM_SmallIconSize);
int dis = (header->rect.height() - iconSize) / 2;
// int iconSize = proxy()->pixelMetric(PM_SmallIconSize);
// int dis = (header->rect.height() - iconSize) / 2 - 1;
int dis = (header->rect.height() / 2) / 2;
if (header->position != QStyleOptionHeader::End && header->position != QStyleOptionHeader::OnlyOneSection) {
if (header->direction == Qt::LeftToRight) {
painter->drawLine(header->rect.right(), header->rect.top() + dis, header->rect.right(), header->rect.bottom() - dis);

View File

@ -59,7 +59,7 @@ class Qt5UKUIStyle : public Style
{
Q_OBJECT
public:
explicit Qt5UKUIStyle(bool dark = false, bool useDefault = true, QString type = "fashion");
explicit Qt5UKUIStyle(bool dark = false, bool useDefault = true);
bool shouldBeTransparent(const QWidget *w) const;
@ -133,7 +133,7 @@ private:
bool m_drak_palette = false;
bool m_default_palette = false;
QString m_type = "fashion";
QString m_widget_theme = "default";
bool m_is_tablet_mode = false;
QDBusInterface *m_statusManagerDBus = nullptr;