Skip to content

Commit adc9161

Browse files
committed
Fix quick
1 parent 1a5462d commit adc9161

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ TODO
134134

135135
### Qt Widgets Application
136136

137+
#### Initialization
138+
139+
The following initialization should be done before any widget constructs.
140+
141+
```cpp
142+
#include <QWKQuick/qwkquickglobal.h>
143+
144+
int main(int argc, char *argv[])
145+
{
146+
QGuiApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
147+
148+
// ...
149+
}
150+
```
151+
137152
#### Setup Window Agent
138153
139154
First, setup `WidgetWindowAgent` for your top `QWidget` instance. (Each window needs its own agent.)
@@ -259,9 +274,8 @@ See [examples](examples) for more demo use cases. The examples have no High DPI
259274
### Vulnerabilities
260275

261276
+ Once you have made the window frameless, it will not be able to switch back to the system border.
262-
+ There must not be any child widget with `Qt::WA_NativeWindow` property enabled, otherwise the native features and display may be abnormal. Therefore, do not set any widget that has called `QWidget::winId()` or `QWidget::setAttribute(Qt::WA_NativeWindow)` as a descendant of a frameless window.
277+
+ There must not be any internal child widget with `Qt::WA_NativeWindow` property enabled, otherwise the native features and display may be abnormal. Therefore, do not set any widget that has called `QWidget::winId()` or `QWidget::setAttribute(Qt::WA_NativeWindow)` as a descendant of a frameless window.
263278
+ If you really need to move widgets between different windows, make sure that the widget is not a top-level window and wrap it with a frameless container.
264-
+ If you want to show a non-modal dialog as a child of a frameless window, you should call `QGuiApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings)` before the dialog constructs or in the very beginning in the main entry.
265279

266280
## TODO
267281

src/quick/quickwindowagent_win.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ namespace QWK {
7676

7777
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
7878
if (auto api = window()->rendererInterface()->graphicsApi();
79-
!(api == QSGRendererInterface::Direct3D11 || api == QSGRendererInterface::Direct3D12)) {
79+
!(api == QSGRendererInterface::Direct3D11
80+
81+
# if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
82+
|| api == QSGRendererInterface::Direct3D12
83+
# endif
84+
)) {
8085
# endif
8186
QRect rect(QPoint(0, 0), size().toSize());
8287
QRegion region(rect);

0 commit comments

Comments
 (0)