Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qwindow.h"
5
6#include <qpa/qplatformwindow.h>
7#include <qpa/qplatformintegration.h>
8#ifndef QT_NO_CONTEXTMENU
9#include <qpa/qplatformtheme.h>
10#endif
11#include "qsurfaceformat.h"
12#ifndef QT_NO_OPENGL
13#include <qpa/qplatformopenglcontext.h>
14#include "qopenglcontext.h"
15#include "qopenglcontext_p.h"
16#endif
17#include "qscreen.h"
18
19#include "qwindow_p.h"
20#include "qguiapplication_p.h"
21#if QT_CONFIG(accessibility)
22# include "qaccessible.h"
23#endif
24#include "qhighdpiscaling_p.h"
25#if QT_CONFIG(draganddrop)
27#endif // QT_CONFIG(draganddrop)
28
29#include <private/qevent_p.h>
30
31#include <QtCore/QTimer>
32#include <QtCore/QDebug>
33
34#include <QStyleHints>
35#include <qpa/qplatformcursor.h>
36#include <qpa/qplatformwindow_p.h>
37
39
126QWindow::QWindow(QScreen *targetScreen)
129{
130 Q_D(QWindow);
131 d->init(targetScreen);
132}
133
135{
136 if (parent && parent->type() == Qt::Desktop) {
137 qWarning("QWindows cannot be reparented into desktop windows");
138 return nullptr;
139 }
140
141 return parent;
142}
143
154QWindow::QWindow(QWindow *parent)
155 : QWindow(*new QWindowPrivate(), parent)
156{
157}
158
171QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
174{
175 Q_D(QWindow);
176 d->init();
177}
178
182QWindow::~QWindow()
183{
184 Q_D(QWindow);
185 d->destroy();
189
190 // thse are normally cleared in destroy(), but the window may in
191 // some cases end up becoming the focus window again, or receive an enter
192 // event. Clear it again here as a workaround. See QTBUG-75326.
199
200 d->isWindow = false;
201}
202
204 = default;
205
207 = default;
208
209void QWindowPrivate::init(QScreen *targetScreen)
210{
211 Q_Q(QWindow);
212
213 isWindow = true;
214 parentWindow = static_cast<QWindow *>(q->QObject::parent());
215
216 QScreen *connectScreen = targetScreen ? targetScreen : QGuiApplication::primaryScreen();
217
218 if (!parentWindow)
219 connectToScreen(connectScreen);
220
221 // If your application aborts here, you are probably creating a QWindow
222 // before the screen list is populated.
224 qFatal("Cannot create window: no screens available");
225 }
227
229 devicePixelRatio = connectScreen->devicePixelRatio();
230}
231
281QWindow::Visibility QWindow::visibility() const
282{
283 Q_D(const QWindow);
284 return d->visibility;
285}
286
287void QWindow::setVisibility(Visibility v)
288{
289 switch (v) {
290 case Hidden:
291 hide();
292 break;
293 case AutomaticVisibility:
294 show();
295 break;
296 case Windowed:
297 showNormal();
298 break;
299 case Minimized:
301 break;
302 case Maximized:
304 break;
305 case FullScreen:
307 break;
308 default:
309 Q_ASSERT(false);
310 }
311}
312
313/*
314 Subclasses may override this function to run custom setVisible
315 logic. Subclasses that do so must call the base class implementation
316 at some point to make the native window visible, and must not
317 call QWindow::setVisble() since that will recurse back here.
318*/
320{
321 Q_Q(QWindow);
322
323 if (this->visible != visible) {
324 this->visible = visible;
325 emit q->visibleChanged(visible);
327 } else if (platformWindow) {
328 // Visibility hasn't changed, and the platform window is in sync
329 return;
330 }
331
332 if (!platformWindow) {
333 // If we have a parent window, but the parent hasn't been created yet, we
334 // can defer creation until the parent is created or we're re-parented.
335 if (parentWindow && !parentWindow->handle())
336 return;
337
338 // We only need to create the window if it's being shown
339 if (visible) {
340 // FIXME: At this point we've already updated the visible state of
341 // the QWindow, so if the platform layer reads the window state during
342 // creation, and reflects that in the native window, it will end up
343 // with a visible window. This may in turn result in resize or expose
344 // events from the platform before we have sent the show event below.
345 q->create();
346 }
347 }
348
349 if (visible) {
350 // remove posted quit events when showing a new window
352
353 if (q->type() == Qt::Window) {
355 QString &firstWindowTitle = app_priv->firstWindowTitle;
356 if (!firstWindowTitle.isEmpty()) {
357 q->setTitle(firstWindowTitle);
358 firstWindowTitle = QString();
359 }
360 if (!app_priv->forcedWindowIcon.isNull())
361 q->setIcon(app_priv->forcedWindowIcon);
362
363 // Handling of the -qwindowgeometry, -geometry command line arguments
364 static bool geometryApplied = false;
365 if (!geometryApplied) {
366 geometryApplied = true;
368 }
369 }
370
371 QShowEvent showEvent;
372 QGuiApplication::sendEvent(q, &showEvent);
373 }
374
375 if (q->isModal()) {
376 if (visible)
378 else
380 // QShapedPixmapWindow is used on some platforms for showing a drag pixmap, so don't block
381 // input to this window as it is performing a drag - QTBUG-63846
383#if QT_CONFIG(draganddrop)
384 && !qobject_cast<QShapedPixmapWindow *>(q)
385#endif // QT_CONFIG(draganddrop)
386 ) {
388 }
389
390#ifndef QT_NO_CURSOR
392 applyCursor();
393#endif
394
395 if (platformWindow)
397
398 if (!visible) {
399 QHideEvent hideEvent;
400 QGuiApplication::sendEvent(q, &hideEvent);
401 }
402}
403
405{
406 Q_Q(QWindow);
407
408 QWindow::Visibility old = visibility;
409
410 if (!visible)
411 visibility = QWindow::Hidden;
413 visibility = QWindow::Minimized;
415 visibility = QWindow::FullScreen;
417 visibility = QWindow::Maximized;
418 else
419 visibility = QWindow::Windowed;
420
421 if (visibility != old)
422 emit q->visibilityChanged(visibility);
423}
424
426{
427 Q_Q(QWindow);
428
429 if (!q->parent())
430 return;
431
432 QObjectList &siblings = q->parent()->d_ptr->children;
433
434 const qsizetype siblingCount = siblings.size() - 1;
435 if (siblingCount == 0)
436 return;
437
438 const qsizetype currentPosition = siblings.indexOf(q);
439 Q_ASSERT(currentPosition >= 0);
440
441 const qsizetype targetPosition = position == PositionTop ? siblingCount : 0;
442
443 if (currentPosition == targetPosition)
444 return;
445
446 siblings.move(currentPosition, targetPosition);
447}
448
450{
451 Q_Q(const QWindow);
452 const QScreen *oldScreen = q->screen();
453 return oldScreen != newScreen && (platformWindow || !oldScreen)
454 && !(oldScreen && oldScreen->virtualSiblings().contains(newScreen));
455}
456
458{
459 if (topLevelScreen)
460 topLevelScreen = nullptr;
461}
462
464{
467}
468
470{
471 Q_Q(QWindow);
472 emit q->screenChanged(newScreen);
473 for (QObject *child : q->children()) {
474 if (child->isWindowType())
475 static_cast<QWindow *>(child)->d_func()->emitScreenChangedRecursion(newScreen);
476 }
477}
478
479void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate)
480{
481 Q_Q(QWindow);
482 if (parentWindow) {
483 qWarning() << q << '(' << newScreen << "): Attempt to set a screen on a child window.";
484 return;
485 }
486 if (newScreen != topLevelScreen) {
487 const bool shouldRecreate = recreate && windowRecreationRequired(newScreen);
488 const bool shouldShow = visibilityOnDestroy && !topLevelScreen;
489 if (shouldRecreate && platformWindow)
490 q->destroy();
491 connectToScreen(newScreen);
492 if (shouldShow)
493 q->setVisible(true);
494 else if (newScreen && shouldRecreate)
495 create(true);
497 }
498}
499
500void QWindowPrivate::create(bool recursive, WId nativeHandle)
501{
502 Q_Q(QWindow);
503 if (platformWindow)
504 return;
505
506 // avoid losing update requests when re-creating
507 const bool needsUpdate = updateRequestPending;
508 // the platformWindow, if there was one, is now gone, so make this flag reflect reality now
509 updateRequestPending = false;
510
511 if (q->parent())
512 q->parent()->create();
513
514 // QPlatformWindow will poll geometry() during construction below. Set the
515 // screen here so that high-dpi scaling will use the correct scale factor.
516 if (q->isTopLevel()) {
519 }
520
522 platformWindow = nativeHandle ? platformIntegration->createForeignWindow(q, nativeHandle)
523 : platformIntegration->createPlatformWindow(q);
525
526 if (!platformWindow) {
527 qWarning() << "Failed to create platform window for" << q << "with flags" << q->flags();
528 return;
529 }
530
532
533 QObjectList childObjects = q->children();
534 for (int i = 0; i < childObjects.size(); i ++) {
535 QObject *object = childObjects.at(i);
536 if (!object->isWindowType())
537 continue;
538
539 QWindow *childWindow = static_cast<QWindow *>(object);
540 if (recursive)
541 childWindow->d_func()->create(recursive);
542
543 // The child may have had deferred creation due to this window not being created
544 // at the time setVisible was called, so we re-apply the visible state, which
545 // may result in creating the child, and emitting the appropriate signals.
546 if (childWindow->isVisible())
547 childWindow->setVisible(true);
548
549 if (QPlatformWindow *childPlatformWindow = childWindow->d_func()->platformWindow)
550 childPlatformWindow->setParent(this->platformWindow);
551 }
552
555
557
558 if (needsUpdate)
559 q->requestUpdate();
560}
561
563{
564}
565
566// Allows for manipulating the suggested geometry before a resize/move
567// event in derived classes for platforms that support it, for example to
568// implement heightForWidth().
570{
571 Q_UNUSED(rect);
572 return QRectF();
573}
574
576 qxp::function_ref<void()> funcWidthChanged,
577 qxp::function_ref<void()> funcHeightChanged)
578{
579 Q_Q(QWindow);
580 Q_ASSERT(oldSizeMember);
581 const QSize adjustedSize =
583 if (*oldSizeMember == adjustedSize)
584 return;
585 const bool widthChanged = adjustedSize.width() != oldSizeMember->width();
586 const bool heightChanged = adjustedSize.height() != oldSizeMember->height();
587 *oldSizeMember = adjustedSize;
588
589 if (platformWindow && q->isTopLevel())
591
592 if (widthChanged)
593 funcWidthChanged();
594 if (heightChanged)
595 funcHeightChanged();
596
597 // resize window if current size is outside of min and max limits
600 q->resize(q->geometry().size().expandedTo(minimumSize).boundedTo(maximumSize));
601 }
602}
603
617void QWindow::setSurfaceType(SurfaceType surfaceType)
618{
619 Q_D(QWindow);
620 d->surfaceType = surfaceType;
621}
622
629{
630 Q_D(const QWindow);
631 return d->surfaceType;
632}
633
652void QWindow::setVisible(bool visible)
653{
654 Q_D(QWindow);
655
656 d->setVisible(visible);
657}
658
659bool QWindow::isVisible() const
660{
661 Q_D(const QWindow);
662
663 return d->visible;
664}
665
680void QWindow::create()
681{
682 Q_D(QWindow);
683 d->create(false);
684}
685
696WId QWindow::winId() const
697{
698 Q_D(const QWindow);
699
700 if (!d->platformWindow)
701 const_cast<QWindow *>(this)->create();
702
703 return d->platformWindow->winId();
704}
705
716QWindow *QWindow::parent(AncestorMode mode) const
717{
718 Q_D(const QWindow);
719 return d->parentWindow ? d->parentWindow : (mode == IncludeTransients ? transientParent() : nullptr);
720}
721
732void QWindow::setParent(QWindow *parent)
733{
735
736 Q_D(QWindow);
737 if (d->parentWindow == parent)
738 return;
739
740 QScreen *newScreen = parent ? parent->screen() : screen();
741 if (d->windowRecreationRequired(newScreen)) {
742 qWarning() << this << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')';
743 return;
744 }
745
747 d->parentWindow = parent;
748
749 if (parent)
750 d->disconnectFromScreen();
751 else
752 d->connectToScreen(newScreen);
753
754 // If we were set visible, but not created because we were a child, and we're now
755 // re-parented into a created parent, or to being a top level, we need re-apply the
756 // visibility state, which will also create.
757 if (isVisible() && (!parent || parent->handle()))
758 setVisible(true);
759
760 if (d->platformWindow) {
761 if (parent)
762 parent->create();
763
764 d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : nullptr);
765 }
766
768}
769
773bool QWindow::isTopLevel() const
774{
775 Q_D(const QWindow);
776 return d->parentWindow == nullptr;
777}
778
786bool QWindow::isModal() const
787{
788 Q_D(const QWindow);
789 return d->modality != Qt::NonModal;
790}
791
804{
805 Q_D(const QWindow);
806 return d->modality;
807}
808
809void QWindow::setModality(Qt::WindowModality modality)
810{
811 Q_D(QWindow);
812 if (d->modality == modality)
813 return;
814 d->modality = modality;
816}
817
849void QWindow::setFormat(const QSurfaceFormat &format)
850{
851 Q_D(QWindow);
852 d->requestedFormat = format;
853}
854
865QSurfaceFormat QWindow::requestedFormat() const
866{
867 Q_D(const QWindow);
868 return d->requestedFormat;
869}
870
889{
890 Q_D(const QWindow);
891 if (d->platformWindow)
892 return d->platformWindow->format();
893 return d->requestedFormat;
894}
895
909void QWindow::setFlags(Qt::WindowFlags flags)
910{
911 Q_D(QWindow);
912 if (d->windowFlags == flags)
913 return;
914
915 if (d->platformWindow)
916 d->platformWindow->setWindowFlags(flags);
917 d->windowFlags = flags;
918}
919
920Qt::WindowFlags QWindow::flags() const
921{
922 Q_D(const QWindow);
923 Qt::WindowFlags flags = d->windowFlags;
924
925 if (d->platformWindow && d->platformWindow->isForeignWindow())
927
928 return flags;
929}
930
939void QWindow::setFlag(Qt::WindowType flag, bool on)
940{
941 Q_D(QWindow);
942 if (on)
943 setFlags(d->windowFlags | flag);
944 else
945 setFlags(d->windowFlags & ~flag);
946}
947
956Qt::WindowType QWindow::type() const
957{
958 return static_cast<Qt::WindowType>(int(flags() & Qt::WindowType_Mask));
959}
960
973{
974 Q_D(QWindow);
975 bool changed = false;
976 if (d->windowTitle != title) {
977 d->windowTitle = title;
978 changed = true;
979 }
980 if (d->platformWindow && type() != Qt::Desktop)
981 d->platformWindow->setWindowTitle(title);
982 if (changed)
983 emit windowTitleChanged(title);
984}
985
987{
988 Q_D(const QWindow);
989 return d->windowTitle;
990}
991
999void QWindow::setFilePath(const QString &filePath)
1000{
1001 Q_D(QWindow);
1002 d->windowFilePath = filePath;
1003 if (d->platformWindow)
1004 d->platformWindow->setWindowFilePath(filePath);
1005}
1006
1012QString QWindow::filePath() const
1013{
1014 Q_D(const QWindow);
1015 return d->windowFilePath;
1016}
1017
1029void QWindow::setIcon(const QIcon &icon)
1030{
1031 Q_D(QWindow);
1032 d->windowIcon = icon;
1033 if (d->platformWindow)
1034 d->platformWindow->setWindowIcon(icon);
1037}
1038
1044QIcon QWindow::icon() const
1045{
1046 Q_D(const QWindow);
1047 if (d->windowIcon.isNull())
1049 return d->windowIcon;
1050}
1051
1058{
1059 Q_D(QWindow);
1060
1061 d->updateSiblingPosition(QWindowPrivate::PositionTop);
1062
1063 if (d->platformWindow)
1064 d->platformWindow->raise();
1065}
1066
1073{
1074 Q_D(QWindow);
1075
1076 d->updateSiblingPosition(QWindowPrivate::PositionBottom);
1077
1078 if (d->platformWindow)
1079 d->platformWindow->lower();
1080}
1081
1100bool QWindow::startSystemResize(Qt::Edges edges)
1101{
1102 Q_D(QWindow);
1103 if (Q_UNLIKELY(!isVisible() || !d->platformWindow || d->maximumSize == d->minimumSize))
1104 return false;
1105
1106 const bool isSingleEdge = edges == Qt::TopEdge || edges == Qt::RightEdge || edges == Qt::BottomEdge || edges == Qt::LeftEdge;
1107 const bool isCorner =
1108 edges == (Qt::TopEdge | Qt::LeftEdge) ||
1109 edges == (Qt::TopEdge | Qt::RightEdge) ||
1110 edges == (Qt::BottomEdge | Qt::RightEdge) ||
1111 edges == (Qt::BottomEdge | Qt::LeftEdge);
1112
1113 if (Q_UNLIKELY(!isSingleEdge && !isCorner)) {
1114 qWarning() << "Invalid edges" << edges << "passed to QWindow::startSystemResize, ignoring.";
1115 return false;
1116 }
1117
1118 return d->platformWindow->startSystemResize(edges);
1119}
1120
1139{
1140 Q_D(QWindow);
1141 if (Q_UNLIKELY(!isVisible() || !d->platformWindow))
1142 return false;
1143
1144 return d->platformWindow->startSystemMove();
1145}
1146
1161void QWindow::setOpacity(qreal level)
1162{
1163 Q_D(QWindow);
1164 if (level == d->opacity)
1165 return;
1166 d->opacity = level;
1167 if (d->platformWindow) {
1168 d->platformWindow->setOpacity(level);
1169 emit opacityChanged(level);
1170 }
1171}
1172
1173qreal QWindow::opacity() const
1174{
1175 Q_D(const QWindow);
1176 return d->opacity;
1177}
1178
1189void QWindow::setMask(const QRegion &region)
1190{
1191 Q_D(QWindow);
1192 if (d->platformWindow)
1193 d->platformWindow->setMask(QHighDpi::toNativeLocalRegion(region, this));
1194 d->mask = region;
1195}
1196
1203QRegion QWindow::mask() const
1204{
1205 Q_D(const QWindow);
1206 return d->mask;
1207}
1208
1214void QWindow::requestActivate()
1215{
1216 Q_D(QWindow);
1218 qWarning() << "requestActivate() called for " << this << " which has Qt::WindowDoesNotAcceptFocus set.";
1219 return;
1220 }
1221 if (d->platformWindow)
1222 d->platformWindow->requestActivateWindow();
1223}
1224
1236bool QWindow::isExposed() const
1237{
1238 Q_D(const QWindow);
1239 return d->exposed;
1240}
1241
1262bool QWindow::isActive() const
1263{
1264 Q_D(const QWindow);
1265 if (!d->platformWindow)
1266 return false;
1267
1269
1270 // Means the whole application lost the focus
1271 if (!focus)
1272 return false;
1273
1274 if (focus == this)
1275 return true;
1276
1277 if (QWindow *p = parent(IncludeTransients))
1278 return p->isActive();
1279 else
1280 return isAncestorOf(focus);
1281}
1282
1302void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
1303{
1304 Q_D(QWindow);
1305 if (d->contentOrientation == orientation)
1306 return;
1307 if (d->platformWindow)
1308 d->platformWindow->handleContentOrientationChange(orientation);
1309 d->contentOrientation = orientation;
1310 emit contentOrientationChanged(orientation);
1311}
1312
1314{
1315 Q_D(const QWindow);
1316 return d->contentOrientation;
1317}
1318
1331qreal QWindow::devicePixelRatio() const
1332{
1333 Q_D(const QWindow);
1334 return d->devicePixelRatio;
1335}
1336
1337/*
1338 Updates the cached devicePixelRatio value by polling for a new value.
1339 Sends QEvent::DevicePixelRatioChange to the window if the DPR has changed.
1340*/
1342{
1343 Q_Q(QWindow);
1344
1345 // If there is no platform window use the associated screen's devicePixelRatio,
1346 // which typically is the primary screen and will be correct for single-display
1347 // systems (a very common case).
1348 const qreal newDevicePixelRatio = platformWindow ?
1349 platformWindow->devicePixelRatio() * QHighDpiScaling::factor(q) : q->screen()->devicePixelRatio();
1350
1351 if (newDevicePixelRatio == devicePixelRatio)
1352 return;
1353
1354 devicePixelRatio = newDevicePixelRatio;
1355 QEvent dprChangeEvent(QEvent::DevicePixelRatioChange);
1356 QGuiApplication::sendEvent(q, &dprChangeEvent);
1357}
1358
1360{
1362 return Qt::WindowMinimized;
1363 else if (state & Qt::WindowFullScreen)
1364 return Qt::WindowFullScreen;
1365 else if (state & Qt::WindowMaximized)
1366 return Qt::WindowMaximized;
1367 return Qt::WindowNoState;
1368}
1369
1380void QWindow::setWindowState(Qt::WindowState state)
1381{
1382 setWindowStates(state);
1383}
1384
1401void QWindow::setWindowStates(Qt::WindowStates state)
1402{
1403 Q_D(QWindow);
1404 if (state & Qt::WindowActive) {
1405 qWarning("QWindow::setWindowStates does not accept Qt::WindowActive");
1406 state &= ~Qt::WindowActive;
1407 }
1408
1409 if (d->platformWindow)
1410 d->platformWindow->setWindowState(state);
1411
1412 auto originalEffectiveState = QWindowPrivate::effectiveState(d->windowState);
1413 d->windowState = state;
1414 auto newEffectiveState = QWindowPrivate::effectiveState(d->windowState);
1415 if (newEffectiveState != originalEffectiveState)
1416 emit windowStateChanged(newEffectiveState);
1417
1418 d->updateVisibility();
1419}
1420
1426Qt::WindowState QWindow::windowState() const
1427{
1428 Q_D(const QWindow);
1429 return QWindowPrivate::effectiveState(d->windowState);
1430}
1431
1443Qt::WindowStates QWindow::windowStates() const
1444{
1445 Q_D(const QWindow);
1446 return d->windowState;
1447}
1448
1471void QWindow::setTransientParent(QWindow *parent)
1472{
1473 Q_D(QWindow);
1474 if (parent && !parent->isTopLevel()) {
1475 qWarning() << parent << "must be a top level window.";
1476 return;
1477 }
1478 if (parent == this) {
1479 qWarning() << "transient parent" << parent << "cannot be same as window";
1480 return;
1481 }
1482
1483 d->transientParent = parent;
1484
1486 emit transientParentChanged(parent);
1487}
1488
1489QWindow *QWindow::transientParent() const
1490{
1491 Q_D(const QWindow);
1492 return d->transientParent.data();
1493}
1494
1495/*
1496 The setter for the QWindow::transientParent property.
1497 The only reason this exists is to set the transientParentPropertySet flag
1498 so that Qt Quick knows whether it was set programmatically (because of
1499 Window declaration context) or because the user set the property.
1500*/
1502{
1503 Q_Q(QWindow);
1504 q->setTransientParent(parent);
1506}
1507
1522bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const
1523{
1524 if (child->parent() == this || (mode == IncludeTransients && child->transientParent() == this))
1525 return true;
1526
1527 if (QWindow *parent = child->parent(mode)) {
1528 if (isAncestorOf(parent, mode))
1529 return true;
1530 } else if (handle() && child->handle()) {
1531 if (handle()->isAncestorOf(child->handle()))
1532 return true;
1533 }
1534
1535 return false;
1536}
1537
1543QSize QWindow::minimumSize() const
1544{
1545 Q_D(const QWindow);
1546 return d->minimumSize;
1547}
1548
1554QSize QWindow::maximumSize() const
1555{
1556 Q_D(const QWindow);
1557 return d->maximumSize;
1558}
1559
1565QSize QWindow::baseSize() const
1566{
1567 Q_D(const QWindow);
1568 return d->baseSize;
1569}
1570
1576QSize QWindow::sizeIncrement() const
1577{
1578 Q_D(const QWindow);
1579 return d->sizeIncrement;
1580}
1581
1589void QWindow::setMinimumSize(const QSize &size)
1590{
1591 Q_D(QWindow);
1592 d->setMinOrMaxSize(
1593 &d->minimumSize, size, [this, d]() { emit minimumWidthChanged(d->minimumSize.width()); },
1594 [this, d]() { emit minimumHeightChanged(d->minimumSize.height()); });
1595}
1596
1602{
1603 Q_D(QWindow);
1604 if (x() != arg)
1605 setGeometry(QRect(arg, y(), width(), height()));
1606 else
1607 d->positionAutomatic = false;
1608}
1609
1615{
1616 Q_D(QWindow);
1617 if (y() != arg)
1618 setGeometry(QRect(x(), arg, width(), height()));
1619 else
1620 d->positionAutomatic = false;
1621}
1622
1628{
1629 if (width() != arg)
1630 resize(arg, height());
1631}
1632
1638{
1639 if (height() != arg)
1640 resize(width(), arg);
1641}
1642
1648{
1649 setMinimumSize(QSize(w, minimumHeight()));
1650}
1651
1657{
1658 setMinimumSize(QSize(minimumWidth(), h));
1659}
1660
1668void QWindow::setMaximumSize(const QSize &size)
1669{
1670 Q_D(QWindow);
1671 d->setMinOrMaxSize(
1672 &d->maximumSize, size, [this, d]() { emit maximumWidthChanged(d->maximumSize.width()); },
1673 [this, d]() { emit maximumHeightChanged(d->maximumSize.height()); });
1674}
1675
1681{
1682 setMaximumSize(QSize(w, maximumHeight()));
1683}
1684
1690{
1691 setMaximumSize(QSize(maximumWidth(), h));
1692}
1693
1702void QWindow::setBaseSize(const QSize &size)
1703{
1704 Q_D(QWindow);
1705 if (d->baseSize == size)
1706 return;
1707 d->baseSize = size;
1708 if (d->platformWindow && isTopLevel())
1709 d->platformWindow->propagateSizeHints();
1710}
1711
1726void QWindow::setSizeIncrement(const QSize &size)
1727{
1728 Q_D(QWindow);
1729 if (d->sizeIncrement == size)
1730 return;
1731 d->sizeIncrement = size;
1732 if (d->platformWindow && isTopLevel())
1733 d->platformWindow->propagateSizeHints();
1734}
1735
1744void QWindow::setGeometry(int posx, int posy, int w, int h)
1745{
1746 setGeometry(QRect(posx, posy, w, h));
1747}
1748
1757{
1758 Q_D(QWindow);
1759 d->positionAutomatic = false;
1760 const QRect oldRect = geometry();
1761 if (rect == oldRect)
1762 return;
1763
1764 d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
1765 if (d->platformWindow) {
1766 QScreen *newScreen = d->screenForGeometry(rect);
1767 if (newScreen && isTopLevel())
1768 d->setTopLevelScreen(newScreen, true);
1769 d->platformWindow->setGeometry(QHighDpi::toNativeWindowGeometry(rect, this));
1770 } else {
1771 d->geometry = rect;
1772
1773 if (rect.x() != oldRect.x())
1774 emit xChanged(rect.x());
1775 if (rect.y() != oldRect.y())
1776 emit yChanged(rect.y());
1777 if (rect.width() != oldRect.width())
1778 emit widthChanged(rect.width());
1779 if (rect.height() != oldRect.height())
1780 emit heightChanged(rect.height());
1781 }
1782}
1783
1784/*
1785 This is equivalent to QPlatformWindow::screenForGeometry, but in platform
1786 independent coordinates. The duplication is unfortunate, but there is a
1787 chicken and egg problem here: we cannot convert to native coordinates
1788 before we know which screen we are on.
1789*/
1791{
1792 Q_Q(const QWindow);
1793 QScreen *currentScreen = q->screen();
1794 QScreen *fallback = currentScreen;
1795 QPoint center = newGeometry.center();
1796 if (!q->parent() && currentScreen && !currentScreen->geometry().contains(center)) {
1797 const auto screens = currentScreen->virtualSiblings();
1798 for (QScreen* screen : screens) {
1799 if (screen->geometry().contains(center))
1800 return screen;
1801 if (screen->geometry().intersects(newGeometry))
1802 fallback = screen;
1803 }
1804 }
1805 return fallback;
1806}
1807
1808
1816QRect QWindow::geometry() const
1817{
1818 Q_D(const QWindow);
1819 if (d->platformWindow) {
1820 const auto nativeGeometry = d->platformWindow->geometry();
1821 return QHighDpi::fromNativeWindowGeometry(nativeGeometry, this);
1822 }
1823 return d->geometry;
1824}
1825
1831QMargins QWindow::frameMargins() const
1832{
1833 Q_D(const QWindow);
1834 if (d->platformWindow)
1835 return QHighDpi::fromNativePixels(d->platformWindow->frameMargins(), this);
1836 return QMargins();
1837}
1838
1846QRect QWindow::frameGeometry() const
1847{
1848 Q_D(const QWindow);
1849 if (d->platformWindow) {
1850 QMargins m = frameMargins();
1851 return QHighDpi::fromNativeWindowGeometry(d->platformWindow->geometry(), this).adjusted(-m.left(), -m.top(), m.right(), m.bottom());
1852 }
1853 return d->geometry;
1854}
1855
1863QPoint QWindow::framePosition() const
1864{
1865 Q_D(const QWindow);
1866 if (d->platformWindow) {
1867 QMargins margins = frameMargins();
1868 return QHighDpi::fromNativeWindowGeometry(d->platformWindow->geometry().topLeft(), this) - QPoint(margins.left(), margins.top());
1869 }
1870 return d->geometry.topLeft();
1871}
1872
1880void QWindow::setFramePosition(const QPoint &point)
1881{
1882 Q_D(QWindow);
1883 d->positionPolicy = QWindowPrivate::WindowFrameInclusive;
1884 d->positionAutomatic = false;
1885 if (d->platformWindow) {
1886 d->platformWindow->setGeometry(QHighDpi::toNativeWindowGeometry(QRect(point, size()), this));
1887 } else {
1888 d->geometry.moveTopLeft(point);
1889 }
1890}
1891
1906void QWindow::setPosition(const QPoint &pt)
1907{
1908 setGeometry(QRect(pt, size()));
1909}
1910
1918void QWindow::setPosition(int posx, int posy)
1919{
1920 setPosition(QPoint(posx, posy));
1921}
1922
1949void QWindow::resize(int w, int h)
1950{
1951 resize(QSize(w, h));
1952}
1953
1959void QWindow::resize(const QSize &newSize)
1960{
1961 Q_D(QWindow);
1962 d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
1963 if (d->platformWindow) {
1964 d->platformWindow->setGeometry(
1965 QHighDpi::toNativeWindowGeometry(QRect(position(), newSize), this));
1966 } else {
1967 const QSize oldSize = d->geometry.size();
1968 d->geometry.setSize(newSize);
1969 if (newSize.width() != oldSize.width())
1970 emit widthChanged(newSize.width());
1971 if (newSize.height() != oldSize.height())
1972 emit heightChanged(newSize.height());
1973 }
1974}
1975
1981void QWindow::destroy()
1982{
1983 Q_D(QWindow);
1984 if (!d->platformWindow)
1985 return;
1986
1987 if (d->platformWindow->isForeignWindow())
1988 return;
1989
1990 d->destroy();
1991}
1992
1994{
1995 if (!platformWindow)
1996 return;
1997
1998 Q_Q(QWindow);
1999 QObjectList childrenWindows = q->children();
2000 for (int i = 0; i < childrenWindows.size(); i++) {
2001 QObject *object = childrenWindows.at(i);
2002 if (object->isWindowType()) {
2003 QWindow *w = static_cast<QWindow*>(object);
2005 }
2006 }
2007
2008 bool wasVisible = q->isVisible();
2009 visibilityOnDestroy = wasVisible && platformWindow;
2010
2011 q->setVisible(false);
2012
2013 // Let subclasses act, typically by doing graphics resource cleaup, when
2014 // the window, to which graphics resource may be tied, is going away.
2015 //
2016 // NB! This is dysfunctional when destroy() is invoked from the dtor since
2017 // a reimplemented event() will not get called in the subclasses at that
2018 // stage. However, the typical QWindow cleanup involves either close() or
2019 // going through QWindowContainer, both of which will do an explicit, early
2020 // destroy(), which is good here.
2021
2024
2025 // Unset platformWindow before deleting, so that the destructor of the
2026 // platform window does not recurse back into the platform window via
2027 // this window during destruction (e.g. as a result of platform events).
2028 delete std::exchange(platformWindow, nullptr);
2029
2036
2037 for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i)
2040
2041 resizeEventPending = true;
2042 receivedExpose = false;
2043 exposed = false;
2044}
2045
2051QPlatformWindow *QWindow::handle() const
2052{
2053 Q_D(const QWindow);
2054 return d->platformWindow;
2055}
2056
2063{
2064 Q_D(const QWindow);
2065 return d->platformWindow;
2066}
2067
2078bool QWindow::setKeyboardGrabEnabled(bool grab)
2079{
2080 Q_D(QWindow);
2081 if (d->platformWindow)
2082 return d->platformWindow->setKeyboardGrabEnabled(grab);
2083 return false;
2084}
2085
2095bool QWindow::setMouseGrabEnabled(bool grab)
2096{
2097 Q_D(QWindow);
2098 if (d->platformWindow)
2099 return d->platformWindow->setMouseGrabEnabled(grab);
2100 return false;
2101}
2102
2110QScreen *QWindow::screen() const
2111{
2112 Q_D(const QWindow);
2113 return d->parentWindow ? d->parentWindow->screen() : d->topLevelScreen.data();
2114}
2115
2129void QWindow::setScreen(QScreen *newScreen)
2130{
2131 Q_D(QWindow);
2132 if (!newScreen)
2133 newScreen = QGuiApplication::primaryScreen();
2134 d->setTopLevelScreen(newScreen, newScreen != nullptr);
2135}
2136
2150QAccessibleInterface *QWindow::accessibleRoot() const
2151{
2152 return nullptr;
2153}
2154
2169{
2170 return const_cast<QWindow *>(this);
2171}
2172
2182{
2184 if (defaultState == Qt::WindowFullScreen)
2186 else if (defaultState == Qt::WindowMaximized)
2187 showMaximized();
2188 else
2189 showNormal();
2190}
2191
2200{
2201 setVisible(false);
2202}
2203
2213{
2214 setWindowStates(Qt::WindowMinimized);
2215 setVisible(true);
2216}
2217
2227{
2228 setWindowStates(Qt::WindowMaximized);
2229 setVisible(true);
2230}
2231
2244{
2245 setWindowStates(Qt::WindowFullScreen);
2246 setVisible(true);
2247#if !defined Q_OS_QNX // On QNX this window will be activated anyway from libscreen
2248 // activating it here before libscreen activates it causes problems
2249 requestActivate();
2250#endif
2251}
2252
2262{
2263 setWindowStates(Qt::WindowNoState);
2264 setVisible(true);
2265}
2266
2277{
2278 Q_D(QWindow);
2279 if (d->inClose)
2280 return true;
2281
2282 // Do not close non top level windows
2283 if (!isTopLevel())
2284 return false;
2285
2286 if (!d->platformWindow)
2287 return true;
2288
2289 // The window might be deleted during close,
2290 // as a result of delivering the close event.
2291 QPointer guard(this);
2292 d->inClose = true;
2293 bool success = d->platformWindow->close();
2294 if (guard)
2295 d->inClose = false;
2296
2297 return success;
2298}
2299
2301{
2302 Q_Q(const QWindow);
2303
2304 if (!q->isTopLevel())
2305 return false;
2306
2307 // Tool-tip widgets do not normally have Qt::WA_QuitOnClose,
2308 // but since we do not have a similar flag for non-widget
2309 // windows we need an explicit exclusion here as well.
2310 if (q->type() == Qt::ToolTip)
2311 return false;
2312
2313 // A window with a transient parent is not a primary window,
2314 // it's a secondary window.
2315 if (q->transientParent())
2316 return false;
2317
2318 return true;
2319}
2320
2322{
2323 Q_Q(const QWindow);
2324 return q->isVisible();
2325}
2326
2346{
2347 ev->ignore();
2348}
2349
2365{
2366 ev->ignore();
2367}
2368
2373{
2374 ev->ignore();
2375}
2376
2385{
2386 ev->ignore();
2387}
2388
2398{
2399 ev->ignore();
2400}
2401
2409{
2410 ev->ignore();
2411}
2412
2422{
2423 Q_UNUSED(ev);
2424}
2425
2434{
2435 switch (ev->type()) {
2436 case QEvent::MouseMove:
2437 mouseMoveEvent(static_cast<QMouseEvent*>(ev));
2438 break;
2439
2441 mousePressEvent(static_cast<QMouseEvent*>(ev));
2442 break;
2443
2445 mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
2446 break;
2447
2449 mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
2450 break;
2451
2452 case QEvent::TouchBegin:
2454 case QEvent::TouchEnd:
2456 touchEvent(static_cast<QTouchEvent *>(ev));
2457 break;
2458
2459 case QEvent::Move:
2460 moveEvent(static_cast<QMoveEvent*>(ev));
2461 break;
2462
2463 case QEvent::Resize:
2464 resizeEvent(static_cast<QResizeEvent*>(ev));
2465 break;
2466
2467 case QEvent::KeyPress:
2468 keyPressEvent(static_cast<QKeyEvent *>(ev));
2469 break;
2470
2471 case QEvent::KeyRelease:
2472 keyReleaseEvent(static_cast<QKeyEvent *>(ev));
2473 break;
2474
2475 case QEvent::FocusIn: {
2476 focusInEvent(static_cast<QFocusEvent *>(ev));
2477#if QT_CONFIG(accessibility)
2479 state.active = true;
2480 QAccessibleStateChangeEvent event(this, state);
2481 QAccessible::updateAccessibility(&event);
2482#endif
2483 break; }
2484
2485 case QEvent::FocusOut: {
2486 focusOutEvent(static_cast<QFocusEvent *>(ev));
2487#if QT_CONFIG(accessibility)
2489 state.active = true;
2490 QAccessibleStateChangeEvent event(this, state);
2491 QAccessible::updateAccessibility(&event);
2492#endif
2493 break; }
2494
2495#if QT_CONFIG(wheelevent)
2496 case QEvent::Wheel:
2497 wheelEvent(static_cast<QWheelEvent*>(ev));
2498 break;
2499#endif
2500
2501 case QEvent::Close: {
2502
2503 Q_D(QWindow);
2504 const bool wasVisible = d->treatAsVisible();
2505 const bool participatesInLastWindowClosed = d->participatesInLastWindowClosed();
2506
2507 // The window might be deleted in the close event handler
2508 QPointer<QWindow> deletionGuard(this);
2509 closeEvent(static_cast<QCloseEvent*>(ev));
2510
2511 if (ev->isAccepted()) {
2512 if (deletionGuard)
2513 destroy();
2514 if (wasVisible && participatesInLastWindowClosed)
2516 }
2517
2518 break;
2519 }
2520
2521 case QEvent::Expose:
2522 exposeEvent(static_cast<QExposeEvent *>(ev));
2523 break;
2524
2525 case QEvent::Paint:
2526 paintEvent(static_cast<QPaintEvent *>(ev));
2527 break;
2528
2529 case QEvent::Show:
2530 showEvent(static_cast<QShowEvent *>(ev));
2531 break;
2532
2533 case QEvent::Hide:
2534 hideEvent(static_cast<QHideEvent *>(ev));
2535 break;
2536
2538 setIcon(icon());
2539 break;
2540
2541#if QT_CONFIG(tabletevent)
2543 case QEvent::TabletMove:
2545 tabletEvent(static_cast<QTabletEvent *>(ev));
2546 break;
2547#endif
2548
2550 if ((static_cast<QPlatformSurfaceEvent *>(ev))->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) {
2551#ifndef QT_NO_OPENGL
2553 if (context && context->surface() == static_cast<QSurface *>(this))
2554 context->doneCurrent();
2555#endif
2556 }
2557 break;
2558 }
2559
2560 default:
2561 return QObject::event(ev);
2562 }
2563
2564#ifndef QT_NO_CONTEXTMENU
2565 /*
2566 QGuiApplicationPrivate::processContextMenuEvent blocks mouse-triggered
2567 context menu events that the QPA plugin might generate. In practice that
2568 never happens, as even on Windows WM_CONTEXTMENU is never generated by
2569 the OS (we never call the default window procedure that would do that in
2570 response to unhandled WM_RBUTTONUP).
2571
2572 So, we always have to syntheize QContextMenuEvent for mouse events anyway.
2573 QWidgetWindow synthesizes QContextMenuEvent similar to this code, and
2574 never calls QWindow::event, so we have to do it here as well.
2575
2576 This logic could be simplified by always synthesizing events in
2577 QGuiApplicationPrivate, or perhaps even in each QPA plugin. See QTBUG-93486.
2578 */
2579 static const QEvent::Type contextMenuTrigger =
2582 auto asMouseEvent = [](QEvent *ev) {
2583 const auto t = ev->type();
2585 ? static_cast<QMouseEvent *>(ev) : nullptr ;
2586 };
2587 if (QMouseEvent *me = asMouseEvent(ev); me &&
2588 ev->type() == contextMenuTrigger && me->button() == Qt::RightButton) {
2589 QContextMenuEvent e(QContextMenuEvent::Mouse, me->position().toPoint(),
2590 me->globalPosition().toPoint(), me->modifiers());
2592 }
2593#endif
2594 return true;
2595}
2596
2624void QWindow::requestUpdate()
2625{
2627 "QWindow", "Updates can only be scheduled from the GUI (main) thread");
2628
2629 Q_D(QWindow);
2630 if (d->updateRequestPending || !d->platformWindow)
2631 return;
2632 d->updateRequestPending = true;
2633 d->platformWindow->requestUpdate();
2634}
2635
2642{
2643 ev->ignore();
2644}
2645
2652{
2653 ev->ignore();
2654}
2655
2664{
2665 ev->ignore();
2666}
2667
2676{
2677 ev->ignore();
2678}
2679
2686{
2687 ev->ignore();
2688}
2689
2696{
2697 ev->ignore();
2698}
2699
2706{
2707 ev->ignore();
2708}
2709
2714{
2715 ev->ignore();
2716}
2717
2718#if QT_CONFIG(wheelevent)
2722void QWindow::wheelEvent(QWheelEvent *ev)
2723{
2724 ev->ignore();
2725}
2726#endif // QT_CONFIG(wheelevent)
2727
2732{
2733 ev->ignore();
2734}
2735
2736#if QT_CONFIG(tabletevent)
2743void QWindow::tabletEvent(QTabletEvent *ev)
2744{
2745 ev->ignore();
2746}
2747#endif
2748
2759{
2760 Q_UNUSED(eventType);
2763 return false;
2764}
2765
2776QPointF QWindow::mapToGlobal(const QPointF &pos) const
2777{
2778 Q_D(const QWindow);
2779 // QTBUG-43252, prefer platform implementation for foreign windows.
2780 if (d->platformWindow
2781 && (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
2782 return QHighDpi::fromNativeGlobalPosition(d->platformWindow->mapToGlobalF(QHighDpi::toNativeLocalPosition(pos, this)), this);
2783 }
2784
2786 return pos + d->globalPosition();
2787
2788 // The normal pos + windowGlobalPos calculation may give a point which is outside
2789 // screen geometry for windows which span multiple screens, due to the way QHighDpiScaling
2790 // creates gaps between screens in the the device indendent cooordinate system.
2791 //
2792 // Map the position (and the window's global position) to native coordinates, perform
2793 // the addition, and then map back to device independent coordinates.
2794 QPointF nativeLocalPos = QHighDpi::toNativeLocalPosition(pos, this);
2795 QPointF nativeWindowGlobalPos = QHighDpi::toNativeGlobalPosition(QPointF(d->globalPosition()), this);
2796 QPointF nativeGlobalPos = nativeLocalPos + nativeWindowGlobalPos;
2797 QPointF deviceIndependentGlobalPos = QHighDpi::fromNativeGlobalPosition(nativeGlobalPos, this);
2798 return deviceIndependentGlobalPos;
2799}
2800
2804QPoint QWindow::mapToGlobal(const QPoint &pos) const
2805{
2806 return mapToGlobal(QPointF(pos)).toPoint();
2807}
2808
2818QPointF QWindow::mapFromGlobal(const QPointF &pos) const
2819{
2820 Q_D(const QWindow);
2821 // QTBUG-43252, prefer platform implementation for foreign windows.
2822 if (d->platformWindow
2823 && (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
2824 return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobalF(QHighDpi::toNativeGlobalPosition(pos, this)), this);
2825 }
2826
2828 return pos - d->globalPosition();
2829
2830 // Calculate local position in the native coordinate system. (See comment for the
2831 // corresponding mapToGlobal() code above).
2832 QPointF nativeGlobalPos = QHighDpi::toNativeGlobalPosition(pos, this);
2833 QPointF nativeWindowGlobalPos = QHighDpi::toNativeGlobalPosition(QPointF(d->globalPosition()), this);
2834 QPointF nativeLocalPos = nativeGlobalPos - nativeWindowGlobalPos;
2835 QPointF deviceIndependentLocalPos = QHighDpi::fromNativeLocalPosition(nativeLocalPos, this);
2836 return deviceIndependentLocalPos;
2837}
2838
2842QPoint QWindow::mapFromGlobal(const QPoint &pos) const
2843{
2844 return QWindow::mapFromGlobal(QPointF(pos)).toPoint();
2845}
2846
2848{
2849 Q_Q(const QWindow);
2850 QPoint offset = q->position();
2851 for (const QWindow *p = q->parent(); p; p = p->parent()) {
2852 QPlatformWindow *pw = p->handle();
2853 if (pw && (pw->isForeignWindow() || pw->isEmbedded())) {
2854 // Use mapToGlobal() for foreign windows
2855 offset += p->mapToGlobal(QPoint(0, 0));
2856 break;
2857 } else {
2858 offset += p->position();
2859 }
2860 }
2861 return offset;
2862}
2863
2865{
2866 return window->d_func();
2867}
2868
2869QWindow *QWindowPrivate::topLevelWindow(QWindow::AncestorMode mode) const
2870{
2871 Q_Q(const QWindow);
2872
2873 QWindow *window = const_cast<QWindow *>(q);
2874
2875 while (window) {
2876 QWindow *parent = window->parent(mode);
2877 if (!parent)
2878 break;
2879
2880 window = parent;
2881 }
2882
2883 return window;
2884}
2885
2907QWindow *QWindow::fromWinId(WId id)
2908{
2910 qWarning("QWindow::fromWinId(): platform plugin does not support foreign windows.");
2911 return nullptr;
2912 }
2913
2914 QWindow *window = new QWindow;
2915 qt_window_private(window)->create(false, id);
2916
2917 if (!window->handle()) {
2918 delete window;
2919 return nullptr;
2920 }
2921
2922 return window;
2923}
2924
2936void QWindow::alert(int msec)
2937{
2938 Q_D(QWindow);
2939 if (!d->platformWindow || d->platformWindow->isAlertState() || isActive())
2940 return;
2941 d->platformWindow->setAlertState(true);
2942 if (d->platformWindow->isAlertState() && msec)
2943 QTimer::singleShot(msec, this, SLOT(_q_clearAlert()));
2944}
2945
2947{
2950}
2951
2952#ifndef QT_NO_CURSOR
2973void QWindow::setCursor(const QCursor &cursor)
2974{
2975 Q_D(QWindow);
2976 d->setCursor(&cursor);
2977}
2978
2982void QWindow::unsetCursor()
2983{
2984 Q_D(QWindow);
2985 d->setCursor(nullptr);
2986}
2987
2993QCursor QWindow::cursor() const
2994{
2995 Q_D(const QWindow);
2996 return d->cursor;
2997}
2998
3000{
3001
3002 Q_Q(QWindow);
3003 if (newCursor) {
3004 const Qt::CursorShape newShape = newCursor->shape();
3005 if (newShape <= Qt::LastCursor && hasCursor && newShape == cursor.shape())
3006 return; // Unchanged and no bitmap/custom cursor.
3007 cursor = *newCursor;
3008 hasCursor = true;
3009 } else {
3010 if (!hasCursor)
3011 return;
3013 hasCursor = false;
3014 }
3015 // Only attempt to emit signal if there is an actual platform cursor
3016 if (applyCursor()) {
3019 }
3020}
3021
3022// Apply the cursor and returns true iff the platform cursor exists
3024{
3025 Q_Q(QWindow);
3026 if (QScreen *screen = q->screen()) {
3027 if (QPlatformCursor *platformCursor = screen->handle()->cursor()) {
3028 if (!platformWindow)
3029 return true;
3031 if (c != nullptr && platformCursor->capabilities().testFlag(QPlatformCursor::OverrideCursor))
3032 return true;
3033 if (!c && hasCursor)
3034 c = &cursor;
3035 platformCursor->changeCursor(c, q);
3036 return true;
3037 }
3038 }
3039 return false;
3040}
3041#endif // QT_NO_CURSOR
3042
3043void *QWindow::resolveInterface(const char *name, int revision) const
3044{
3045 using namespace QNativeInterface::Private;
3046
3047 auto *platformWindow = handle();
3048 Q_UNUSED(platformWindow);
3049 Q_UNUSED(name);
3050 Q_UNUSED(revision);
3051
3052#if defined(Q_OS_WIN)
3054#endif
3055
3056#if QT_CONFIG(xcb)
3058#endif
3059
3060#if defined(Q_OS_MACOS)
3062#endif
3063
3064#if defined(Q_OS_UNIX)
3065 QT_NATIVE_INTERFACE_RETURN_IF(QWaylandWindow, platformWindow);
3066#endif
3067
3068#if defined(Q_OS_WASM)
3070#endif
3071
3072 return nullptr;
3073}
3074
3075#ifndef QT_NO_DEBUG_STREAM
3077{
3078 QDebugStateSaver saver(debug);
3079 debug.nospace();
3080 if (window) {
3081 debug << window->metaObject()->className() << '(' << (const void *)window;
3082 if (!window->objectName().isEmpty())
3083 debug << ", name=" << window->objectName();
3084 if (debug.verbosity() > 2) {
3085 const QRect geometry = window->geometry();
3086 if (window->isVisible())
3087 debug << ", visible";
3088 if (window->isExposed())
3089 debug << ", exposed";
3090 debug << ", state=" << window->windowState()
3091 << ", type=" << window->type() << ", flags=" << window->flags()
3092 << ", surface type=" << window->surfaceType();
3093 if (window->isTopLevel())
3094 debug << ", toplevel";
3095 debug << ", " << geometry.width() << 'x' << geometry.height()
3096 << Qt::forcesign << geometry.x() << geometry.y() << Qt::noforcesign;
3097 const QMargins margins = window->frameMargins();
3098 if (!margins.isNull())
3099 debug << ", margins=" << margins;
3100 debug << ", devicePixelRatio=" << window->devicePixelRatio();
3101 if (const QPlatformWindow *platformWindow = window->handle())
3102 debug << ", winId=0x" << Qt::hex << platformWindow->winId() << Qt::dec;
3103 if (const QScreen *screen = window->screen())
3104 debug << ", on " << screen->name();
3105 }
3106 debug << ')';
3107 } else {
3108 debug << "QWindow(0x0)";
3109 }
3110 return debug;
3111}
3112#endif // !QT_NO_DEBUG_STREAM
3113
3114#if QT_CONFIG(vulkan) || defined(Q_QDOC)
3115
3121void QWindow::setVulkanInstance(QVulkanInstance *instance)
3122{
3123 Q_D(QWindow);
3124 d->vulkanInstance = instance;
3125}
3126
3130QVulkanInstance *QWindow::vulkanInstance() const
3131{
3132 Q_D(const QWindow);
3133 return d->vulkanInstance;
3134}
3135
3136#endif // QT_CONFIG(vulkan)
3137
3139
3140#include "moc_qwindow.cpp"
\inmodule QtGui
\inmodule QtCore
Definition qbytearray.h:57
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:561
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:593
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void removePostedEvents(QObject *receiver, int eventType=0)
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
Qt::CursorShape shape() const
Returns the cursor shape identifier.
Definition qcursor.cpp:499
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
@ TabletMove
Definition qcoreevent.h:121
@ DevicePixelRatioChange
Definition qcoreevent.h:287
@ ApplicationWindowIconChange
Definition qcoreevent.h:90
@ FocusOut
Definition qcoreevent.h:67
@ CursorChange
Definition qcoreevent.h:228
@ KeyRelease
Definition qcoreevent.h:65
@ MouseMove
Definition qcoreevent.h:63
@ KeyPress
Definition qcoreevent.h:64
@ FocusIn
Definition qcoreevent.h:66
@ TouchCancel
Definition qcoreevent.h:264
@ MouseButtonPress
Definition qcoreevent.h:60
@ TouchUpdate
Definition qcoreevent.h:242
@ TouchBegin
Definition qcoreevent.h:241
@ TabletRelease
Definition qcoreevent.h:127
@ WindowIconChange
Definition qcoreevent.h:89
@ PlatformSurface
Definition qcoreevent.h:278
@ TabletPress
Definition qcoreevent.h:126
@ MouseButtonDblClick
Definition qcoreevent.h:62
@ MouseButtonRelease
Definition qcoreevent.h:61
Type type() const
Returns the event type.
Definition qcoreevent.h:299
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition qcoreevent.h:306
bool isAccepted() const
Definition qcoreevent.h:303
The QExposeEvent class contains event parameters for expose events. \inmodule QtGui.
Definition qevent.h:514
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:469
static void updateBlockedStatus(QWindow *window)
static QWindow * currentMousePressWindow
static void showModalWindow(QWindow *window)
static void hideModalWindow(QWindow *window)
static QPlatformIntegration * platformIntegration()
static QWindowList window_list
static QList< TabletPointData > tabletDevicePoints
static QGuiApplicationPrivate * instance()
static QWindow * currentMouseWindow
static QWindow * focus_window
static void applyWindowGeometrySpecificationTo(QWindow *window)
static QPlatformTheme * platformTheme()
static QWindow * modalWindow()
Returns the most recently shown modal window.
QScreen * primaryScreen
the primary (or default) screen of the application.
static QCursor * overrideCursor()
Returns the active application override cursor.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
QIcon windowIcon
the default window icon
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition qevent.h:585
static bool isActive()
static qreal factor(C *context)
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition qicon.cpp:973
The QKeyEvent class describes a key event.
Definition qevent.h:423
qsizetype size() const noexcept
Definition qlist.h:386
bool removeOne(const AT &t)
Definition qlist.h:581
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
void move(qsizetype from, qsizetype to)
Definition qlist.h:593
qsizetype removeAll(const AT &t)
Definition qlist.h:575
void prepend(rvalue_ref t)
Definition qlist.h:456
\inmodule QtCore
Definition qmargins.h:23
constexpr bool isNull() const noexcept
Returns true if all margins are is 0; otherwise returns false.
Definition qmargins.h:107
constexpr int left() const noexcept
Returns the left margin.
Definition qmargins.h:110
constexpr int top() const noexcept
Returns the top margin.
Definition qmargins.h:113
\inmodule QtGui
Definition qevent.h:195
The QMoveEvent class contains event parameters for move events.
Definition qevent.h:501
uint isWindow
Definition qobject.h:70
QObject * parent
Definition qobject.h:61
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition qobject.cpp:1363
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2142
QThread * thread() const
Returns the thread in which the object lives.
Definition qobject.cpp:1561
\inmodule QtGui
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:485
The QPlatformCursor class provides information about pointer device events (movement,...
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const
virtual QPlatformWindow * createForeignWindow(QWindow *, WId) const
virtual QPlatformWindow * createPlatformWindow(QWindow *window) const =0
Factory function for QPlatformWindow.
virtual QPlatformCursor * cursor() const
Reimplement this function in subclass to return the cursor of the screen.
The QPlatformSurfaceEvent class is used to notify about native platform surface events....
Definition qevent.h:530
The QPlatformSurface class provides an abstraction for a surface.
virtual QVariant themeHint(ThemeHint hint) const
The QPlatformWindow class provides an abstraction for top-level windows.
virtual bool isAlertState() const
Reimplement this method return whether the window is in an alert state.
virtual void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
virtual void initialize()
Called as part of QWindow::create(), after constructing the window.
virtual void propagateSizeHints()
Reimplement to propagate the size hints of the QWindow.
virtual void setAlertState(bool enabled)
Reimplement this method to set whether the window demands attention (for example, by flashing the tas...
virtual bool isEmbedded() const
Returns true if the window is a child of a non-Qt window.
virtual qreal devicePixelRatio() const
Reimplement this function in subclass to return the device pixel ratio for the window.
virtual QPoint mapToGlobal(const QPoint &pos) const
Translates the window coordinate pos to global screen coordinates using native methods.
virtual bool isForeignWindow() const
\inmodule QtCore\reentrant
Definition qpoint.h:214
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
Definition qpoint.h:394
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore
Definition qpointer.h:18
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore\reentrant
Definition qrect.h:30
bool intersects(const QRect &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e., there is at least one pixel...
Definition qrect.cpp:1065
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:238
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qrect.cpp:851
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:187
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
Definition qrect.h:232
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:547
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
qreal devicePixelRatio
the screen's ratio between physical pixels and device-independent pixels
Definition qscreen.h:59
QList< QScreen * > virtualSiblings() const
Get the screen's virtual siblings.
Definition qscreen.cpp:357
QRect geometry
the screen's geometry in pixels
Definition qscreen.h:45
QString name
a user presentable string representing the screen
Definition qscreen.h:36
QPlatformScreen * handle() const
Get the platform screen handle.
Definition qscreen.cpp:83
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:577
\inmodule QtCore
Definition qsize.h:25
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition qsize.h:196
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:132
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:129
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition qsize.h:191
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
static QSurfaceFormat defaultFormat()
Returns the global default surface format.
\inmodule QtGui
Definition qsurface.h:21
virtual QPlatformSurface * surfaceHandle() const =0
Returns a handle to the platform-specific implementation of the surface.
SurfaceType
The SurfaceType enum describes what type of surface this is.
Definition qsurface.h:30
static QThread * currentThread()
Definition qthread.cpp:966
bool singleShot
whether the timer is a single-shot timer
Definition qtimer.h:22
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:916
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
bool windowRecreationRequired(QScreen *newScreen) const
Definition qwindow.cpp:449
QWindow * topLevelWindow(QWindow::AncestorMode mode=QWindow::IncludeTransients) const
Definition qwindow.cpp:2869
QPointer< QScreen > topLevelScreen
Definition qwindow_p.h:139
void disconnectFromScreen()
Definition qwindow.cpp:457
QScreen * screenForGeometry(const QRect &rect) const
Definition qwindow.cpp:1790
bool visibilityOnDestroy
Definition qwindow_p.h:103
virtual void clearFocusObject()
Definition qwindow.cpp:562
QPlatformWindow * platformWindow
Definition qwindow_p.h:101
virtual void setVisible(bool visible)
Definition qwindow.cpp:319
void emitScreenChangedRecursion(QScreen *newScreen)
Definition qwindow.cpp:469
void updateVisibility()
Definition qwindow.cpp:404
bool updateRequestPending
Definition qwindow_p.h:135
~QWindowPrivate() override
void create(bool recursive, WId nativeHandle=0)
Definition qwindow.cpp:500
QPoint globalPosition() const
Definition qwindow.cpp:2847
QCursor cursor
Definition qwindow_p.h:142
bool applyCursor()
Definition qwindow.cpp:3023
void _q_clearAlert()
Definition qwindow.cpp:2946
void updateSiblingPosition(SiblingPosition)
Definition qwindow.cpp:425
void setCursor(const QCursor *c=nullptr)
Definition qwindow.cpp:2999
void setTopLevelScreen(QScreen *newScreen, bool recreate)
Definition qwindow.cpp:479
QWindow::Visibility visibility
Definition qwindow_p.h:113
QWindow * parentWindow
Definition qwindow_p.h:100
bool receivedExpose
Definition qwindow_p.h:115
void setMinOrMaxSize(QSize *oldSizeMember, const QSize &size, qxp::function_ref< void()> funcWidthChanged, qxp::function_ref< void()> funcHeightChanged)
Definition qwindow.cpp:575
bool resizeEventPending
Definition qwindow_p.h:114
QSize minimumSize
Definition qwindow_p.h:127
void connectToScreen(QScreen *topLevelScreen)
Definition qwindow.cpp:463
Qt::WindowStates windowState
Definition qwindow_p.h:112
bool transientParentPropertySet
Definition qwindow_p.h:136
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const
Definition qwindow.cpp:569
static Qt::WindowState effectiveState(Qt::WindowStates)
Definition qwindow.cpp:1359
virtual bool treatAsVisible() const
Definition qwindow.cpp:2321
QSize maximumSize
Definition qwindow_p.h:128
QSurfaceFormat requestedFormat
Definition qwindow_p.h:106
void init(QScreen *targetScreen=nullptr)
Definition qwindow.cpp:209
void updateDevicePixelRatio()
Definition qwindow.cpp:1341
qreal devicePixelRatio
Definition qwindow_p.h:111
virtual bool participatesInLastWindowClosed() const
Definition qwindow.cpp:2300
void setTransientParent(QWindow *parent)
Definition qwindow.cpp:1501
\inmodule QtGui
Definition qwindow.h:63
friend Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
Definition qwindow.cpp:2864
void showNormal()
Shows the window as normal, i.e.
Definition qwindow.cpp:2261
int minimumHeight
the minimum height of the window's geometry
Definition qwindow.h:86
virtual QAccessibleInterface * accessibleRoot() const
Returns the accessibility interface for the object that the window represents.
Definition qwindow.cpp:2150
virtual void moveEvent(QMoveEvent *)
Override this to handle window move events (ev).
Definition qwindow.cpp:2372
int x
the x position of the window's geometry
Definition qwindow.h:80
void windowStateChanged(Qt::WindowState windowState)
This signal is emitted when the windowState changes, either by being set explicitly with setWindowSta...
void heightChanged(int arg)
int maximumWidth
the maximum width of the window's geometry
Definition qwindow.h:87
void showFullScreen()
Shows the window as fullscreen.
Definition qwindow.cpp:2243
virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
Override this to handle platform dependent events.
Definition qwindow.cpp:2758
void setWidth(int arg)
Definition qwindow.cpp:1627
int width
the width of the window's geometry
Definition qwindow.h:82
bool startSystemMove()
Start a system-specific move operation.
Definition qwindow.cpp:1138
void showMinimized()
Shows the window as minimized.
Definition qwindow.cpp:2212
void modalityChanged(Qt::WindowModality modality)
This signal is emitted when the Qwindow::modality property changes to modality.
void xChanged(int arg)
virtual void closeEvent(QCloseEvent *)
Override this to handle close events (ev).
Definition qwindow.cpp:2421
void show()
Shows the window.
Definition qwindow.cpp:2181
void setMaximumHeight(int h)
Definition qwindow.cpp:1689
virtual void mousePressEvent(QMouseEvent *)
Override this to handle mouse press events (ev).
Definition qwindow.cpp:2685
void hide()
Hides the window.
Definition qwindow.cpp:2199
void setMinimumHeight(int h)
Definition qwindow.cpp:1656
virtual void focusInEvent(QFocusEvent *)
Override this to handle focus in events (ev).
Definition qwindow.cpp:2663
Qt::WindowFlags flags
the window flags of the window
Definition qwindow.h:79
void contentOrientationChanged(Qt::ScreenOrientation orientation)
virtual void keyPressEvent(QKeyEvent *)
Override this to handle key press events (ev).
Definition qwindow.cpp:2641
QSurfaceFormat format() const override
Returns the actual format of this window.
Definition qwindow.cpp:888
virtual void mouseMoveEvent(QMouseEvent *)
Override this to handle mouse move events (ev).
Definition qwindow.cpp:2713
SurfaceType surfaceType() const override
Returns the surface type of the window.
Definition qwindow.cpp:628
Qt::ScreenOrientation contentOrientation
the orientation of the window's contents
Definition qwindow.h:95
void setX(int arg)
Definition qwindow.cpp:1601
void setTitle(const QString &)
Definition qwindow.cpp:972
bool visible
whether the window is visible or not
Definition qwindow.h:90
void raise()
Raise the window in the windowing system.
Definition qwindow.cpp:1057
virtual void exposeEvent(QExposeEvent *)
The expose event (ev) is sent by the window system when a window moves between the un-exposed and exp...
Definition qwindow.cpp:2345
int maximumHeight
the maximum height of the window's geometry
Definition qwindow.h:89
void setMaximumWidth(int w)
Definition qwindow.cpp:1680
void showMaximized()
Shows the window as maximized.
Definition qwindow.cpp:2226
void setMinimumWidth(int w)
Definition qwindow.cpp:1647
QSize size() const override
Returns the size of the window excluding any window frame.
Definition qwindow.h:210
virtual bool event(QEvent *) override
Override this to handle any event (ev) sent to the window.
Definition qwindow.cpp:2433
virtual void mouseReleaseEvent(QMouseEvent *)
Override this to handle mouse release events (ev).
Definition qwindow.cpp:2695
void yChanged(int arg)
int y
the y position of the window's geometry
Definition qwindow.h:81
void setGeometry(int posx, int posy, int w, int h)
Sets the geometry of the window, excluding its window frame, to a rectangle constructed from posx,...
Definition qwindow.cpp:1744
int minimumWidth
the minimum width of the window's geometry
Definition qwindow.h:84
virtual QObject * focusObject() const
Returns the QObject that will be the final receiver of events tied focus, such as key events.
Definition qwindow.cpp:2168
void setY(int arg)
Definition qwindow.cpp:1614
virtual void hideEvent(QHideEvent *)
Override this to handle hide events (ev).
Definition qwindow.cpp:2408
virtual void mouseDoubleClickEvent(QMouseEvent *)
Override this to handle mouse double click events (ev).
Definition qwindow.cpp:2705
bool close()
Close the window.
Definition qwindow.cpp:2276
void setHeight(int arg)
Definition qwindow.cpp:1637
virtual void keyReleaseEvent(QKeyEvent *)
Override this to handle key release events (ev).
Definition qwindow.cpp:2651
QString title
the window's title in the windowing system
Definition qwindow.h:77
Visibility visibility
the screen-occupation state of the window
Definition qwindow.h:93
bool startSystemResize(Qt::Edges edges)
Start a system-specific resize operation.
Definition qwindow.cpp:1100
virtual void touchEvent(QTouchEvent *)
Override this to handle touch events (ev).
Definition qwindow.cpp:2731
virtual void paintEvent(QPaintEvent *)
The paint event (ev) is sent by the window system whenever an area of the window needs a repaint,...
Definition qwindow.cpp:2364
virtual void resizeEvent(QResizeEvent *)
Override this to handle resize events (ev).
Definition qwindow.cpp:2384
virtual void focusOutEvent(QFocusEvent *)
Override this to handle focus out events (ev).
Definition qwindow.cpp:2675
void widthChanged(int arg)
virtual void showEvent(QShowEvent *)
Override this to handle show events (ev).
Definition qwindow.cpp:2397
Qt::WindowModality modality
the modality of the window
Definition qwindow.h:78
void setVisible(bool visible)
Definition qwindow.cpp:652
int height
the height of the window's geometry
Definition qwindow.h:83
void lower()
Lower the window in the windowing system.
Definition qwindow.cpp:1072
qreal opacity
The opacity of the window in the windowing system.
Definition qwindow.h:96
Raster or OpenGL Window.
[Window class with invokable method]
Definition window.h:11
#define this
Definition dialogs.cpp:9
bool focus
[0]
QCursor cursor
double e
rect
[4]
else opt state
[0]
T toNativeLocalPosition(const T &value, const C *context)
T toNativeGlobalPosition(const T &value, const C *context)
T fromNativeLocalPosition(const T &value, const C *context)
T fromNativeGlobalPosition(const T &value, const C *context)
T fromNativePixels(const T &value, const C *context)
QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
T toNativeWindowGeometry(const T &value, const C *context)
T fromNativeWindowGeometry(const T &value, const C *context)
Combined button and popup list for selecting options.
WindowState
Definition qnamespace.h:250
@ WindowFullScreen
Definition qnamespace.h:254
@ WindowNoState
Definition qnamespace.h:251
@ WindowMinimized
Definition qnamespace.h:252
@ WindowMaximized
Definition qnamespace.h:253
@ WindowActive
Definition qnamespace.h:255
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
@ RightButton
Definition qnamespace.h:58
WindowModality
@ NonModal
QTextStream & noforcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() & ~QTextStream::ForceSign) on stream and...
ScreenOrientation
Definition qnamespace.h:270
CursorShape
@ LastCursor
@ ArrowCursor
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
@ RightEdge
@ TopEdge
@ BottomEdge
@ LeftEdge
QTextStream & forcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ForceSign) on stream and ...
WindowType
Definition qnamespace.h:204
@ Desktop
Definition qnamespace.h:214
@ WindowDoesNotAcceptFocus
Definition qnamespace.h:235
@ ForeignWindow
Definition qnamespace.h:216
@ ToolTip
Definition qnamespace.h:212
@ WindowType_Mask
Definition qnamespace.h:219
@ Window
Definition qnamespace.h:206
static void * context
#define Q_UNLIKELY(x)
#define qApp
#define qWarning
Definition qlogging.h:162
#define qFatal
Definition qlogging.h:164
#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
#define SLOT(a)
Definition qobjectdefs.h:51
n void setPosition(void) \n\
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLenum mode
const GLfloat * m
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint object
[3]
GLenum type
GLenum target
GLbitfield flags
GLuint GLsizei const GLchar * message
GLenum GLuint GLintptr offset
GLuint name
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
#define QWINDOWSIZE_MAX
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
SSL_CTX int(*) void arg)
QScreen * screen
[1]
Definition main.cpp:29
#define QT_CONFIG(feature)
#define emit
#define Q_UNUSED(x)
ptrdiff_t qsizetype
Definition qtypes.h:70
double qreal
Definition qtypes.h:92
ptrdiff_t qintptr
Definition qtypes.h:71
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
Definition qwindow.cpp:2864
QDebug operator<<(QDebug debug, const QWindow *window)
Definition qwindow.cpp:3076
static QWindow * nonDesktopParent(QWindow *parent)
Definition qwindow.cpp:134
QObject::connect nullptr
QString title
[35]
QLayoutItem * child
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QAction * at
view create()
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
Definition qlist.h:955
bool contains(const AT &t) const noexcept
Definition qlist.h:44
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent