547 lines
22 KiB
Diff
547 lines
22 KiB
Diff
diff -Naur kylin-calculator-1.0.26/debian/changelog kylin-calculator-1.0.26~/debian/changelog
|
|
--- kylin-calculator-1.0.26/debian/changelog 2021-11-26 23:21:16.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/debian/changelog 2021-12-08 11:44:56.408072555 +0800
|
|
@@ -1,3 +1,12 @@
|
|
+kylin-calculator (1.0.27kord) v101; urgency=medium
|
|
+
|
|
+ * 解决禅道bug #31985 【麒麟计算器】科学计算模式下点击Rad后按钮变白
|
|
+ * 解决禅道bug #32052 【麒麟计算器】汇率计算器界面显示异常
|
|
+ * 解决禅道bug #32764 【麒麟计算器】深色模式下,汇率更新按钮显示不清晰
|
|
+ * 解决禅道bug #32767 【麒麟计算器】货币子窗口不跟随主题颜色变色
|
|
+
|
|
+ -- caoliang <caoliang@kylinos.cn> Tue, 12 Jan 2021 10:08:50 +0800
|
|
+
|
|
kylin-calculator (1.0.26kord) v101; urgency=medium
|
|
|
|
* 修复翻译导致的切换bug
|
|
diff -Naur kylin-calculator-1.0.26/kylin-calculator.desktop kylin-calculator-1.0.26~/kylin-calculator.desktop
|
|
--- kylin-calculator-1.0.26/kylin-calculator.desktop 2021-11-26 23:21:16.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/kylin-calculator.desktop 2021-12-08 11:44:56.378072093 +0800
|
|
@@ -6,4 +6,4 @@
|
|
Exec=/usr/bin/kylin-calculator %u
|
|
Icon=accessories-calculator
|
|
Type=Application
|
|
-Categories=Utility;Calculator;
|
|
+Categories=Utility;Calculator;System;
|
|
diff -Naur kylin-calculator-1.0.26/kylin-calculator.pro kylin-calculator-1.0.26~/kylin-calculator.pro
|
|
--- kylin-calculator-1.0.26/kylin-calculator.pro 2021-11-26 23:21:16.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/kylin-calculator.pro 2021-12-08 11:44:56.375072047 +0800
|
|
@@ -31,7 +31,7 @@
|
|
|
|
TARGET = kylin-calculator
|
|
|
|
-VERSION = 1.0.25
|
|
+VERSION = 1.0.26
|
|
|
|
target.path = /usr/bin
|
|
target.source += $$TARGET
|
|
@@ -105,6 +105,7 @@
|
|
$$PWD/src/basicbutton.h \
|
|
$$PWD/src/cal.h \
|
|
$$PWD/src/menumodule.h \
|
|
+ $$PWD/src/highlight-effect.h \
|
|
$$PWD/src/daemonipcdbus.h \
|
|
$$PWD/src/xatom-helper.h
|
|
|
|
diff -Naur kylin-calculator-1.0.26/README.md kylin-calculator-1.0.26~/README.md
|
|
--- kylin-calculator-1.0.26/README.md 2021-11-26 23:21:16.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/README.md 2021-12-08 11:44:56.381072139 +0800
|
|
@@ -8,6 +8,9 @@
|
|
|
|
### 更新历史
|
|
|
|
+#### 20200112 10:08 cl
|
|
+1.0.27
|
|
+
|
|
#### 20200109 09:02 jdy
|
|
1.0.26
|
|
|
|
diff -Naur kylin-calculator-1.0.26/src/highlight-effect.h kylin-calculator-1.0.26~/src/highlight-effect.h
|
|
--- kylin-calculator-1.0.26/src/highlight-effect.h 1970-01-01 08:00:00.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/highlight-effect.h 2021-12-08 11:44:56.954080956 +0800
|
|
@@ -0,0 +1,87 @@
|
|
+/*
|
|
+ * Qt5-UKUI's Library
|
|
+ *
|
|
+ * Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
|
+ *
|
|
+ * This library is free software; you can redistribute it and/or
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
+ * License as published by the Free Software Foundation; either
|
|
+ * version 3 of the License, or (at your option) any later version.
|
|
+ *
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
+ * Lesser General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU General Public License
|
|
+ * along with this library. If not, see <https://www.gnu.org/licenses/>.
|
|
+ *
|
|
+ * Authors: Yue Lan <lanyue@kylinos.cn>
|
|
+ *
|
|
+ */
|
|
+
|
|
+#ifndef HIGHLIGHTEFFECT_H
|
|
+#define HIGHLIGHTEFFECT_H
|
|
+
|
|
+#include <QObject>
|
|
+#include <QStyleOption>
|
|
+
|
|
+class QAbstractItemView;
|
|
+class QAbstractButton;
|
|
+class QMenu;
|
|
+
|
|
+class HighLightEffect : public QObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ enum HighLightMode {
|
|
+ skipHighlight = 0x0,
|
|
+ HighlightEffect = 0x1,
|
|
+ ordinaryHighLight = 0x2,
|
|
+ hoverHighLight = 0x4,
|
|
+ defaultHighLight = 0x8,
|
|
+ filledSymbolicColorHighLight = 0x10,
|
|
+ };
|
|
+
|
|
+ enum EffectMode {
|
|
+ HighlightOnly,
|
|
+ BothDefaultAndHighlit
|
|
+ };
|
|
+ Q_ENUM(EffectMode)
|
|
+
|
|
+ /*!
|
|
+ * \brief setSkipEffect
|
|
+ * \param w
|
|
+ * \param skip
|
|
+ * \details
|
|
+ * in ukui-style, some widget such as menu will be set use highlight
|
|
+ * icon effect automaticlly,
|
|
+ * but we might not want to compose a special pure color image.
|
|
+ * This function is use to skip the effect.
|
|
+ */
|
|
+ static void setSkipEffect(QWidget *w, bool skip = true);
|
|
+ static bool isPixmapPureColor(const QPixmap &pixmap);
|
|
+ static bool setMenuIconHighlightEffect(QMenu *menu, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly);
|
|
+ static bool setViewItemIconHighlightEffect(QAbstractItemView *view, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly);
|
|
+ static bool setButtonIconHighlightEffect(QAbstractButton *button, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly);
|
|
+ static HighLightMode isWidgetIconUseHighlightEffect(const QWidget *w);
|
|
+
|
|
+ static void setSymoblicColor(const QColor &color);
|
|
+ static void setWidgetIconFillSymbolicColor(QWidget *widget, bool fill);
|
|
+
|
|
+ static const QColor getCurrentSymbolicColor();
|
|
+ static const QColor defaultStyleDark();
|
|
+
|
|
+ static QPixmap generatePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, bool force = false, EffectMode mode = HighlightOnly);
|
|
+ static QPixmap ordinaryGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly);
|
|
+ static QPixmap hoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr);
|
|
+ static QPixmap bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly);
|
|
+ static QPixmap filledSymbolicColoredGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly);
|
|
+
|
|
+private:
|
|
+ explicit HighLightEffect(QObject *parent = nullptr);
|
|
+
|
|
+ static QPixmap filledSymbolicColoredPixmap(const QPixmap &source, const QColor &baseColor);
|
|
+};
|
|
+
|
|
+#endif // HIGHLIGHTEFFECT_H
|
|
diff -Naur kylin-calculator-1.0.26/src/mainwindow.cpp kylin-calculator-1.0.26~/src/mainwindow.cpp
|
|
--- kylin-calculator-1.0.26/src/mainwindow.cpp 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/mainwindow.cpp 2021-12-08 11:44:56.961081064 +0800
|
|
@@ -189,8 +189,8 @@
|
|
QVBoxLayout *pLayout = new QVBoxLayout();
|
|
pLayout->addWidget(pTitleBar);
|
|
// pLayout->addStretch();
|
|
- // pLayout->setSpacing(0);
|
|
- // pLayout->setMargin(0);
|
|
+ pLayout->setSpacing(0);
|
|
+ pLayout->setMargin(0);
|
|
titleBarWid->setLayout(pLayout);
|
|
titleBarWid->setFixedHeight(TITLEH);
|
|
|
|
@@ -730,6 +730,8 @@
|
|
else if (label.contains(tr("exchange rate"))) {
|
|
toolModelButton->setWidgetStyle();
|
|
toolModelOutput->setWidgetStyle();
|
|
+ toolModelOutput->unitListBef->setWidgetStyle();
|
|
+ toolModelOutput->unitListAft->setWidgetStyle();
|
|
}
|
|
}
|
|
|
|
diff -Naur kylin-calculator-1.0.26/src/menumodule.cpp kylin-calculator-1.0.26~/src/menumodule.cpp
|
|
--- kylin-calculator-1.0.26/src/menumodule.cpp 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/menumodule.cpp 2021-12-08 11:44:56.969081187 +0800
|
|
@@ -30,8 +30,11 @@
|
|
|
|
void menuModule::initAction(){
|
|
iconSize = QSize(30,30);
|
|
- menuButton = new QPushButton;
|
|
- menuButton->setIcon(QIcon::fromTheme("application-menu"));
|
|
+ menuButton = new QPushButton(this);
|
|
+ // menuButton->setIcon(QIcon::fromTheme("application-menu"));
|
|
+ menuButton->setProperty("isWindowButton", 0x1);
|
|
+ menuButton->setProperty("useIconHighlightEffect", 0x2);
|
|
+ menuButton->setFlat(true);
|
|
menuButton->setFixedSize(iconSize);
|
|
m_menu = new QMenu();
|
|
QList<QAction *> actions ;
|
|
@@ -296,6 +299,8 @@
|
|
}
|
|
|
|
void menuModule::setStyle(){
|
|
+ menuButton->setObjectName("menuButton");
|
|
+ qDebug() << "menuButton->styleSheet" << menuButton->styleSheet();
|
|
menuButton->setStyleSheet("QPushButton::menu-indicator{image:None;}");
|
|
}
|
|
|
|
@@ -329,6 +334,7 @@
|
|
aboutWindow->setStyleSheet("background-color:rgba(31,32,34,1);");
|
|
}
|
|
emit menuModuleSetThemeStyle("dark-theme");
|
|
+ // menuButton->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
|
|
}
|
|
|
|
void menuModule::setThemeLight(){
|
|
diff -Naur kylin-calculator-1.0.26/src/menumodule.h kylin-calculator-1.0.26~/src/menumodule.h
|
|
--- kylin-calculator-1.0.26/src/menumodule.h 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/menumodule.h 2021-12-08 11:44:56.984081418 +0800
|
|
@@ -24,6 +24,7 @@
|
|
#include <QWidget>
|
|
#include <QMenu>
|
|
#include <QPushButton>
|
|
+#include <QToolButton>
|
|
#include <QDebug>
|
|
#include <QString>
|
|
#include <QLabel>
|
|
@@ -35,6 +36,7 @@
|
|
#include <QMetaEnum>
|
|
|
|
#include "daemonipcdbus.h"
|
|
+#include "highlight-effect.h"
|
|
|
|
class menuModule : public QWidget
|
|
{
|
|
@@ -55,7 +57,7 @@
|
|
// 程序在实例化的时候需要传递的信息字段,打开debug开关后这些字段会被自动填充
|
|
QString appName = "tools/kylin-calculator"; //格式kylin-usb-creator
|
|
QString appShowingName = tr("kylin calculator"); //格式kylin usb creator ,用来在前端展示
|
|
- QString appVersion = "1.0.25";
|
|
+ QString appVersion = "1.0.27";
|
|
QString appDesc = "kylin calculator";
|
|
QString iconPath = "/usr/share/icons/ukui-icon-theme-default/128x128/apps/accessories-calculator.png";
|
|
QString confPath = "org.kylin-calculator-data.settings";
|
|
diff -Naur kylin-calculator-1.0.26/src/scientificmodel.cpp kylin-calculator-1.0.26~/src/scientificmodel.cpp
|
|
--- kylin-calculator-1.0.26/src/scientificmodel.cpp 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/scientificmodel.cpp 2021-12-08 11:44:56.945080818 +0800
|
|
@@ -605,7 +605,6 @@
|
|
// 切换角度弧度显示
|
|
void ScientificModel::changeBtnDisplay()
|
|
{
|
|
- qDebug() << "btnSin->text()" << btnSin->text();
|
|
// 切换文字显示和图片显示
|
|
if (btnSin->text() == "sin") {
|
|
btnSin->setText("asin");
|
|
@@ -650,15 +649,26 @@
|
|
if (btnRad->text() == "rad") {
|
|
btnRad->setText("deg");
|
|
|
|
- btnRad->setIcon(QIcon(":/image/scientific/btnDeg.png"));
|
|
-
|
|
+ if (WidgetStyle::themeColor == 0) {
|
|
+ btnRad->setIcon(QIcon(":/image/light/scientific/btnDeg.png"));
|
|
+ }
|
|
+ else if (WidgetStyle::themeColor == 1) {
|
|
+ btnRad->setIcon(QIcon(":/image/scientific/btnDeg.png"));
|
|
+ }
|
|
+
|
|
// 调整Deg按钮大小
|
|
btnRad->setIconSize(QSize(95, 55));
|
|
}
|
|
else {
|
|
btnRad->setText("rad");
|
|
|
|
- btnRad->setIcon(QIcon(":/image/scientific/btnRad.png"));
|
|
+ if (WidgetStyle::themeColor == 0) {
|
|
+ btnRad->setIcon(QIcon(":/image/light/scientific/btnRad.png"));
|
|
+ }
|
|
+ else if (WidgetStyle::themeColor == 1) {
|
|
+ btnRad->setIcon(QIcon(":/image/scientific/btnRad.png"));
|
|
+ }
|
|
+
|
|
btnRad->setIconSize(QSize(106, 62));
|
|
}
|
|
}
|
|
diff -Naur kylin-calculator-1.0.26/src/titlebar.cpp kylin-calculator-1.0.26~/src/titlebar.cpp
|
|
--- kylin-calculator-1.0.26/src/titlebar.cpp 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/titlebar.cpp 2021-12-08 11:44:56.973081249 +0800
|
|
@@ -72,7 +72,7 @@
|
|
// 设置空间大小
|
|
funcListButton->setFixedSize(30, 30);
|
|
m_pFuncLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
- // m_pTopButton->setFixedSize(30, 30);
|
|
+ m_pTopButton->setFixedSize(30, 30);
|
|
m_pMinimizeButton->setFixedSize(30, 30);
|
|
m_pCloseButton->setFixedSize(30, 30);
|
|
|
|
@@ -83,89 +83,80 @@
|
|
m_pCloseButton->setObjectName("closeButton");
|
|
|
|
// 设置悬浮提示
|
|
- // m_pMinimizeButton->setToolTip("Minimize");
|
|
- // m_pMaximizeButton->setToolTip("Maximize");
|
|
- // m_pCloseButton->setToolTip("Close");
|
|
funcListButton->setToolTip(tr("FuncList"));
|
|
m_pTopButton->setToolTip(tr("StayTop"));
|
|
m_pMinimizeButton->setToolTip(tr("Minimize"));
|
|
- m_pMinimizeButton->setToolTip(tr("Close"));
|
|
+ m_pCloseButton->setToolTip(tr("Close"));
|
|
|
|
// 设置图片
|
|
m_pIconLabel->setIcon(QIcon::fromTheme("calc"));
|
|
m_pIconLabel->setIconSize(QSize(25, 25));
|
|
-// funcListButton->setIcon(QIcon(":/image/funclist.png"));
|
|
-// m_pTopButton->setIcon(QIcon(":/image/top.png"));
|
|
-// m_pMinimizeButton->setIcon(QIcon(":/image/min.png"));
|
|
-// m_pCloseButton->setIcon(QIcon(":/image/close.png"));
|
|
-
|
|
-// m_pMinimizeButton->setIconSize(QSize(25, 25));
|
|
-// m_pTopButton->setIconSize(QSize(18, 18));
|
|
|
|
funcListButton->setIcon(QIcon::fromTheme("open-menu-symbolic"));
|
|
- // funcListButton->setProperty("useIconHighlightEffect", true);
|
|
- // funcListButton->setProperty("iconHighlightEffectMode", 1);
|
|
+ funcListButton->setIconSize(QSize(16, 16));
|
|
funcListButton->setProperty("isWindowButton", 0x1);
|
|
funcListButton->setProperty("useIconHighlightEffect", 0x2);
|
|
funcListButton->setFlat(true);
|
|
- // funcListButton->update();
|
|
|
|
- m_pTopButton->setIcon(QIcon::fromTheme("ukui-unfixed-symbolic", QIcon(":/image/top.png")));
|
|
- // m_pTopButton->setProperty("useIconHighlightEffect", true);
|
|
- // m_pTopButton->setProperty("iconHighlightEffectMode", 1);
|
|
+ m_pTopButton->setIcon(QIcon::fromTheme("ukui-unfixed", QIcon(":/image/top.png")));
|
|
+ m_pTopButton->setIconSize(QSize(16, 16));
|
|
m_pTopButton->setProperty("isWindowButton", 0x1);
|
|
m_pTopButton->setProperty("useIconHighlightEffect", 0x2);
|
|
m_pTopButton->setFlat(true);
|
|
- // m_pTopButton->update();
|
|
|
|
m_pMinimizeButton->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
|
|
- // m_pMinimizeButton->setProperty("useIconHighlightEffect", true);
|
|
- // m_pMinimizeButton->setProperty("iconHighlightEffectMode", 1);
|
|
+ m_pMinimizeButton->setIconSize(QSize(16, 16));
|
|
m_pMinimizeButton->setProperty("isWindowButton", 0x1);
|
|
m_pMinimizeButton->setProperty("useIconHighlightEffect", 0x2);
|
|
m_pMinimizeButton->setFlat(true);
|
|
- m_pMinimizeButton->update();
|
|
|
|
m_pCloseButton->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
|
m_pCloseButton->setIconSize (QSize(16, 16));
|
|
- // m_pCloseButton->setProperty("useIconHighlightEffect", true);
|
|
- // m_pCloseButton->setProperty("iconHighlightEffectMode", 1);
|
|
- // m_pCloseButton->update();
|
|
m_pCloseButton->setProperty("isWindowButton", 0x2);
|
|
m_pCloseButton->setProperty("useIconHighlightEffect", 0x8);
|
|
m_pCloseButton->setFlat(true);
|
|
- // m_pCloseButton->update();
|
|
-
|
|
- // this->setProperty("useIconHighlightEffect", true);
|
|
|
|
menuBar = new menuModule(this);
|
|
-
|
|
|
|
+ m_pMenuButton = new QToolButton(this);
|
|
+ m_pMenuButton->setIcon(QIcon::fromTheme("open-menu-symbolic"));
|
|
+ m_pMenuButton->setFixedSize(30, 30);
|
|
+ m_pMenuButton->setIconSize(QSize(16, 16));
|
|
+ m_pMenuButton->setProperty("isWindowButton", 0x1);
|
|
+ m_pMenuButton->setProperty("useIconHighlightEffect", 0x2);
|
|
+ m_pMenuButton->setAutoRaise(true);
|
|
+
|
|
+ QVBoxLayout *menuLayout = new QVBoxLayout(m_pMenuButton);
|
|
+ menuLayout->addWidget(menuBar->menuButton);
|
|
+ menuLayout->setMargin(0);
|
|
+ menuLayout->setSpacing(0);
|
|
|
|
// 设置按钮布局
|
|
QHBoxLayout *pLayout = new QHBoxLayout(this);
|
|
pLayout->addWidget(m_pIconLabel);
|
|
pLayout->addWidget(m_pFuncLabel);
|
|
- pLayout->addStretch();
|
|
- // pLayout->addWidget(funcListButton);
|
|
- pLayout->addWidget(menuBar->menuButton);
|
|
+ pLayout->addStretch();
|
|
+ pLayout->addWidget(m_pMenuButton);
|
|
pLayout->addWidget(m_pTopButton);
|
|
pLayout->addWidget(m_pMinimizeButton);
|
|
pLayout->addWidget(m_pCloseButton);
|
|
- // pLayout->addWidget(closeBtn);
|
|
- pLayout->setSpacing(0);
|
|
- pLayout->setContentsMargins(5, 0, 5, 0);
|
|
+ pLayout->setSpacing(4);
|
|
+ pLayout->setContentsMargins(4, 0, 4, 0);
|
|
|
|
this->setLayout(pLayout);
|
|
|
|
// 设置信号和槽函数
|
|
- connect(m_pTopButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
|
|
+ // connect(m_pTopButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
|
|
connect(m_pMinimizeButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
|
|
connect(m_pCloseButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
|
|
connect(funcListButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
|
|
|
|
+ connect(m_pMenuButton, SIGNAL(clicked(bool)), this, SLOT(menuClicked()));
|
|
+
|
|
// m_pTopButton->hide();
|
|
- // funcListButton->hide();
|
|
+ funcListButton->hide();
|
|
+ // m_pMenuButton->hide();
|
|
+ // menuBar->menuButton->hide();
|
|
}
|
|
|
|
// 设置组件样式
|
|
@@ -173,28 +164,21 @@
|
|
{
|
|
// 设置按钮样式
|
|
// 设置图片
|
|
- m_pIconLabel->setIcon(QIcon::fromTheme("calc"));
|
|
- funcListButton->setIcon(QIcon::fromTheme("open-menu-symbolic"));
|
|
- m_pTopButton->setIcon(QIcon::fromTheme("ukui-unfixed-symbolic"));
|
|
- m_pMinimizeButton->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
|
|
- m_pCloseButton->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
|
+ // m_pIconLabel->setIcon(QIcon::fromTheme("calc"));
|
|
+ // funcListButton->setIcon(QIcon::fromTheme("open-menu-symbolic"));
|
|
+ // m_pTopButton->setIcon(QIcon::fromTheme("ukui-unfixed-symbolic"));
|
|
+ // m_pMinimizeButton->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
|
|
+ // m_pCloseButton->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
|
|
|
if (WidgetStyle::themeColor == 0) {
|
|
- // m_pFuncLabel->setStyleSheet("color:#000000;font-size:14px;font-family:SourceHanSansCN-Regular;");
|
|
+ m_pFuncLabel->setStyleSheet("color:#000000;font-size:14px;");
|
|
QString btnStyle = "QPushButton{border:0px;border-radius:4px;background:transparent;}"
|
|
"QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.1);}"
|
|
"QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.15);}";
|
|
m_pIconLabel->setStyleSheet(btnStyle);
|
|
- // funcListButton->setStyleSheet(btnStyle);
|
|
- // m_pTopButton->setStyleSheet(btnStyle);
|
|
- // m_pMinimizeButton->setStyleSheet(btnStyle);
|
|
- // m_pCloseButton->setStyleSheet(btnStyle);
|
|
- // m_pCloseButton->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;}"
|
|
- // "QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:#F86457;}"
|
|
- // "QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:#E44C50;}");
|
|
}
|
|
else if (WidgetStyle::themeColor == 1) {
|
|
- // m_pFuncLabel->setStyleSheet("color:#A6A6A6;font-size:14px;font-family:SourceHanSansCN-Regular;");
|
|
+ m_pFuncLabel->setStyleSheet("color:#A6A6A6;font-size:14px;");
|
|
QString btnStyle = "QPushButton{border:0px;border-radius:4px;background:transparent;}"
|
|
"QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.1);}"
|
|
"QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.15);}";
|
|
@@ -207,10 +191,18 @@
|
|
// "QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:#F86457;}"
|
|
// "QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:#E44C50;}");
|
|
|
|
+ m_pTopButton->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
|
|
+
|
|
}
|
|
|
|
}
|
|
|
|
+// 菜单按钮点击事件
|
|
+void TitleBar::menuClicked()
|
|
+{
|
|
+ menuBar->menuButton->click();
|
|
+}
|
|
+
|
|
// 双击标题栏进行界面的最大化/还原
|
|
//void TitleBar::mouseDoubleClickEvent(QMouseEvent *event)
|
|
//{
|
|
@@ -268,11 +260,11 @@
|
|
m_pMinimizeButton->update();
|
|
m_pCloseButton->update();
|
|
}
|
|
- else if (pButton == m_pTopButton)
|
|
- {
|
|
+ // else if (pButton == m_pTopButton)
|
|
+ // {
|
|
// pWindow->parentWidget()->parentWidget()->parentWidget()->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
|
// pWindow->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
|
- }
|
|
+ // }
|
|
|
|
else if (pButton == m_pCloseButton)
|
|
{
|
|
diff -Naur kylin-calculator-1.0.26/src/titlebar.h kylin-calculator-1.0.26~/src/titlebar.h
|
|
--- kylin-calculator-1.0.26/src/titlebar.h 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/titlebar.h 2021-12-08 11:44:56.929080572 +0800
|
|
@@ -42,6 +42,7 @@
|
|
QLabel *m_pFuncLabel; // 界面标识
|
|
QPushButton *m_pTopButton; // 界面置顶按钮
|
|
menuModule *menuBar;
|
|
+ QToolButton *m_pMenuButton;
|
|
// 模式和功能列表按钮
|
|
QPushButton *funcListButton;
|
|
|
|
@@ -54,6 +55,8 @@
|
|
// 设置组件样式
|
|
void setWidgetStyle();
|
|
|
|
+
|
|
+
|
|
protected:
|
|
|
|
#ifdef __V10__
|
|
@@ -74,6 +77,9 @@
|
|
// 窗口置顶操作
|
|
void stayTop();
|
|
|
|
+ // 菜单按钮点击事件
|
|
+ void menuClicked();
|
|
+
|
|
private:
|
|
|
|
// 最大化/还原
|
|
diff -Naur kylin-calculator-1.0.26/src/toolmodel.cpp kylin-calculator-1.0.26~/src/toolmodel.cpp
|
|
--- kylin-calculator-1.0.26/src/toolmodel.cpp 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/toolmodel.cpp 2021-12-08 11:44:56.990081510 +0800
|
|
@@ -40,7 +40,7 @@
|
|
{
|
|
// 汇率刷新
|
|
toolLabUpdate = new QLabel(this);
|
|
- toolIconUpdate = new QPushButton(this);
|
|
+ toolIconUpdate = new QToolButton(this);
|
|
toolLabRate = new QLabel(this);
|
|
|
|
toolUpdateLayout = new QVBoxLayout(this);
|
|
@@ -361,6 +361,9 @@
|
|
|
|
toolIconUpdate->setIcon(QIcon::fromTheme("transform-rotate", QIcon(":/image/update.png")));
|
|
toolIconUpdate->setIconSize(QSize(16, 16));
|
|
+ toolIconUpdate->setProperty("isWindowButton", 0x1);
|
|
+ toolIconUpdate->setProperty("useIconHighlightEffect", 0x2);
|
|
+ toolIconUpdate->setAutoRaise(true);
|
|
|
|
toolLabRate->setText("2020.09.03 09:30\n1 CNY = 0.15 USD");
|
|
|
|
diff -Naur kylin-calculator-1.0.26/src/toolmodel.h kylin-calculator-1.0.26~/src/toolmodel.h
|
|
--- kylin-calculator-1.0.26/src/toolmodel.h 2021-11-26 23:21:17.000000000 +0800
|
|
+++ kylin-calculator-1.0.26~/src/toolmodel.h 2021-12-08 11:44:56.950080895 +0800
|
|
@@ -22,6 +22,7 @@
|
|
#include <QHBoxLayout>
|
|
#include <QVBoxLayout>
|
|
#include <QPushButton>
|
|
+#include <QToolButton>
|
|
#include <QLineEdit>
|
|
#include <QFont>
|
|
#include <QLabel>
|
|
@@ -63,7 +64,7 @@
|
|
|
|
// 汇率更新
|
|
QLabel *toolLabUpdate;
|
|
- QPushButton *toolIconUpdate;
|
|
+ QToolButton *toolIconUpdate;
|
|
QLabel *toolLabRate;
|
|
|
|
// 单位换算比率
|