Sine Striker
2023-12-14 a81e09bcd3dfe9f7e44db60f9feb02284155aa6b
minor tweaks
4个文件已修改
32 ■■■■ 已修改文件
LICENSE 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/mainwindow/mainwindow.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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.
README.md
@@ -43,4 +43,4 @@
## License
QWindowKit is licensed under the Apache 2.0 License.
QWindowKit is licensed under the [Apache 2.0 License](LICENSE).
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);
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: {