| | |
| | | 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. |
| | |
| | | |
| | | ## License |
| | | |
| | | QWindowKit is licensed under the Apache 2.0 License. |
| | | QWindowKit is licensed under the [Apache 2.0 License](LICENSE). |
| | |
| | | |
| | | #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 |
| | |
| | | |
| | | // 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); |
| | |
| | | |
| | | 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; |
| | |
| | | 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: { |
| | |
| | | map.insert(QStringLiteral("inactiveDark"), kSampleColorSet.inactiveDark); |
| | | return; |
| | | } |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |