README.md | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/contexts/cocoawindowcontext.mm | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/contexts/win32windowcontext.cpp | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/kernel/systemwindow_p.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
README.md
@@ -31,7 +31,7 @@ | Component | Requirement | Details | |:---------:|:-----------:|:-------------------------:| | Qt | \>=5.15 | Core, Gui, Widgets, Quick | | Qt | \>=5.12 | Core, Gui, Widgets, Quick | | Compiler | \>=C++17 | MSVC 2019, GCC, Clang | | CMake | \>=3.17 | >=3.20 is recommended | @@ -140,9 +140,9 @@ agent->setSystemButton(QWK::WindowAgentBase::Maximize, myTitleBar->maxButton()); agent->setSystemButton(QWK::WindowAgentBase::Close, myTitleBar->closeButton()); ``` Doing this does not mean that these buttons' click events are automatically associated with window events, you still need to manually connect the signals and slots to emulate the native window's behaviors. Doing this does not mean that these buttons' click events are automatically associated with window actions, you still need to manually connect the signals and slots to emulate the native window behaviors. On macOS, this step can be skipped because it is more appropriate to use the buttons provided by the system. On macOS, this step can be skipped because it is better to use the buttons provided by the system. Last but not least, set hit-test visible hint to let `WidgetWindowAgent` know other widgets that desire to receive mouse events. @@ -156,7 +156,7 @@ ### Qt Quick Application Make sure you have registered QWK into QtQuick: Make sure you have registered `QWindowKit` into QtQuick: ```cpp #include <QWKQuick/qwkquickglobal.h> src/core/contexts/cocoawindowcontext.mm
@@ -369,12 +369,32 @@ void CocoaWindowContext::virtual_hook(int id, void *data) { switch (id) { case ShowSystemMenuHook: case ShowSystemMenuHook: { // TODO: mac system menu return; case SystemButtonAreaChangedHook: } case SystemButtonAreaChangedHook: { // TODO: mac system button rect updated return; } case WindowAttributeChangedHook: { auto args = static_cast<void **>(data); const auto &key = *static_cast<const QString *>(args[0]); const auto &newVar = *static_cast<const QVariant *>(args[1]); const auto &oldVar = *static_cast<const QVariant *>(args[2]); if (key == QStringLiteral("no-system-buttons")) { if (newVar.toBool()) { // TODO: set off } else { // TODO: set on } } break; } default: break; } src/core/contexts/win32windowcontext.cpp
src/core/kernel/systemwindow_p.h
@@ -45,7 +45,7 @@ target->setPosition(target->x(), 0); } target->removeEventFilter(this); this->deleteLater(); deleteLater(); } default: @@ -99,7 +99,7 @@ case QEvent::MouseButtonRelease: { target->removeEventFilter(this); this->deleteLater(); deleteLater(); } default: