From 230896e7dae9e97e3363947e72e70cca1f89911d Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周五, 08 12月 2023 22:47:07 +0800 Subject: [PATCH] port WIP system menu --- examples/mainwindow/mainwindow.cpp | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index ae7cd16..ce3d742 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -53,17 +53,19 @@ return menuBar; }(); - static const auto buttonStyleSheet = QLatin1String{ "QPushButton{color:black;};QPushButton:hover{background-color:black;color:white;}" }; - auto iconButton = new QPushButton("I"); - iconButton->setStyleSheet(buttonStyleSheet); + iconButton->setAttribute(Qt::WA_Hover); + iconButton->setMouseTracking(true); auto minButton = new QPushButton("鈥�"); - minButton->setStyleSheet(buttonStyleSheet); + minButton->setAttribute(Qt::WA_Hover); + minButton->setMouseTracking(true); auto maxButton = new QPushButton("馃棖"); - maxButton->setStyleSheet(buttonStyleSheet); maxButton->setCheckable(true); + maxButton->setAttribute(Qt::WA_Hover); + maxButton->setMouseTracking(true); auto closeButton = new QPushButton("鉁�"); - closeButton->setStyleSheet(buttonStyleSheet); + closeButton->setAttribute(Qt::WA_Hover); + closeButton->setMouseTracking(true); auto windowBar = new QWK::WindowBar(); windowBar->setIconButton(iconButton); @@ -97,5 +99,5 @@ setMenuWidget(windowBar); setCentralWidget(clockWidget); setWindowTitle("Example MainWindow"); - resize(1024, 768); + resize(640, 480); } -- Gitblit v1.9.1