Sine Striker
2023-12-20 a5372ac566469efb59e6cfb29a695021c7c3528d
Add TODO
4个文件已修改
42 ■■■■ 已修改文件
README.md 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/cocoawindowcontext.mm 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/kernel/systemwindow_p.h 6 ●●●● 补丁 | 查看 | 原始文档 | 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;
        }
@@ -386,7 +406,7 @@
        if (!m_windowHandle) {
            return;
        }
        windowId = m_windowHandle->winId();
        ensureWindowProxy(windowId)->setSystemTitleBarVisible(false);
        cocoaWindowEventFilter = std::make_unique<CocoaWindowEventFilter>(this, this);
src/core/contexts/win32windowcontext.cpp
@@ -902,7 +902,7 @@
                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-frame-shadow")) {
                    if (newVar.toBool()) {
                        // TODO: set off
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:
@@ -120,7 +120,7 @@
    // QWindow::startSystemMove() and QWindow::startSystemResize() is first supported at Qt 5.15
    // QWindow::startSystemResize() returns false on macOS
    // QWindow::startSystemMove() and QWindow::startSystemResize() returns false on Linux Unity DE
    // When the new API fails, we emulate the window actions using the classical API.
    static inline void startSystemMove(QWindow *window) {