From a81e09bcd3dfe9f7e44db60f9feb02284155aa6b Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: ćšć, 14 12æ 2023 14:46:43 +0800 Subject: [PATCH] minor tweaks --- src/core/contexts/abstractwindowcontext.cpp | 16 ++++++++-------- LICENSE | 2 +- examples/mainwindow/mainwindow.cpp | 14 +++++++------- README.md | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index bb92241..406593a 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019-2023 Stdware Collections + Copyright 2021-2023 Stdware Collections Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 79ca919..c78e820 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,4 @@ ## License -QWindowKit is licensed under the Apache 2.0 License. \ No newline at end of file +QWindowKit is licensed under the [Apache 2.0 License](LICENSE). \ No newline at end of file diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 882dc9b..47c7791 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -169,18 +169,18 @@ #ifdef Q_OS_WINDOWS // Emulate Window system menu button behaviors - connect(iconButton, &QAbstractButton::clicked, agent, [this, iconButton, agent] { - setProperty("double-click-close", false); + connect(iconButton, &QAbstractButton::clicked, this, [iconButton, agent] { + iconButton->setProperty("double-click-close", false); // Pick a suitable time threshold - QTimer::singleShot(75, this, [this, iconButton, agent]() { - if (property("double-click-close").toBool()) + QTimer::singleShot(75, [iconButton, agent]() { + if (iconButton->property("double-click-close").toBool()) return; agent->showSystemMenu(iconButton->mapToGlobal({0, iconButton->height()})); }); }); - connect(iconButton, &QWK::WindowButton::doubleClicked, this, [this]() { - setProperty("double-click-close", true); + connect(iconButton, &QWK::WindowButton::doubleClicked, this, [iconButton, this]() { + iconButton->setProperty("double-click-close", true); close(); }); #endif @@ -195,7 +195,7 @@ // It's a Qt issue that if a QAbstractButton::clicked triggers a window's maximization, // the button remains to be hovered until the mouse move. As a result, we need to - // manully send leave events to the button. + // manually send leave events to the button. emulateLeaveEvent(maxButton); }); connect(windowBar, &QWK::WindowBar::closeRequested, this, &QWidget::close); diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index 155f0af..3b2340f 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -7,13 +7,6 @@ namespace QWK { - QWK_USED static constexpr const struct { - const quint32 activeLight = MAKE_RGBA_COLOR(210, 233, 189, 226); - const quint32 activeDark = MAKE_RGBA_COLOR(177, 205, 190, 240); - const quint32 inactiveLight = MAKE_RGBA_COLOR(193, 195, 211, 203); - const quint32 inactiveDark = MAKE_RGBA_COLOR(240, 240, 250, 255); - } kSampleColorSet; - AbstractWindowContext::AbstractWindowContext() = default; AbstractWindowContext::~AbstractWindowContext() = default; @@ -174,6 +167,13 @@ return {}; } + QWK_USED static constexpr const struct { + const quint32 activeLight = MAKE_RGBA_COLOR(210, 233, 189, 226); + const quint32 activeDark = MAKE_RGBA_COLOR(177, 205, 190, 240); + const quint32 inactiveLight = MAKE_RGBA_COLOR(193, 195, 211, 203); + const quint32 inactiveDark = MAKE_RGBA_COLOR(240, 240, 250, 255); + } kSampleColorSet; + void AbstractWindowContext::virtual_hook(int id, void *data) { switch (id) { case CentralizeHook: { @@ -195,7 +195,7 @@ map.insert(QStringLiteral("inactiveDark"), kSampleColorSet.inactiveDark); return; } - + default: break; } -- Gitblit v1.9.1