Sine Striker
2023-12-27 8a0b7831e988a347603e6abb4e8294010ab9b0e0
Set project version
4个文件已修改
33 ■■■■ 已修改文件
CMakeLists.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/quick/quickwindowagent_win.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetwindowagent_win.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.17)
project(QWindowKit VERSION 0.0.1.1 LANGUAGES CXX)
project(QWindowKit VERSION 2.5.1.1 LANGUAGES CXX)
# ----------------------------------
# Build Options
README.md
@@ -65,6 +65,23 @@
## Integrate
### Configure Options
+ `QWINDOWKIT_BUILD_DOCUMENTATIONS`
    + If you have installed `Doxygen`, you can **enable** this option so that the documentations will also be built and installed.
    + If not, you can read the comments in *qdoc* style in `cpp` files to get detailed usages of the public APIs.
+ `QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS`
    + If you don't want the system borders on Windows 10/11, you can **disable** this option.
    + If so, the Windows 10 top border issue will disappear. However, part of the client edge area will be occupied as the resizing margins.
+ `QWINDOWKIT_ENABLE_QT_WINDOW_CONTEXT`
    + If you want to use pure Qt emulated frameless implementation, you can **enable** this option.
    + If so, all system native features will be lost.
+ `QWINDOWKIT_ENABLE_STYLE_AGENT`
    + Select whether to exclude the style component by **disabling** this option according to your requirements and your Qt version.
### Build & Install
```sh
@@ -162,13 +179,11 @@
agent->setSystemButton(QWK::WindowAgentBase::Close, myTitleBar->closeButton());
```
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.
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 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.
Last but not least, set hit-test visible hint to let `WidgetWindowAgent` know other widgets that desire to receive mouse events.
```c++
agent->setHitTestVisible(myTitleBar->menuBar(), true);
@@ -233,12 +248,12 @@
See [examples](examples) for more demo use cases. The examples have no High DPI support.
+ QWindowKit Internals [TODO]
+ [FramelessHelper Related](docs/framelesshelper-related.md)
## TODO
+ Fix 5.15 window abnormal behavior
+ Support Mac style change notification
+ Support Mac system buttons customization for Quick
+ More documentations
+ When do we support Linux native features?
src/quick/quickwindowagent_win.cpp
@@ -101,6 +101,7 @@
    bool BorderItem::nativeEventFilter(const QByteArray &eventType, void *message,
                                       QT_NATIVE_EVENT_RESULT_TYPE *result) {
        Q_UNUSED(eventType)
        const auto msg = static_cast<const MSG *>(message);
        switch (msg->message) {
            case WM_THEMECHANGED:
@@ -125,6 +126,7 @@
    bool BorderItem::sharedEventFilter(QObject *obj, QEvent *event) {
        Q_UNUSED(obj)
        switch (event->type()) {
            case QEvent::WindowStateChange: {
                updateGeometry();
src/widgets/widgetwindowagent_win.cpp
@@ -44,7 +44,7 @@
            static QVariant defaultMargins = QVariant::fromValue(QMargins(0, 1, 0, 0));
            ctx->setWindowAttribute(QStringLiteral("extra-margins"), defaultMargins);
            // Enable dark mode by default, otherwise the frame borders are white
            // Enable dark mode by default, otherwise the system borders are white
            ctx->setWindowAttribute(QStringLiteral("dark-mode"), true);
            ctx->installNativeEventFilter(this);
@@ -119,6 +119,7 @@
        bool nativeEventFilter(const QByteArray &eventType, void *message,
                               QT_NATIVE_EVENT_RESULT_TYPE *result) override {
            Q_UNUSED(eventType)
            const auto msg = static_cast<const MSG *>(message);
            switch (msg->message) {
                case WM_DPICHANGED: {
@@ -163,6 +164,7 @@
        bool eventFilter(QObject *obj, QEvent *event) override {
            Q_UNUSED(obj)
            switch (event->type()) {
                case QEvent::UpdateRequest: {
                    if (!isNormalWindow())