From d8223537a44cf07efce3f82bd99893319f7bdf17 Mon Sep 17 00:00:00 2001 From: kaniol-lck <375520360@qq.com> Date: Thu, 4 Jul 2024 00:09:55 +0800 Subject: [PATCH] tweaked qss & fixed menubar under non-frameless --- src/download/downloadfileinfo.cpp | 9 +- src/download/downloadmanager.cpp | 2 +- src/main.cpp | 3 +- src/qss/basic.qss | 102 +++++++++---- src/qss/dark.qss | 235 ++++++++++++++++++------------ src/qss/light.qss | 212 +++++++++++++++++---------- src/ui/framelesswrapper.cpp | 16 -- src/ui/framelesswrapper.h | 1 - src/ui/modmanager.cpp | 9 +- src/ui/windowstitlebar.cpp | 19 +-- src/ui/windowstitlebar.h | 6 +- src/ui/windowstitlebar.ui | 6 +- 12 files changed, 375 insertions(+), 245 deletions(-) diff --git a/src/download/downloadfileinfo.cpp b/src/download/downloadfileinfo.cpp index ece3dc78..94cee099 100644 --- a/src/download/downloadfileinfo.cpp +++ b/src/download/downloadfileinfo.cpp @@ -2,13 +2,16 @@ #include +#include "config.hpp" + DownloadFileInfo::DownloadFileInfo(const QUrl &url, const QString &path) : title_(QObject::tr("Custom Download")), displayName_(url.fileName()), fileName_(url.fileName()), - url_(url), - path_(path) -{} + url_(url) +{ + path_ = path.isEmpty()? Config().getDownloadPath() : path; +} DownloadFileInfo::DownloadFileInfo(const CurseforgeFileInfo &info) : DownloadFileInfo(info.url()) diff --git a/src/download/downloadmanager.cpp b/src/download/downloadmanager.cpp index ed9b5248..56d60f24 100644 --- a/src/download/downloadmanager.cpp +++ b/src/download/downloadmanager.cpp @@ -25,7 +25,7 @@ QAria2Downloader *DownloadManager::download(const DownloadFileInfo &info) model_->beginInsertRows(QModelIndex(), downloaders_.size(), downloaders_.size()); downloaders_ << downloader; model_->endInsertRows(); - qDebug() << "new download job" << info.displayName(); + qDebug() << "new download job" << info.displayName() << info.filePath(); emit downloaderAdded(info, downloader); //handle redirect downloader->handleRedirect(); diff --git a/src/main.cpp b/src/main.cpp index 295cc672..ab0b4992 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "qss/stylesheets.h" #include "ui/modmanager.h" #include @@ -19,6 +20,7 @@ int main(int argc, char *argv[]) a.setOrganizationName("kaniol"); a.setApplicationName("Mod Manager"); a.setApplicationDisplayName(QObject::tr("Mod Manager")); + a.setStyleSheet(styleSheetPath(Config().getCustomStyle())); //setup translator QTranslator translator; @@ -53,7 +55,6 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WIN if(Config().getUseFramelessWindow()){ auto titleBar = new WindowsTitleBar(&w, w.menuBar()); -// QObject::connect(&w, &ModManager::menuBarChanged, titleBar, &WindowsTitleBar::updateMenuBar); auto frameless = new FramelessWrapper(nullptr, &w, titleBar); QObject::connect(&w, &ModManager::closed, frameless, &FramelessWrapper::close); titleBar->setParentWidget(frameless); diff --git a/src/qss/basic.qss b/src/qss/basic.qss index 2e6536a0..71a046a7 100644 --- a/src/qss/basic.qss +++ b/src/qss/basic.qss @@ -1,41 +1,40 @@ -QWidget:focus{ +QWidget:focus { outline: none; } -QTextBrowser, QScrollArea, QScrollArea .QWidget { +/* Tranparent */ +Browser .QWidget, +Browser .QWidget .QScrollArea, +QDockWidget .QWidget, +QDockWidget .QTextBrowser, +QDockWidget .QScrollArea, +QDockWidget .QToolButton, +QDockWidget .QLabel { background-color: transparent; - border-color: transparent; } -.ModList::item:hover { - border-left: 5px solid #eee; - background-color: #22eeeeee; -} - -.ModList::item:selected { - border-left: 5px solid #37d; - background-color: #223377dd; - color: black; -} - -.GitHubReleaseItemWidget, .LocalModItemWidget { +/* Label Texts */ +.GitHubReleaseItemWidget, +.LocalModItemWidget { margin-left: 5px; } -.DateTimeText > * { - color: #777; +.DateTimeText>* { + color: #777777; font-size: 9pt; } .Title { - color: black; + color: #000000; font-weight: bold; font-size: 13pt; - background: transparent; + background-color: transparent; } -.CurseforgeFileListWidget .Title, .ModrinthFileListWidget .Title, -.GitHubFileListWidget .Title, .LocalFileListWidget .Title { +.CurseforgeFileListWidget .Title, +.ModrinthFileListWidget .Title, +.GitHubFileListWidget .Title, +.LocalFileListWidget .Title { font-size: 11pt; } @@ -45,20 +44,40 @@ QTextBrowser, QScrollArea, QScrollArea .QWidget { background: transparent; } -.GitHubReleaseItemWidget > .PreRelease { - color: #fff; +.GitHubReleaseItemWidget>.PreRelease { + color: #ffffff; background-color: #e7ab34; - border-radius:2px; - padding:1px 2px; + border-radius: 2px; + padding: 1px 2px; } -.GitHubReleaseItemWidget > .TagName { - color: gray; +.GitHubReleaseItemWidget>.TagName { + color: #777777; font-size: 10pt; } -#maxButton:hover,#minButton:hover { - background-color: rgb(218, 218, 218); +/* ModList */ +.ModList::item:hover { + border-left: 5px solid #eeeeee; + background-color: #22eeeeee; +} + +.ModList::item:selected { + border-left: 5px solid #37d; + background-color: #223377dd; + color: black; +} + +/* TitleBar Button */ +#maxButton, +#minButton, +#closeButton { + border: none; +} + +#maxButton:hover, +#minButton:hover { + background-color: #dbdbdb; border: none; } @@ -67,14 +86,35 @@ QTextBrowser, QScrollArea, QScrollArea .QWidget { border: none; } -QTreeView::item { - min-height: 35px; +/* TitleBar Menu */ +QMenuBar { + color: #777777; +} + +QMenuBar::item:selected { + background-color: #dbdbdb; +} + +QMenuBar::item:pressed { + background-color: #d3d3d3; + color: black; } +/* Side Bar */ QTreeView.PageSelector::item { min-height: 40px; } QTreeView.PageSelector::item::selected { + border: 1px solid #37d; + background-color: #dbdbdb; + border-radius: 3px; color: black; } + +QTreeView.PageSelector::item::hover { + border: 1px solid #dbdbdb; + background-color: #eeeeee; + border-radius: 3px; + color: black; +} \ No newline at end of file diff --git a/src/qss/dark.qss b/src/qss/dark.qss index da62b017..bc51988d 100644 --- a/src/qss/dark.qss +++ b/src/qss/dark.qss @@ -1,103 +1,160 @@ -QWidget:focus{ +QWidget:focus { outline: none; } -.QWidget { - background-color: transparent; -} - QWidget { - background-color: rgb(82, 82, 82); - color: whitesmoke; + color: white; } -QLabel { - background-color: transparent; +/* DockWidget & Title */ +.QWidget, +QDialog, +QLineEdit, +QSpinBox, +QDoubleSpinBox { + background-color: #424242; } -QTextBrowser, QScrollArea, QScrollArea .QWidget { - background-color: transparent; - border-color: transparent; +/* Browser */ +Browser { + background-color: #424242; } -.ModList::item:hover { - border-left: 5px solid #eee; - background-color: #22eeeeee; +/* ModList inside */ +Browser .ModList { + background-color: #424242; } -.ModList::item:selected { - border-left: 5px solid #37d; - background-color: #223377dd; - color: black; +/* Tranparent */ +Browser .QWidget, +Browser .QWidget .QScrollArea, +QDockWidget .QWidget, +QDockWidget .QTextBrowser, +QDockWidget .QScrollArea, +QDockWidget .QToolButton, +QDockWidget .QLabel { + background-color: transparent; } -.GitHubReleaseItemWidget, .LocalModItemWidget { +/* Label Texts */ +.GitHubReleaseItemWidget, +.LocalModItemWidget { margin-left: 5px; } -.DateTimeText > * { - color: #ddd; +.DateTimeText>* { + color: #777777; font-size: 9pt; } .Title { - color: #fff; + color: white; font-weight: bold; font-size: 13pt; - background: transparent; + background-color: transparent; } -.CurseforgeFileListWidget .Title, .ModrinthFileListWidget .Title, -.GitHubFileListWidget .Title, .LocalFileListWidget .Title { +.CurseforgeFileListWidget .Title, +.ModrinthFileListWidget .Title, +.GitHubFileListWidget .Title, +.LocalFileListWidget .Title { font-size: 11pt; } .Description { - color: #cfcfcf; + color: #ededed; font-size: 10pt; background: transparent; } -.GitHubReleaseItemWidget > .PreRelease { - color: #fff; +.GitHubReleaseItemWidget>.PreRelease { + color: #ffffff; background-color: #e7ab34; - border-radius:2px; - padding:1px 2px; + border-radius: 2px; + padding: 1px 2px; } -.GitHubReleaseItemWidget > .TagName { - color: gray; +.GitHubReleaseItemWidget>.TagName { + color: #777777; font-size: 10pt; } -.MenuButton, #maxButton, #minButton, #closeButton{ - border: none; +/* ModList */ +.ModList::item:hover { + border-left: 5px solid #eeeeee; + background-color: #22eeeeee; } -.MenuButton:hover { - background-color: rgb(165, 165, 165); - border: none; +.ModList::item:selected { + border-left: 5px solid #37d; + background-color: #223377dd; + color: black; } -.MenuButton:pressed { - background-color: rgb(110, 110, 110); - color: whitesmoke; +/* TitleBar Button */ +#maxButton, +#minButton, +#closeButton { border: none; } -#maxButton:hover,#minButton:hover { - background-color: rgb(218, 218, 218); +#maxButton:hover, +#minButton:hover { + background-color: #4b4b4b; border: none; } #closeButton:hover { - background-color: red; + background-color: #be0000; border: none; } +/* TitleBar Menu */ +QMenuBar { + color: #dbdbdb; +} + +QMenuBar::item:selected { + background-color: #4b4b4b; +} + +QMenuBar::item:pressed { + background-color: #656565; + color: white; +} + +/* Side Bar */ +QTreeView.PageSelector::item { + min-height: 40px; +} + +QTreeView.PageSelector::item::selected { + border: 1px solid #37d; + background-color: #4b4b4b; + border-radius: 3px; + color: white; +} + +QTreeView.PageSelector::item::hover { + border: 1px solid #dbdbdb; + background-color: #626262; + border-radius: 3px; + color: white; +} + +/* Disabled */ +QWidget[enabled=false] { + background-color: #525252; +} + +/* Other Controls */ +QToolBar { + border: 1px solid #d3d3d3; +} + QGroupBox { - background-color: rgb(46, 46, 46); - border: 1px solid rgb(110, 110, 110); + background-color: #4b4b4b; + border: 1px solid #dbdbdb; border-radius: 5px; margin-top: 20px; } @@ -108,59 +165,65 @@ QGroupBox::title { padding: 10px 15px; } -QToolButton[autoRaise=false], QPushButton, QComboBox { - background-color: rgb(95, 95, 95); - border: 1px solid rgb(214, 214, 214); - border-radius: 5px; +QToolButton[autoRaise=false], +QToolBar:item, +QPushButton, +QComboBox { + background-color: #4b4b4b; + border: 1px solid #d3d3d3; + border-radius: 2px; padding: 4px; padding-right: 10px; } -QToolButton[autoRaise=false]:hover, QPushButton:hover, QComboBox:hover { - background-color: rgb(204, 204, 204); - border: 1px solid rgb(180, 180, 180); +QToolButton[autoRaise=false]:hover, +QPushButton:hover, +QComboBox:hover { + background-color: #4b4b4b; + border: 1px solid #b4b4b4; } -QToolButton[autoRaise=false]:pressed, QPushButton:pressed, QComboBox:pressed { - background-color: rgb(158, 158, 158); - border: 1px solid rgb(219, 219, 219); +QToolButton[autoRaise=false]:pressed, +QPushButton:pressed, +QComboBox:pressed { + background-color: #4b4b4b; + border: 1px solid #dbdbdb; } -QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, QPushButton::menu-indicator { +QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, +QPushButton::menu-indicator { subcontrol-origin: padding; subcontrol-position: center right; } QToolButton[autoRaise=true] { padding: 4px; - padding-right: 10px; + padding-right: 9px; } -QMenu { - background-color: rgb(61, 61, 61); - border-radius: 1px; - border: 1px outset rgb(90, 90, 90); +QMenu, +QComboBox QAbstractItemView { + font-size: 10pt; + background-color: #424242; + border-radius: 2px; + border: 1px solid #979797; + padding: 2px; } QMenu::item:selected { - background:rgb(115, 115, 115); - color:rgb(255, 255, 255); + background: #737373; + color: #ffffff; } -QComboBox{ - border:1px solid gray; - border-radius:3px; - padding: 5px; - min-width:40px; -} - -QComboBox::drop-down{ - subcontrol-origin:padding; - subcontrol-position:top right; +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; border: none; } -QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, QPushButton::menu-indicator, QComboBox::down-arrow { +QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, +QPushButton::menu-indicator, +QComboBox::down-arrow { image: url(:/icons/breeze-modmanager/16x16/go-down.svg); } @@ -168,20 +231,12 @@ QTreeView::item { min-height: 35px; } -QTreeView.PageSelector::item { - min-height: 40px; -} - -QTreeView.PageSelector::item::selected { - color: black; -} - .QTabWidget { border: none; } QTabBar { - background-color: rgb(39, 39, 39); + background-color: #525252; border-radius: 2px; margin: 2px; padding: none; @@ -199,12 +254,6 @@ QTabBar::tab { } QTabBar::tab:selected { - border: 1px solid gray; - background-color: rgb(66, 66, 66); -} - -QWidget[enabled=false] { - background-color: #5f5f5f; - border-color: #3f3f3f; - color: #afafaf; -} + border: 1px solid #777777; + background-color: #656565; +} \ No newline at end of file diff --git a/src/qss/light.qss b/src/qss/light.qss index 1434fb0c..2e5bff9c 100644 --- a/src/qss/light.qss +++ b/src/qss/light.qss @@ -1,49 +1,63 @@ -QWidget:focus{ +QWidget:focus { outline: none; } -Widget { - background-color: #ffffff; +QWidget { + color: black; } -QWidget[enabled=false] { - background-color: #cfcfcf; +/* DockWidget & Title */ +.QWidget, +QDialog, +QLineEdit, +QSpinBox, +QDoubleSpinBox { + background-color: #fafafa; } -QTextBrowser, QScrollArea, QScrollArea .QWidget { - background-color: transparent; - border-color: transparent; +/* Browser */ +Browser { + background-color: #fafafa; } -.ModList::item:hover { - border-left: 5px solid #eee; - background-color: #22eeeeee; +/* ModList inside */ +Browser .ModList { + background-color: #fafafa; } -.ModList::item:selected { - border-left: 5px solid #37d; - background-color: #223377dd; - color: black; +/* Tranparent */ +Browser .QWidget, +Browser .QWidget .QScrollArea, +QDockWidget .QWidget, +QDockWidget .QTextBrowser, +QDockWidget .QScrollArea, +QDockWidget .QToolButton, +QDockWidget .QLabel { + background-color: transparent; } -.GitHubReleaseItemWidget, .LocalModItemWidget { +/* Label Texts */ +.GitHubReleaseItemWidget, +.LocalModItemWidget { margin-left: 5px; } -.DateTimeText > * { - color: #777; +.DateTimeText>* { + color: #777777; font-size: 9pt; } .Title { - color: black; + color: #000000; font-weight: bold; font-size: 13pt; - background: transparent; + background-color: transparent; } -.CurseforgeFileListWidget .Title, .ModrinthFileListWidget .Title, -.GitHubFileListWidget .Title, .LocalFileListWidget .Title { +.CurseforgeFileListWidget .Title, +.ModrinthFileListWidget .Title, +.GitHubFileListWidget .Title, +.LocalFileListWidget .Title { font-size: 11pt; } @@ -53,35 +67,40 @@ QTextBrowser, QScrollArea, QScrollArea .QWidget { background: transparent; } -.GitHubReleaseItemWidget > .PreRelease { - color: #fff; +.GitHubReleaseItemWidget>.PreRelease { + color: #ffffff; background-color: #e7ab34; - border-radius:2px; - padding:1px 2px; + border-radius: 2px; + padding: 1px 2px; } -.GitHubReleaseItemWidget > .TagName { - color: gray; +.GitHubReleaseItemWidget>.TagName { + color: #777777; font-size: 10pt; } -.MenuButton, #maxButton, #minButton, #closeButton{ - border: none; +/* ModList */ +.ModList::item:hover { + border-left: 5px solid #eeeeee; + background-color: #22eeeeee; } -.MenuButton:hover { - background-color: rgb(165, 165, 165); - border: none; +.ModList::item:selected { + border-left: 5px solid #37d; + background-color: #223377dd; + color: black; } -.MenuButton:pressed { - background-color: rgb(110, 110, 110); - color: whitesmoke; +/* TitleBar Button */ +#maxButton, +#minButton, +#closeButton { border: none; } -#maxButton:hover,#minButton:hover { - background-color: rgb(218, 218, 218); +#maxButton:hover, +#minButton:hover { + background-color: #dbdbdb; border: none; } @@ -90,6 +109,49 @@ QTextBrowser, QScrollArea, QScrollArea .QWidget { border: none; } +/* TitleBar Menu */ +QMenuBar { + color: #777777; +} + +QMenuBar::item:selected { + background-color: #dbdbdb; +} + +QMenuBar::item:pressed { + background-color: #d3d3d3; + color: black; +} + +/* Side Bar */ +QTreeView.PageSelector::item { + min-height: 40px; +} + +QTreeView.PageSelector::item::selected { + border: 1px solid #37d; + background-color: #dbdbdb; + border-radius: 3px; + color: black; +} + +QTreeView.PageSelector::item::hover { + border: 1px solid #dbdbdb; + background-color: #eeeeee; + border-radius: 3px; + color: black; +} + +/* Disabled */ +QWidget[enabled=false] { + background-color: #cfcfcf; +} + +/* Other Controls */ +QToolBar { + border: 1px solid #d3d3d3; +} + QGroupBox { background-color: whitesmoke; border: 1px solid #dbdbdb; @@ -103,59 +165,65 @@ QGroupBox::title { padding: 10px 15px; } -QToolButton[autoRaise=false], QPushButton, QComboBox { +QToolButton[autoRaise=false], +QToolBar:item, +QPushButton, +QComboBox { background-color: whitesmoke; - border: 1px solid #dbdbdb; + border: 1px solid #d3d3d3; border-radius: 2px; padding: 4px; padding-right: 10px; } -QToolButton[autoRaise=false]:hover, QPushButton:hover, QComboBox:hover { - background-color: rgb(204, 204, 204); - border: 1px solid rgb(180, 180, 180); +QToolButton[autoRaise=false]:hover, +QPushButton:hover, +QComboBox:hover { + background-color: #cccccc; + border: 1px solid #b4b4b4; } -QToolButton[autoRaise=false]:pressed, QPushButton:pressed, QComboBox:pressed { - background-color: rgb(158, 158, 158); - border: 1px solid rgb(219, 219, 219); +QToolButton[autoRaise=false]:pressed, +QPushButton:pressed, +QComboBox:pressed { + background-color: #9e9e9e; + border: 1px solid #dbdbdb; } -QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, QPushButton::menu-indicator { +QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, +QPushButton::menu-indicator { subcontrol-origin: padding; subcontrol-position: center right; } QToolButton[autoRaise=true] { padding: 4px; - padding-right: 10px; + padding-right: 9px; } -QMenu { - background-color: white; - border-radius: 1px; - border: 1px outset rgb(151, 151, 151); +QMenu, +QComboBox QAbstractItemView { + font-size: 10pt; + background-color: #fafafa; + border-radius: 2px; + border: 1px solid #979797; + padding: 2px; } QMenu::item:selected { - background:rgb(115, 115, 115); - color:rgb(255, 255, 255); + background: #737373; + color: #ffffff; } -QComboBox{ - border:1px solid #dbdbdb; - border-radius: 2px; - padding: 5px; - min-width:40px; -} - -QComboBox::drop-down{ - subcontrol-origin:padding; - subcontrol-position:top right; +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; border: none; } -QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, QPushButton::menu-indicator, QComboBox::down-arrow { +QToolButton[autoRaise=false][popupMode="2"]::menu-indicator, +QPushButton::menu-indicator, +QComboBox::down-arrow { image: url(:/icons/breeze-modmanager/16x16/go-down.svg); } @@ -163,14 +231,6 @@ QTreeView::item { min-height: 35px; } -QTreeView.PageSelector::item { - min-height: 40px; -} - -QTreeView.PageSelector::item::selected { - color: black; -} - .QTabWidget { border: none; } @@ -194,6 +254,6 @@ QTabBar::tab { } QTabBar::tab:selected { - border: 1px solid gray; - background-color: white; -} + border: 1px solid #777777; + background-color: #ffffff; +} \ No newline at end of file diff --git a/src/ui/framelesswrapper.cpp b/src/ui/framelesswrapper.cpp index 25e32d0d..dcf3a78a 100644 --- a/src/ui/framelesswrapper.cpp +++ b/src/ui/framelesswrapper.cpp @@ -141,19 +141,3 @@ bool FramelessWrapper::nativeEvent(const QByteArray &eventType, void *message, l return false; } #endif //Q_OS_WIN - -void FramelessWrapper::paintEvent(QPaintEvent *event[[maybe_unused]]) -{ - if(!Config().getEnableBlurBehind()) return; - QPainter p(this); - p.setCompositionMode(QPainter::CompositionMode_DestinationIn); - for(auto &&widget : { titleBar_ }){ - if(!widget->isVisible()) continue; - auto rect = widget->rect(); - auto pos = widget->pos(); - pos.setX(pos.x() + contentsMargins().left()); - pos.setY(pos.y() + contentsMargins().top()); - rect.translate(pos); - p.fillRect(rect, QBrush(QColor(255, 255, 255, 215))); - } -} diff --git a/src/ui/framelesswrapper.h b/src/ui/framelesswrapper.h index acb0b3d6..42e54da2 100644 --- a/src/ui/framelesswrapper.h +++ b/src/ui/framelesswrapper.h @@ -22,7 +22,6 @@ private slots: #ifdef Q_OS_WIN virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); #endif //Q_OS_WIN - void paintEvent(QPaintEvent *event) override; private: WindowsTitleBar *titleBar_; diff --git a/src/ui/modmanager.cpp b/src/ui/modmanager.cpp index e221ddc2..6ba27e21 100644 --- a/src/ui/modmanager.cpp +++ b/src/ui/modmanager.cpp @@ -59,9 +59,9 @@ ModManager::ModManager(QWidget *parent) : Config config; enableBlurBehind_ = config_.getEnableBlurBehind(); ui->setupUi(this); - menuBar_ = ui->menubar; - if(Config().getUseFramelessWindow()) menuBar_->hide(); - ui->menubar = new QMenuBar(this); + menuBar_ = new QMenuBar(this); + menuBar_->addActions(ui->menubar->actions()); + menuBar_->hide(); setCentralWidget(&pageSwitcher_); DockWidgetContent::lockPanelsAction = ui->actionLock_Panels; restoreGeometry(config.getGeometry()); @@ -116,7 +116,6 @@ ModManager::ModManager(QWidget *parent) : mergeMenuBar(); updateUi(); - qApp->setStyleSheet(styleSheetPath(config_.getCustomStyle())); } ModManager::~ModManager() @@ -229,7 +228,7 @@ void ModManager::paintEvent(QPaintEvent *event[[maybe_unused]]) if(!widget->isVisible()) continue; auto rect = widget->rect(); rect.translate(widget->pos()); - p.fillRect(rect, QBrush(QColor(255, 255, 255, 191))); + p.fillRect(rect, QBrush(QColor(255, 255, 255, 210))); } } #endif //defined (DE_KDE) || defined (Q_OS_WIN) diff --git a/src/ui/windowstitlebar.cpp b/src/ui/windowstitlebar.cpp index ee265abe..d0fe6982 100644 --- a/src/ui/windowstitlebar.cpp +++ b/src/ui/windowstitlebar.cpp @@ -13,6 +13,8 @@ #include #endif +#include "config.hpp" + WindowsTitleBar::WindowsTitleBar(QWidget *parent, QMenuBar *menuBar) : QWidget(parent), ui(new Ui::WindowsTitleBar), @@ -20,6 +22,7 @@ WindowsTitleBar::WindowsTitleBar(QWidget *parent, QMenuBar *menuBar) : menuBar_(menuBar) { ui->setupUi(this); + setMouseTracking(true); ui->closeButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton)); ui->maxButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton)); ui->minButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton)); @@ -61,19 +64,13 @@ void WindowsTitleBar::setNormal() ui->maxButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton)); } -#ifdef Q_OS_WIN -void WindowsTitleBar::mouseMoveEvent(QMouseEvent *event) -{ - if(event->buttons()&Qt::LeftButton) - parentWidget_->move(event->pos() + parentWidget_->pos() - clickPos_); -} - -void WindowsTitleBar::mousePressEvent(QMouseEvent *event) +void WindowsTitleBar::paintEvent(QPaintEvent *event) { - if(event->button()==Qt::LeftButton) - clickPos_=event->pos(); + if(!Config().getEnableBlurBehind()) return; + QPainter p(this); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.fillRect(rect(), QBrush(QColor(255, 255, 255, 195))); } -#endif //Q_OS_WIN void WindowsTitleBar::on_closeButton_clicked() { diff --git a/src/ui/windowstitlebar.h b/src/ui/windowstitlebar.h index e71e3749..55fbaa42 100644 --- a/src/ui/windowstitlebar.h +++ b/src/ui/windowstitlebar.h @@ -29,10 +29,8 @@ public slots: void setNormal(); protected: -#ifdef Q_OS_WIN - void mouseMoveEvent(QMouseEvent *event) override; - void mousePressEvent(QMouseEvent *event) override; -#endif //Q_OS_WIN + void paintEvent(QPaintEvent *event) override; + private slots: void on_closeButton_clicked(); void on_maxButton_clicked(); diff --git a/src/ui/windowstitlebar.ui b/src/ui/windowstitlebar.ui index 6abb5611..282907ca 100644 --- a/src/ui/windowstitlebar.ui +++ b/src/ui/windowstitlebar.ui @@ -133,7 +133,7 @@ - 36 + 48 0 @@ -161,7 +161,7 @@ - 36 + 48 0 @@ -189,7 +189,7 @@ - 36 + 48 0