forked from openkylin/ukui-menu
!42 修改按钮与搜索栏ui问题,增加收藏最近的焦点打开方式
Merge pull request !42 from 张天泽/fixedBUG
This commit is contained in:
commit
02d992b142
|
@ -0,0 +1,104 @@
|
|||
#include "push_button.h"
|
||||
|
||||
PushButton::PushButton(QWidget *parent) : QPushButton(parent)
|
||||
{
|
||||
m_btnLayout = new QHBoxLayout(this);
|
||||
this->setLayout(m_btnLayout);
|
||||
m_label = new IconLabel(this);
|
||||
m_btnLayout->addWidget(m_label);
|
||||
|
||||
m_label->setAlignment(Qt::AlignCenter);
|
||||
m_btnLayout->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
void PushButton::setLabel(QPixmap pixmap, int size)
|
||||
{
|
||||
m_label->setFixedSize(size, size);
|
||||
m_label->setIcon(pixmap);
|
||||
}
|
||||
|
||||
PushButton::~PushButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PushButton::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
QStylePainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
QStyleOptionButton option;
|
||||
initStyleOption(&option);
|
||||
|
||||
if (option.state & QStyle::State_Sunken) {
|
||||
painter.save();
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::white);
|
||||
if (g_curStyle == "ukui-dark" || g_isFullScreen) {
|
||||
painter.setOpacity(0.25);
|
||||
} else {
|
||||
painter.setOpacity(0.65);
|
||||
}
|
||||
|
||||
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
if (option.state & QStyle::State_MouseOver) {
|
||||
painter.save();
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::white);
|
||||
if (g_curStyle == "ukui-dark" || g_isFullScreen) {
|
||||
painter.setOpacity(0.1);
|
||||
} else {
|
||||
painter.setOpacity(0.35);
|
||||
}
|
||||
|
||||
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
if (option.state & QStyle::State_On) {
|
||||
painter.save();
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::white);
|
||||
if (g_curStyle == "ukui-dark" || g_isFullScreen) {
|
||||
painter.setOpacity(0.2);
|
||||
} else {
|
||||
painter.setOpacity(0.5);
|
||||
}
|
||||
|
||||
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
if (option.state & QStyle::State_HasFocus) {
|
||||
painter.save();
|
||||
QStyleOption opt;
|
||||
QColor color = opt.palette.color(QPalette::Highlight);
|
||||
painter.setPen(QPen(color, 2));
|
||||
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
|
||||
painter.restore();
|
||||
}
|
||||
}
|
||||
|
||||
IconLabel::IconLabel(QWidget *parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void IconLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::SmoothPixmapTransform, true);
|
||||
painter.drawPixmap(0, 0, m_pixmap);
|
||||
return QLabel::paintEvent(event);
|
||||
}
|
||||
|
||||
void IconLabel::setIcon(const QPixmap &pixmap)
|
||||
{
|
||||
m_pixmap = pixmap;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef PUSHBUTTON_H
|
||||
#define PUSHBUTTON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QStylePainter>
|
||||
#include <QStyleOption>
|
||||
#include <QHBoxLayout>
|
||||
#include "utility.h"
|
||||
|
||||
class IconLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
IconLabel(QWidget *parent = nullptr);
|
||||
void setIcon(const QPixmap &pixmap);
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QPixmap m_pixmap;
|
||||
};
|
||||
|
||||
class PushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PushButton(QWidget *parent = nullptr);
|
||||
~PushButton();
|
||||
|
||||
void setLabel(QPixmap pixmap, int size);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
QHBoxLayout *m_btnLayout = nullptr;
|
||||
IconLabel *m_label = nullptr;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
};
|
||||
#endif // PUSHBUTTON_H
|
|
@ -0,0 +1,34 @@
|
|||
#include "textlabel.h"
|
||||
#include <QDebug>
|
||||
|
||||
TextLabel::TextLabel(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TextLabel::checkState(bool isChecked)
|
||||
{
|
||||
m_isChecked = isChecked;
|
||||
}
|
||||
|
||||
void TextLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if (m_isChecked) {
|
||||
return QLabel::paintEvent(event);
|
||||
}
|
||||
|
||||
QStylePainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
QStyleOptionFrame option;
|
||||
initStyleOption(&option);
|
||||
|
||||
if (option.state & QStyle::State_HasFocus) {
|
||||
painter.save();
|
||||
QStyleOption opt;
|
||||
QColor color = opt.palette.color(QPalette::Highlight);
|
||||
painter.setPen(QPen(color, 2));
|
||||
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
|
||||
painter.restore();
|
||||
}
|
||||
QLabel::paintEvent(event);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef TEXTLABEL_H
|
||||
#define TEXTLABEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QLabel>
|
||||
#include <QPaintEvent>
|
||||
#include <QStylePainter>
|
||||
#include <QStyleOption>
|
||||
|
||||
class TextLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextLabel(QWidget *parent = nullptr);
|
||||
|
||||
void checkState(bool isChecked);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
bool m_isChecked = false;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
};
|
||||
|
||||
#endif // TEXTLABEL_H
|
|
@ -74,9 +74,9 @@ FunctionWidget::FunctionWidget(QWidget *parent): QWidget(parent)
|
|||
|
||||
FunctionWidget::~FunctionWidget()
|
||||
{
|
||||
if (themeSetting) {
|
||||
delete themeSetting;
|
||||
}
|
||||
// if (themeSetting) {
|
||||
// delete themeSetting;
|
||||
// }
|
||||
|
||||
if (myTimer) {
|
||||
delete myTimer;
|
||||
|
@ -146,7 +146,7 @@ FunctionWidget::~FunctionWidget()
|
|||
delete effect;
|
||||
}
|
||||
|
||||
themeSetting = nullptr;
|
||||
// themeSetting = nullptr;
|
||||
myTimer = nullptr;
|
||||
upWidget = nullptr;
|
||||
upLayout = nullptr;
|
||||
|
|
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
private:
|
||||
CurrentTimeInterface *Time = nullptr;
|
||||
QGSettings *themeSetting = nullptr;
|
||||
// QGSettings *themeSetting = nullptr;
|
||||
QGSettings *timeSetting = nullptr;
|
||||
QString themeName;
|
||||
QObject *plugin = nullptr;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PUSHBUTTON_H
|
||||
#define PUSHBUTTON_H
|
||||
#ifndef SPLITBARFRAME_H
|
||||
#define SPLITBARFRAME_H
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
@ -51,4 +51,4 @@ protected:
|
|||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
#endif // PUSHBUTTON_H
|
||||
#endif // SPLITBARFRAME
|
||||
|
|
|
@ -82,11 +82,11 @@ void FullMainWindow::initButtonUI()
|
|||
m_fullSelectMenuButton->setFixedSize(QSize(16, 34));
|
||||
m_fullSelectMenuButton->setAcceptDrops(true);
|
||||
m_fullSelectMenuButton->setFocusPolicy(Qt::StrongFocus);
|
||||
m_fullSelectMenuButton->setIcon(QPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png"));
|
||||
m_fullSelectMenuButton->setIcon(getCurPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png", false, 16));
|
||||
QPalette palete;
|
||||
palete.setColor(QPalette::NoRole, Qt::white);
|
||||
m_fullSelectMenuButton->setPalette(palete);
|
||||
m_minPushButton = new QPushButton(centralwidget);
|
||||
m_minPushButton = new PushButton(centralwidget);
|
||||
m_minPushButton->setObjectName(QString::fromUtf8("minPushButton"));
|
||||
m_minPushButton->setFixedSize(QSize(48, 48));
|
||||
m_minPushButton->setFlat(true);
|
||||
|
@ -288,9 +288,10 @@ void FullMainWindow::changeStyle()
|
|||
"%1:hover {border-radius:24px; background:" + buttonColorHover + ";}"
|
||||
"%1:pressed {border-radius:24px; background:" + buttonColorPress + ";}");
|
||||
m_fullSelectToolButton->setStyleSheet(m_buttonStyle.arg("QPushButton"));
|
||||
m_fullSelectMenuButton->setIcon(QPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png"));
|
||||
m_minPushButton->setIcon(getCurIcon(":/data/img/mainviewwidget/full-min.svg", false));
|
||||
m_minPushButton->setProperty("useIconHighlightEffect", 0x0);
|
||||
|
||||
QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/full-min.svg"), 25);
|
||||
m_minPushButton->setLabel(pixmap, 25);
|
||||
// m_minPushButton->setProperty("useIconHighlightEffect", 0x0);
|
||||
}
|
||||
|
||||
void FullMainWindow::on_minPushButton_clicked()
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "searchappthread.h"
|
||||
#include "full_searchresult_widget.h"
|
||||
#include "rotationlabel.h"
|
||||
#include "push_button.h"
|
||||
|
||||
class FullMainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ private:
|
|||
QSpacerItem *horizontalSpacer_2;
|
||||
QPushButton *m_fullSelectToolButton;
|
||||
RotationLabel *m_fullSelectMenuButton;
|
||||
QPushButton *m_minPushButton;
|
||||
PushButton *m_minPushButton;
|
||||
QStackedWidget *m_fullStackedWidget;
|
||||
|
||||
FullCommonUseWidget *m_fullCommonPage;
|
||||
|
|
|
@ -165,16 +165,16 @@ void MainWindow::registDbusServer()
|
|||
m_topStackedWidget->setCurrentIndex(0);
|
||||
m_lineEdit->clear();
|
||||
this->clearFocus();
|
||||
m_isFullScreen = false;
|
||||
g_isFullScreen = false;
|
||||
} else if (m_fullWindow->isVisible())
|
||||
{
|
||||
m_fullWindow->hide();
|
||||
m_fullWindow->clearFocus();
|
||||
m_fullWindow->resetEditline();
|
||||
m_isFullScreen = true;
|
||||
g_isFullScreen = true;
|
||||
} else
|
||||
{
|
||||
if (!m_isFullScreen) {
|
||||
if (!g_isFullScreen) {
|
||||
this->show();
|
||||
setMinWindowPos();
|
||||
this->raise();
|
||||
|
@ -384,24 +384,25 @@ void MainWindow::initRightWidgetButton()
|
|||
m_mainRightVerticalLayout_1 = new QVBoxLayout();
|
||||
m_rightTopHorizontalLayout = new QHBoxLayout();
|
||||
m_rightTopHorizontalLayout->setSpacing(30);
|
||||
m_rightTopHorizontalLayout->setContentsMargins(8, 0, 10, 0);
|
||||
m_rightTopHorizontalLayout->setContentsMargins(8, 0, 6, 0);
|
||||
//收藏按键
|
||||
m_collectPushButton = new QLabel(m_centralwidget);
|
||||
m_collectPushButton = new TextLabel(m_centralwidget);
|
||||
m_collectPushButton->setFocusPolicy(Qt::StrongFocus);
|
||||
m_collectPushButton->setFixedHeight(34);
|
||||
// m_collectPushButton->setFlat(true);
|
||||
m_collectPushButton->installEventFilter(this);
|
||||
//最近按键
|
||||
m_recentPushButton = new QLabel(m_centralwidget);
|
||||
m_recentPushButton = new TextLabel(m_centralwidget);
|
||||
m_recentPushButton->setFixedHeight(34);
|
||||
m_recentPushButton->setFocusPolicy(Qt::StrongFocus);
|
||||
// m_recentPushButton->setFlat(true);
|
||||
m_recentPushButton->installEventFilter(this);
|
||||
m_horizontalSpacer_3 = new QSpacerItem(332, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
//放大缩小按键
|
||||
m_minMaxChangeButton = new QPushButton(m_centralwidget);
|
||||
m_minMaxChangeButton->setFixedSize(QSize(24, 24));
|
||||
m_minMaxChangeButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-max.svg", true));
|
||||
m_minMaxChangeButton = new PushButton(m_centralwidget);
|
||||
m_minMaxChangeButton->setFixedSize(QSize(34, 34));
|
||||
QPixmap pixmap = getCurPixmap(":/data/img/mainviewwidget/DM-max.svg",true, 16);
|
||||
m_minMaxChangeButton->setLabel(pixmap, 16);
|
||||
m_minMaxChangeButton->setFlat(true);
|
||||
m_rightTopHorizontalLayout->addWidget(m_collectPushButton);
|
||||
m_rightTopHorizontalLayout->addWidget(m_recentPushButton);
|
||||
|
@ -638,6 +639,9 @@ void MainWindow::changeStyle()
|
|||
}
|
||||
}
|
||||
|
||||
QPixmap pixmap = getCurPixmap(":/data/img/mainviewwidget/DM-max.svg",true, 16);
|
||||
m_minMaxChangeButton->setLabel(pixmap, 16);
|
||||
|
||||
m_buttonStyle = QString("%1{border-radius:13px; background:" + buttonColorDefault + ";}"
|
||||
"%1:hover {border-radius:13px; background:" + buttonColorHover + ";}"
|
||||
"%1:pressed {border-radius:13px; background:" + buttonColorPress + ";}");
|
||||
|
@ -745,6 +749,14 @@ bool MainWindow::event(QEvent *event)
|
|||
QApplication::postEvent(m_selectMenuButton, new QEvent(QEvent::MouseButtonPress));
|
||||
}
|
||||
|
||||
if (m_collectPushButton->hasFocus()) {
|
||||
on_collectPushButton_clicked();
|
||||
}
|
||||
|
||||
if (m_recentPushButton->hasFocus()) {
|
||||
on_recentPushButton_clicked();
|
||||
}
|
||||
|
||||
if (m_lineEdit->hasFocus()) {
|
||||
m_minSearchResultListView->setFocus();
|
||||
} else {
|
||||
|
@ -1231,6 +1243,8 @@ void MainWindow::databaseThreadCloseSlot()
|
|||
|
||||
void MainWindow::on_collectPushButton_clicked()
|
||||
{
|
||||
m_recentPushButton->checkState(false);
|
||||
m_collectPushButton->checkState(true);
|
||||
m_rightStackedWidget->setCurrentIndex(0);
|
||||
|
||||
QString textColorHightLight = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16).mid(2, 6);
|
||||
|
@ -1245,6 +1259,8 @@ void MainWindow::on_collectPushButton_clicked()
|
|||
|
||||
void MainWindow::on_recentPushButton_clicked()
|
||||
{
|
||||
m_collectPushButton->checkState(false);
|
||||
m_recentPushButton->checkState(true);
|
||||
m_rightStackedWidget->setCurrentIndex(1);
|
||||
QString textColorDefault = QString::number(this->palette().color(QPalette::Text).rgba(), 16).mid(2, 6);
|
||||
m_collectPushButton->setStyleSheet(QString("color:#%1").arg(textColorDefault));
|
||||
|
@ -1270,7 +1286,7 @@ void MainWindow::on_searchPushButton_clicked()
|
|||
void MainWindow::on_minMaxChangeButton_clicked()
|
||||
{
|
||||
m_canHide = true;
|
||||
m_isFullScreen = true;
|
||||
g_isFullScreen = true;
|
||||
QPropertyAnimation *m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this);
|
||||
connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished);
|
||||
|
||||
|
@ -1300,7 +1316,7 @@ void MainWindow::showWindow()
|
|||
{
|
||||
Style::initWidStyle();
|
||||
myDebug() << "调用开始菜单显示";
|
||||
if (m_isFullScreen) {
|
||||
if (g_isFullScreen) {
|
||||
m_fullWindow->show();
|
||||
setMaxWindowPos();
|
||||
m_fullWindow->raise();
|
||||
|
@ -1322,13 +1338,13 @@ void MainWindow::hideWindow()
|
|||
m_fullWindow->hide();
|
||||
m_fullWindow->resetEditline();
|
||||
this->clearFocus();
|
||||
m_isFullScreen = true;
|
||||
g_isFullScreen = true;
|
||||
} else {
|
||||
this->hide();
|
||||
m_topStackedWidget->setCurrentIndex(0);
|
||||
m_lineEdit->clear();
|
||||
this->clearFocus();
|
||||
m_isFullScreen = false;
|
||||
g_isFullScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1415,7 +1431,7 @@ void MainWindow::showNormalWindowSlot()
|
|||
QEventLoop loop;
|
||||
QTimer::singleShot(100, &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
m_isFullScreen = false;
|
||||
g_isFullScreen = false;
|
||||
m_minAnimation->setEasingCurve(QEasingCurve::OutExpo);
|
||||
m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
|
||||
m_minAnimation->setEndValue(QRect(this->x() + 5, this->y() + 5, Style::m_minw - 10, Style::m_minh - 10));
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#include "animationpage.h"
|
||||
#include "rotationlabel.h"
|
||||
#include "rightlistview.h"
|
||||
#include "push_button.h"
|
||||
#include "textlabel.h"
|
||||
#include "ukuistylehelper/ukuistylehelper.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
|
@ -200,10 +202,10 @@ private:
|
|||
QHBoxLayout *m_rightTopHorizontalLayout = nullptr;
|
||||
QVBoxLayout *m_rightCollectLayout = nullptr;
|
||||
QVBoxLayout *m_rightRecentLayout = nullptr;
|
||||
QLabel *m_collectPushButton = nullptr;
|
||||
QLabel *m_recentPushButton = nullptr;
|
||||
TextLabel *m_collectPushButton = nullptr;
|
||||
TextLabel *m_recentPushButton = nullptr;
|
||||
QSpacerItem *m_horizontalSpacer_3 = nullptr;
|
||||
QPushButton *m_minMaxChangeButton = nullptr;
|
||||
PushButton *m_minMaxChangeButton = nullptr;
|
||||
QSpacerItem *m_verticalSpacer = nullptr;
|
||||
QStackedWidget *m_rightStackedWidget = nullptr;
|
||||
QWidget *m_collectPage = nullptr;
|
||||
|
@ -220,7 +222,6 @@ private:
|
|||
MenuBox *m_dropDownMenu = nullptr;
|
||||
|
||||
bool m_canHide = true;
|
||||
bool m_isFullScreen = false;
|
||||
QString m_buttonStyle;
|
||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
||||
QPropertyAnimation *m_animation = nullptr;
|
||||
|
|
|
@ -11,6 +11,8 @@ HEADERS += \
|
|||
$$PWD/Button/function_classify_button.h \
|
||||
$$PWD/Button/letter_classify_button.h \
|
||||
$$PWD/Button/tool_button.h \
|
||||
$$PWD/Button/push_button.h \
|
||||
$$PWD/Button/textlabel.h\
|
||||
$$PWD/ListView/fulllistview.h \
|
||||
$$PWD/ListView/klistview.h \
|
||||
$$PWD/ListView/listview.h \
|
||||
|
@ -48,6 +50,8 @@ SOURCES += \
|
|||
$$PWD/Button/function_classify_button.cpp \
|
||||
$$PWD/Button/letter_classify_button.cpp \
|
||||
$$PWD/Button/tool_button.cpp \
|
||||
$$PWD/Button/push_button.cpp \
|
||||
$$PWD/Button/textlabel.cpp\
|
||||
$$PWD/ListView/fulllistview.cpp \
|
||||
$$PWD/ListView/klistview.cpp \
|
||||
$$PWD/ListView/listview.cpp \
|
||||
|
|
|
@ -40,16 +40,16 @@
|
|||
#define RightClickMenuOpacity 0.95
|
||||
#define ToolTipBackground "rgba(26, 26, 26, 0.7)"
|
||||
#define DefaultBackground "rgba(19, 19, 20, 0.7)" //默认态背景色
|
||||
#define LineBackground "rgba(255,255,255)" //分割线背景色
|
||||
#define LineBackground "rgba(255, 255, 255)" //分割线背景色
|
||||
#define SBClassifyBtnSelectedBackground "#3D6BE5" //侧边栏上部分类按钮选择背景
|
||||
#define SBFunBtnHoverBackground "rgba(255, 255, 255, 0.14)" //侧边栏目下部功能按钮悬浮背景
|
||||
#define ClassifyBtnHoverBackground "rgba(255, 255, 255, 0.14)" //分类按钮悬浮背景
|
||||
#define MMBtnHoverBackground "rgba(255, 255, 255, 0.14)" //最大化最小化按钮悬浮背景
|
||||
#define QueryLineEditDefaultBackground "rgba(0, 0, 0,0.04)" //搜索框默认态背景
|
||||
#define QueryLineEditBackground "rgba(255, 255, 255,0.06)" //搜索框背景
|
||||
#define QueryLineEditClickedDefaultBackground "rgba(0, 0, 0,0.04)" //搜索框默认态背景选中
|
||||
#define QueryLineEditClickedBackground "rgba(255, 255, 255,0.06)" //搜索框背景选中
|
||||
#define QueryLineEditClickedBorderDefault "rgba(0, 0, 0,0.1)" //搜索框默认态背景选中边框
|
||||
#define QueryLineEditDefaultBackground "rgba(0, 0, 0, 0.04)" //搜索框默认态背景
|
||||
#define QueryLineEditBackground "rgba(255, 255, 255, 0.06)" //搜索框背景
|
||||
#define QueryLineEditClickedDefaultBackground "rgba(0, 0, 0, 0.04)" //搜索框默认态背景选中
|
||||
#define QueryLineEditClickedBackground "rgba(255, 255, 255, 0.06)" //搜索框背景选中
|
||||
#define QueryLineEditClickedBorderDefault "rgba(255, 255, 255, 0.25)" //搜索框默认态背景选中边框
|
||||
#define QueryLineEditClickedBorder "rgba(5, 151, 255, 1)" //搜索框背景选中边框
|
||||
#define AppBtnHover "#ffffff" //按钮悬浮
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
QString g_projectCodeName = "V10SP1";
|
||||
QString g_subProjectCodeName = "";
|
||||
QString g_platform = "";
|
||||
bool g_menuStatus = false;
|
||||
QString g_curStyle = "";
|
||||
bool g_menuStatus = false;
|
||||
bool g_isFullScreen = false;
|
||||
|
||||
const QPixmap loadSvg(const QString &fileName, const int size)
|
||||
{
|
||||
|
@ -132,6 +133,35 @@ QIcon getCurIcon(const QString &iconPath, bool autoSet)
|
|||
return QIcon(pixmap);
|
||||
}
|
||||
|
||||
QPixmap getCurPixmap(const QString &iconPath, bool autoSet, int size)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
|
||||
if (iconPath.endsWith("png")) {
|
||||
pixmap = QPixmap(iconPath);
|
||||
} else {
|
||||
pixmap = loadSvg(iconPath, size);
|
||||
}
|
||||
|
||||
if (!autoSet) {
|
||||
return drawSymbolicColoredPixmap(pixmap);
|
||||
}
|
||||
|
||||
if (QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) {
|
||||
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
|
||||
|
||||
if (gsetting.keys().contains(QString("styleName"))) {
|
||||
if (gsetting.get("style-name").toString() == "ukui-light"
|
||||
|| gsetting.get("style-name").toString() == "ukui-default") {
|
||||
pixmap = drawSymbolicBlackColoredPixmap(pixmap);
|
||||
} else {
|
||||
pixmap = drawSymbolicColoredPixmap(pixmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
//不通过任务栏获取屏幕可用区域数据
|
||||
QVariantList getScreenGeometryList()
|
||||
{
|
||||
|
|
|
@ -71,6 +71,7 @@ bool checkOsRelease();//区分社区办与商业版
|
|||
|
||||
void centerToScreen(QWidget *widget);
|
||||
QIcon getCurIcon(const QString &iconPath, bool autoSet);
|
||||
QPixmap getCurPixmap(const QString &iconPath, bool autoSet, int size);
|
||||
|
||||
//获取用户图像
|
||||
QString getUserIcon();
|
||||
|
@ -87,8 +88,9 @@ enum PanelPositon {
|
|||
extern QString g_projectCodeName;
|
||||
extern QString g_subProjectCodeName;
|
||||
extern QString g_platform;
|
||||
extern bool g_menuStatus;
|
||||
extern QString g_curStyle;
|
||||
extern bool g_menuStatus;
|
||||
extern bool g_isFullScreen;
|
||||
|
||||
|
||||
#endif // UTILITY_H
|
||||
|
|
Loading…
Reference in New Issue