From 05fedeedb28df769ce16efea39be1cc5e2916b98 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <zhaoyuhang@rankyee.com> Date: 周三, 06 12月 2023 14:13:01 +0800 Subject: [PATCH] minor tweaks --- examples/mainwindow/mainwindow.cpp | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index ae7cd16..adcf6cd 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -53,16 +53,41 @@ return menuBar; }(); - static const auto buttonStyleSheet = QLatin1String{ "QPushButton{color:black;};QPushButton:hover{background-color:black;color:white;}" }; + static const auto buttonStyleSheet = QLatin1String{ R"( +QPushButton { + background-color:white; + color:black; +} +QPushButton:hover { + background-color:black; + color:white; +} +QPushButton:pressed { + background-color:red; + color:white; +} +)" }; auto iconButton = new QPushButton("I"); + iconButton->setFlat(true); + iconButton->setAttribute(Qt::WA_Hover); + iconButton->setMouseTracking(true); iconButton->setStyleSheet(buttonStyleSheet); auto minButton = new QPushButton("鈥�"); + minButton->setFlat(true); + minButton->setAttribute(Qt::WA_Hover); + minButton->setMouseTracking(true); minButton->setStyleSheet(buttonStyleSheet); auto maxButton = new QPushButton("馃棖"); - maxButton->setStyleSheet(buttonStyleSheet); maxButton->setCheckable(true); + maxButton->setFlat(true); + maxButton->setAttribute(Qt::WA_Hover); + maxButton->setMouseTracking(true); + maxButton->setStyleSheet(buttonStyleSheet); auto closeButton = new QPushButton("鉁�"); + closeButton->setFlat(true); + closeButton->setAttribute(Qt::WA_Hover); + closeButton->setMouseTracking(true); closeButton->setStyleSheet(buttonStyleSheet); auto windowBar = new QWK::WindowBar(); @@ -97,5 +122,5 @@ setMenuWidget(windowBar); setCentralWidget(clockWidget); setWindowTitle("Example MainWindow"); - resize(1024, 768); + resize(640, 480); } -- Gitblit v1.9.1