24#if QT_CONFIG(accessibility)
27#include <qpa/qplatformwindow.h>
28#include <qpa/qplatformwindow_p.h>
29#include "private/qwidgetwindow_p.h"
34#if QT_CONFIG(whatsthis)
38#include "private/qstylesheetstyle_p.h"
39#include "private/qstyle_p.h"
42#include <QtGui/private/qhighdpiscaling_p.h>
43#include <QtGui/qinputmethod.h>
45#if QT_CONFIG(graphicseffect)
46#include <private/qgraphicseffect_p.h>
49#include <private/qwidgetrepaintmanager_p.h>
50#include <private/qpaintengine_raster_p.h>
53#include <QtGui/private/qwindow_p.h>
55# include "QtGui/private/qaction_p.h"
58#if QT_CONFIG(graphicsview)
59#include "QtWidgets/qgraphicsproxywidget.h"
60#include "QtWidgets/qgraphicsscene.h"
61#include "private/qgraphicsproxywidget_p.h"
63#include "QtWidgets/qabstractscrollarea.h"
64#include "private/qabstractscrollarea_p.h"
65#include "private/qevent_p.h"
67#include "private/qgesturemanager_p.h"
69#ifdef QT_KEYPAD_NAVIGATION
70#if QT_CONFIG(tabwidget)
106#
if !defined(QT_NO_IM)
107 , imHints(
Qt::ImhNone)
110 , toolTipDuration(-1)
112 , directFontResolveMask(0)
113 , inheritedFontResolveMask(0)
114 , directPaletteResolveMask(0)
115 , inheritedPaletteResolveMask(0)
120 , leftLayoutItemMargin(0)
121 , topLayoutItemMargin(0)
122 , rightLayoutItemMargin(0)
123 , bottomLayoutItemMargin(0)
128 , dirtyOpaqueChildren(1)
130 , retainSizeWhenHiddenChanged(0)
134 , usesDoubleBufferedGLContext(0)
135 , mustHaveWindowHandle(0)
137 , textureChildSeen(0)
139 , inheritsInputMethodHints(0)
141 , renderToTextureReallyDirty(1)
143 , childrenHiddenByWState(0)
144 , childrenShownByExpose(0)
150 qFatal(
"QWidget: Must construct a QApplication before a QWidget");
154#ifdef QT_BUILD_INTERNAL
160 qFatal(
"Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)",
167#ifdef QWIDGET_EXTRA_DEBUG
168 static int count = 0;
189 if (
q->children().size() > 0) {
192 for (
int i = 0;
i < childObjects.
size(); ++
i) {
194 if (
w && !
w->isWindow()) {
199 w->d_func()->setWSGeometry();
200 w->d_func()->setDirtyOpaqueRegion();
221 t.translate(
p.x(),
p.y());
228#ifdef QT_KEYPAD_NAVIGATION
238bool QWidget::hasEditFocus()
const
241 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
242 w =
w->d_func()->extra->focus_proxy;
243 return QWidgetPrivate::editingWidget ==
w;
258void QWidget::setEditFocus(
bool on)
261 while (
f->d_func()->extra &&
f->d_func()->extra->focus_proxy)
262 f =
f->d_func()->extra->focus_proxy;
264 if (QWidgetPrivate::editingWidget && QWidgetPrivate::editingWidget !=
f)
265 QWidgetPrivate::editingWidget->setEditFocus(
false);
267 if (on && !
f->hasFocus())
270 if ((!on && !QWidgetPrivate::editingWidget)
271 || (on && QWidgetPrivate::editingWidget ==
f)) {
275 if (!on && QWidgetPrivate::editingWidget ==
f) {
276 QWidgetPrivate::editingWidget = 0;
281 QWidgetPrivate::editingWidget =
f;
316 return d->extra &&
d->extra->autoFillBackground;
324 if (
d->extra->autoFillBackground ==
enabled)
327 d->extra->autoFillBackground =
enabled;
812#ifdef QT_NO_EXCEPTIONS
817 if (
d->focus_next != that) {
819 d->focus_next->d_func()->focus_prev =
d->focus_prev;
821 d->focus_prev->d_func()->focus_next =
d->focus_next;
945 qFatal(
"QWidget: Cannot create a QWidget without QApplication");
956 "Widgets must be created in the GUI thread.");
960 data.fstrut_dirty =
true;
963 data.widget_attributes = 0;
964 data.window_flags =
f;
965 data.window_state = 0;
966 data.focus_policy = 0;
970 data.sizehint_forced = 0;
971 data.is_closing =
false;
973 data.in_set_window_state = 0;
974 data.in_destructor =
false;
989 data.crect = parentWidget ?
QRect(0,0,100,30) :
QRect(0,0,640,480);
994 else if (parentWidget)
995 q->setParent(parentWidget,
data.window_flags);
1021 q->create(0,
true,
true);
1025 child->d_func()->createRecursively();
1038 if (
auto nativeParent = q_func()->nativeParentWidget()) {
1039 if (
auto window = nativeParent->windowHandle())
1044 if (
auto topLevel = q_func()->topLevelWidget()) {
1065#if QT_CONFIG(graphicsview)
1067 if (nearestGraphicsProxyWidget(q_func()))
1079 if (
config.isEnabled()) {
1102 qCDebug(lcWidgetPainting) <<
"Tree with root" <<
w <<
"evaluated to forced flushing with QRhi";
1109 qCDebug(lcWidgetPainting) <<
"Tree with root" <<
w <<
"evaluates to flushing with QRhi";
1136 qWarning(
"QWidget::create(): Parameter 'window' does not have any effect.");
1140 if (
d->data.in_destructor)
1144 Qt::WindowFlags &
flags =
data->window_flags;
1170 if (paintOnScreenEnv)
1176 d->updateIsOpaque();
1192 d->setWindowIcon_sys();
1194 if (
isWindow() && !
d->topData()->iconText.isEmpty())
1195 d->setWindowIconText_helper(
d->topData()->iconText);
1196 if (
isWindow() && !
d->topData()->caption.isEmpty())
1197 d->setWindowTitle_helper(
d->topData()->caption);
1198 if (
isWindow() && !
d->topData()->filePath.isEmpty())
1199 d->setWindowFilePath_helper(
d->topData()->filePath);
1201 d->updateSystemBackground();
1204 d->setWindowIcon_sys();
1212 d->updateFrameStrut();
1218 for (
int i = 0;
i < children.
size();
i++) {
1224 childWidget->
winId();
1258 for (
const QByteArray &propertyName : dynamicPropertyNames) {
1259 if (!
qstrncmp(propertyName,
"_q_platform_", 12))
1263 Qt::WindowFlags &
flags =
data.window_flags;
1265#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
1282 if (
win->isTopLevel()) {
1285 if (!targetScreen) {
1287 ?
q->screen() :
nullptr;
1295 format.setAlphaBufferSize(8);
1300 if (nativeParent->windowHandle()) {
1302 win->setTransientParent(nativeParent->window()->windowHandle());
1305 win->setTransientParent(
nullptr);
1318 platformWindow->setFrameStrutEventsEnabled(
true);
1321 data.window_flags =
win->flags();
1322 if (!
win->isTopLevel())
1323 data.window_flags &=
~Qt::ForeignWindow;
1326 if (!
topData()->role.isNull()) {
1327 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
win->handle()))
1328 xcbWindow->setWindowRole(
topData()->role);
1337 if (
q->isWindow()) {
1346 }
else if (
win->handle()) {
1352 if (
win->handle()) {
1365 if (
data.crect.width() == 0 ||
data.crect.height() == 0) {
1367 }
else if (
q->isVisible()) {
1369 win->setNativeWindowVisibility(
true);
1374static const char activeXNativeParentHandleProperty[] =
"_q_embedded_native_parent_handle";
1386 if (
extra->topextra->opacity != 255 &&
q->isWindow())
1389 const bool isTipLabel =
q->inherits(
"QTipLabel");
1390 const bool isAlphaWidget = !isTipLabel &&
q->inherits(
"QAlphaWidget");
1393 const QVariant activeXNativeParentHandle =
q->property(activeXNativeParentHandleProperty);
1394 if (activeXNativeParentHandle.
isValid())
1395 extra->topextra->window->setProperty(activeXNativeParentHandleProperty, activeXNativeParentHandle);
1396 if (isTipLabel || isAlphaWidget)
1397 extra->topextra->window->setProperty(
"_q_windowsDropShadow",
QVariant(
true));
1399 if (isTipLabel || isAlphaWidget ||
q->inherits(
"QRollEffect"))
1417 d->data.in_destructor =
true;
1419#if defined (QT_CHECK_STATE)
1424#ifndef QT_NO_GESTURES
1427 for (
auto it =
d->gestureContext.keyBegin(),
end =
d->gestureContext.keyEnd();
it !=
end; ++
it)
1428 manager->cleanupCachedGestures(
this, *
it);
1430 d->gestureContext.clear();
1435 for (
auto action : std::as_const(
d->actions)) {
1442#ifndef QT_NO_SHORTCUT
1451 d->layout =
nullptr;
1454 Q_ASSERT(
d->focus_next->d_func()->focus_prev ==
this);
1455 Q_ASSERT(
d->focus_prev->d_func()->focus_next ==
this);
1457 if (
d->focus_next !=
this) {
1458 d->focus_next->d_func()->focus_prev =
d->focus_prev;
1459 d->focus_prev->d_func()->focus_next =
d->focus_next;
1460 d->focus_next =
d->focus_prev =
nullptr;
1465#if QT_CONFIG(graphicsview)
1467 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
1468 w =
w->d_func()->extra->focus_proxy;
1471 if (!
e || !
e->proxyWidget || (
w->parentWidget() &&
w->parentWidget()->d_func()->focus_child ==
this))
1478 d->setDirtyOpaqueRegion();
1492 qApp->d_func()->sendSyntheticEnterLeave(
this);
1496 repaintManager->removeDirtyWidget(
this);
1498 repaintManager->removeStaticWidget(
this);
1501 delete d->needsFlush;
1502 d->needsFlush =
nullptr;
1506 bool blocked =
d->blockSig;
1509 if (
d->isSignalConnected(0)) {
1515 qWarning(
"Detected an unexpected exception in ~QWidget while emitting destroyed().");
1520 if (
d->declarativeData) {
1521 d->wasDeleted =
true;
1524 d->declarativeData =
nullptr;
1525 d->wasDeleted =
false;
1528 d->blockSig = blocked;
1530 if (!
d->children.isEmpty())
1531 d->deleteChildren();
1548 }
QT_CATCH(
const std::exception&) {
1552#if QT_CONFIG(graphicseffect)
1553 delete d->graphicsEffect;
1556 d->isWidget =
false;
1569 const WId oldWinId =
data.winid;
1576 if (oldWinId !=
id) {
1586 if (!
extra->topextra) {
1587 extra->topextra = std::make_unique<QTLWExtra>();
1589 x->backingStore =
nullptr;
1590 x->sharedPainter =
nullptr;
1591 x->incw =
x->inch = 0;
1592 x->basew =
x->baseh = 0;
1593 x->frameStrut.setCoords(0, 0, 0, 0);
1594 x->normalGeometry =
QRect(0,0,-1,-1);
1595 x->savedFlags = { };
1597 x->posIncludesFrame = 0;
1598 x->sizeAdjusted =
false;
1600 x->window =
nullptr;
1601 x->initialScreen =
nullptr;
1603#ifdef QWIDGET_EXTRA_DEBUG
1604 static int count = 0;
1618 extra = std::make_unique<QWExtra>();
1619 extra->glContext =
nullptr;
1620#if QT_CONFIG(graphicsview)
1621 extra->proxyWidget =
nullptr;
1627 extra->customDpiX = 0;
1628 extra->customDpiY = 0;
1629 extra->explicitMinSize = 0;
1630 extra->explicitMaxSize = 0;
1631 extra->autoFillBackground = 0;
1632 extra->nativeChildrenForced = 0;
1633 extra->inRenderWithPainter = 0;
1634 extra->hasWindowContainer =
false;
1637#ifdef QWIDGET_EXTRA_DEBUG
1638 static int count = 0;
1657#ifndef QT_NO_STYLE_STYLESHEET
1662 if (
extra->topextra) {
1689 extra->topextra->repaintManager.reset(
nullptr);
1691 extra->topextra->widgetTextures.clear();
1697 if (
extra->topextra->window) {
1698 extra->topextra->window->destroy();
1700 delete extra->topextra->window;
1701 extra->topextra->window =
nullptr;
1729 above = (sibling ==
w);
1733 const QRect siblingRect = sibling->d_func()->effectiveRectFor(sibling->data->crect);
1735 const auto &siblingExtra = sibling->d_func()->extra;
1736 if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
1741 if (breakAfterFirst)
1745 w =
w->parentWidget();
1758 repaintManager->sync();
1767 repaintManager->sync(q_func(), region);
1773 if (
data.in_destructor)
1783 extra->staticContentsSize =
data.crect.size();
1794 QRegion toBePainted(noPartialUpdateSupport ?
q->rect() : rgn);
1798 if (toBePainted.isEmpty())
1804 qWarning(
"QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
1811 if (
enable && !
q->isWindow() &&
q->parentWidget() && !
q->parentWidget()->updatesEnabled())
1824 if (
w && !
w->isWindow() && !
w->testAttribute(
attribute))
1825 w->d_func()->setUpdatesEnabled_helper(
enable);
1840#if QT_CONFIG(graphicsview)
1841 if (!
q->parentWidget() &&
extra &&
extra->proxyWidget) {
1853 const bool useStyleSheetPropagationInWidgetStyles =
1876 if (!
w->isVisible())
1884 &&
w->parentWidget()) {
1887 w =
w->parentWidget();
1888 r &=
QRect(ox, oy,
w->width(),
w->height());
1899 if (!
q->isVisible())
1909 &&
w->parentWidget()) {
1913 w =
w->parentWidget();
1914 r &=
QRegion(ox, oy,
w->width(),
w->height());
1917 while(
w->d_func()->children.at(
i++) !=
static_cast<const QObject *
>(ignoreUpTo))
1921 if (sibling->isVisible() && !sibling->isWindow()) {
1922 QRect siblingRect(ox+sibling->x(), oy+sibling->y(),
1923 sibling->width(), sibling->height());
1937 scaleTransform.
scale(devicePixelRatio, devicePixelRatio);
1939 paintEngine->d_func()->baseSystemClip = region;
1940 paintEngine->d_func()->setSystemTransform(scaleTransform);
1944#if QT_CONFIG(graphicseffect)
1945void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
1950 if (
w->graphicsEffect()) {
1951 QWidgetEffectSourcePrivate *sourced =
1952 static_cast<QWidgetEffectSourcePrivate *
>(
w->graphicsEffect()->source()->d_func());
1953 if (!sourced->updateDueToGraphicsEffect)
1954 w->graphicsEffect()->source()->d_func()->invalidateCache();
1956 w =
w->parentWidget();
1967#if QT_CONFIG(graphicseffect)
1968 invalidateGraphicsEffectsRecursively();
2001 r &= childd->
extra->mask;
2026 bool alsoNonOpaque)
const
2030 if (disableSubtractOpaqueSiblings ||
q->isWindow())
2033 QRect clipBoundingRect;
2034 bool dirtyClipBoundingRect =
true;
2037 bool dirtyParentClip =
true;
2048 const QRect widgetGeometry =
w->d_func()->effectiveRectFor(
w->data->crect);
2054 const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
2058 if (dirtyClipBoundingRect) {
2060 dirtyClipBoundingRect =
false;
2066 if (dirtyParentClip) {
2067 parentClip = sourceRegion.
translated(parentOffset);
2068 dirtyParentClip =
false;
2071 const QPoint siblingPos(sibling->data->crect.topLeft());
2072 const QRect siblingClipRect(sibling->d_func()->clipRect());
2073 QRegion siblingDirty(parentClip);
2074 siblingDirty &= (siblingClipRect.
translated(siblingPos));
2075 const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
2076 && !sibling->d_func()->graphicsEffect;
2078 siblingDirty &= sibling->d_func()->extra->
mask.
translated(siblingPos);
2082 if (sibling->d_func()->isOpaque || alsoNonOpaque) {
2085 sourceRegion -= siblingDirty;
2087 sourceRegion -= siblingGeometry.
translated(-parentOffset);
2090 if (hasDirtySiblingsAbove)
2091 *hasDirtySiblingsAbove =
true;
2094 QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
2095 opaqueSiblingChildren.
translate(-parentOffset + siblingPos);
2096 sourceRegion -= opaqueSiblingChildren;
2101 dirtyClipBoundingRect =
true;
2102 dirtyParentClip =
true;
2105 w =
w->parentWidget();
2107 dirtyParentClip =
true;
2118#if QT_CONFIG(graphicseffect)
2120 w =
q->parentWidget();
2132 w =
w->parentWidget();
2138#if defined(QT_NO_BACKINGSTORE)
2156#if QT_CONFIG(graphicseffect)
2172 if (
q->autoFillBackground()) {
2173 const QBrush &autoFillBrush = pal.
brush(
q->backgroundRole());
2203 const int oldAlpha =
format.alphaBufferSize();
2205 if (oldAlpha != newAlpha) {
2223 format.setAlphaBufferSize(newAlpha);
2238 }
else if (
brush.gradient()
2253#if QT_CONFIG(scrollarea)
2258 QAbstractScrollArea *
scrollArea = qobject_cast<QAbstractScrollArea *>(
parent);
2261 QAbstractScrollAreaPrivate *
priv =
static_cast<QAbstractScrollAreaPrivate *
>(scrollPrivate);
2272 bool brushOriginSet =
false;
2273 const QBrush autoFillBrush =
q->palette().brush(
q->backgroundRole());
2277 if (!brushOriginSet)
2290 if (
q->autoFillBackground()) {
2291 if (!brushOriginSet)
2366 if (!
data->in_destructor
2372 return that->data->winid;
2383 if (!
q->isWindow()) {
2388 if (!
parent->internalWinId()) {
2430 if (!
screen || !
q->isWindow())
2433 if (currentScreen !=
screen) {
2475 return realParent->internalWinId();
2493 return d->windowHandle();
2506 if (
auto associatedScreen =
d->associatedScreen())
2507 return associatedScreen;
2508 if (
auto topLevel =
window()) {
2510 if (topData->initialScreen)
2511 return topData->initialScreen;
2537#ifndef QT_NO_STYLE_STYLESHEET
2559 return d->extra->styleSheet;
2565 if (
data->in_destructor)
2580 bool repolish =
d->polished;
2582 const auto childWidgets = findChildren<QWidget*>();
2583 for (
auto child : childWidgets) {
2584 repolish =
child->d_func()->polished;
2590 proxy->repolish(
this);
2611 if (
d->extra &&
d->extra->style)
2612 return d->extra->style;
2642#ifndef QT_NO_STYLE_STYLESHEET
2646 styleSheetStyle->ref();
2647 d->setStyle_helper(
style,
false);
2653 d->setStyle_helper(
style,
false);
2659 QStyle *oldStyle =
q->style();
2663#ifndef QT_NO_STYLE_STYLESHEET
2666 extra->style = newStyle;
2671 q->style()->polish(
q);
2677 for (
int i = 0;
i < childrenList.
size(); ++
i) {
2680 c->d_func()->inheritStyle();
2684#ifndef QT_NO_STYLE_STYLESHEET
2687 cssStyle->clearWidgetFont(
q);
2695#ifndef QT_NO_STYLE_STYLESHEET
2705#ifndef QT_NO_STYLE_STYLESHEET
2712 if (!
q->styleSheet().isEmpty()) {
2724 QStyle *newStyle = parentStyle;
2736 if (origStyle == extraStyle)
2743 origStyle =
nullptr;
2817 if (
q->windowHandle())
2818 q->windowHandle()->setModality(
q->windowModality());
2897 return Qt::WindowStates(
data->window_state);
2910 data->window_state = newstate;
2950 if (oldstate == newstate)
2955 data->window_state = newstate;
2956 data->in_set_window_state = 1;
2964 d->topData()->normalGeometry =
geometry();
2969 data->in_set_window_state = 0;
3035#if !defined Q_OS_QNX
3102 &&
w->parentWidget()
3103 &&
w->parentWidget() != ancestor)
3152 qWarning(
"QWidget::insertAction: Attempt to insert null action");
3157 if (
d->actions.contains(action))
3160 int pos =
d->actions.indexOf(before);
3163 pos =
d->actions.size();
3165 d->actions.insert(
pos, action);
3203 if (
d->actions.removeAll(action)) {
3250#if QT_CONFIG(shortcut)
3293 const QObject *receiver,
const char* member,
3301#if QT_CONFIG(shortcut)
3303 const QObject *receiver,
const char* member,
3312 const QObject *receiver,
const char* member,
3376 if (
enable && !
q->isWindow() &&
q->parentWidget() && !
q->parentWidget()->isEnabled())
3385 if (!
enable &&
q->window()->focusWidget() ==
q) {
3386 bool parentIsEnabled = (!
q->parentWidget() ||
q->parentWidget()->isEnabled());
3387 if (!parentIsEnabled || !
q->focusNextChild())
3395 w->d_func()->setEnabled_helper(
enable);
3479 QRect fs =
d->frameStrut();
3505 return data->crect.x() -
d->frameStrut().left();
3506 return data->crect.x();
3525 return data->crect.y() -
d->frameStrut().top();
3526 return data->crect.y();
3561 if (!
d->maybeTopData() || !
d->maybeTopData()->posIncludesFrame)
3562 result -=
d->frameStrut().topLeft();
3684 return d->topData()->normalGeometry;
3704 for (
int i = 0;
i <
d->children.size(); ++
i) {
3706 if (
w && !
w->isWindow() && !
w->isHidden())
3728 for (
int i = 0;
i <
d->children.size(); ++
i) {
3730 if (
w && !
w->isWindow() && !
w->isHidden()) {
3762 return d->extra ?
QSize(
d->extra->minw,
d->extra->minh) :
QSize(0, 0);
3784 return d->extra ?
QSize(
d->extra->maxw,
d->extra->maxh)
3863 return (
d->extra &&
d->extra->topextra)
3864 ?
QSize(
d->extra->topextra->incw,
d->extra->topextra->inch)
3884 return (
d->extra &&
d->extra->topextra)
3885 ?
QSize(
d->extra->topextra->basew,
d->extra->topextra->baseh)
3893 int mw = minw, mh = minh;
3899 qWarning(
"QWidget::setMinimumSize: (%s/%s) "
3900 "The largest allowed size is (%d,%d)",
3901 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(),
QWIDGETSIZE_MAX,
3907 qWarning(
"QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
3909 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(), minw, minh);
3910 minw = mw =
qMax(minw, 0);
3911 minh = mh =
qMax(minh, 0);
3925 if (
extra &&
q->windowHandle()) {
3932 if (
extra->topextra) {
3955 if (!
d->setMinimumSize_helper(minw, minh))
3959 d->setConstraints_sys();
3968#if QT_CONFIG(graphicsview)
3970 if (
d->extra->proxyWidget)
3971 d->extra->proxyWidget->setMinimumSize(minw, minh);
3974 d->updateGeometry_helper(
d->extra->minw ==
d->extra->maxw &&
d->extra->minh ==
d->extra->maxh);
3981 qWarning(
"QWidget::setMaximumSize: (%s/%s) "
3982 "The largest allowed size is (%d,%d)",
3983 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(),
QWIDGETSIZE_MAX,
3989 qWarning(
"QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
3991 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(), maxw, maxh);
3992 maxw =
qMax(maxw, 0);
3993 maxh =
qMax(maxh, 0);
3996 if (
extra->maxw == maxw &&
extra->maxh == maxh)
4015 if (!
d->setMaximumSize_helper(maxw, maxh))
4019 d->setConstraints_sys();
4026#if QT_CONFIG(graphicsview)
4028 if (
d->extra->proxyWidget)
4029 d->extra->proxyWidget->setMaximumSize(maxw, maxh);
4033 d->updateGeometry_helper(
d->extra->minw ==
d->extra->maxw &&
d->extra->minh ==
d->extra->maxh);
4047 if (
x->incw ==
w &&
x->inch ==
h)
4052 d->setConstraints_sys();
4066 if (
x->basew == basew &&
x->baseh == baseh)
4071 d->setConstraints_sys();
4105 bool minSizeSet =
d->setMinimumSize_helper(
w,
h);
4106 bool maxSizeSet =
d->setMaximumSize_helper(
w,
h);
4107 if (!minSizeSet && !maxSizeSet)
4111 d->setConstraints_sys();
4113 d->updateGeometry_helper(
true);
4125 d->extra->explicitMinSize = expl;
4134 d->extra->explicitMinSize = expl;
4143 d->extra->explicitMaxSize = expl;
4152 d->extra->explicitMaxSize = expl;
4170 d->extra->explicitMinSize = explMin;
4171 d->extra->explicitMaxSize = explMax;
4190 d->extra->explicitMinSize = explMin;
4191 d->extra->explicitMaxSize = explMax;
4210 Q_ASSERT_X(
w,
"QWidget::mapTo(const QWidget *parent, const QPointF &pos)",
4211 "parent must be in parent hierarchy");
4212 p =
w->mapToParent(
p);
4213 w =
w->parentWidget();
4242 Q_ASSERT_X(
w,
"QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
4243 "parent must be in parent hierarchy");
4245 p =
w->mapFromParent(
p);
4246 w =
w->parentWidget();
4280 return pos +
data->crect.topLeft();
4303 return pos -
data->crect.topLeft();
4324 while (!
w->isWindow() &&
p) {
4326 p =
p->parentWidget();
4402 d->updateSystemBackground();
4403 d->propagatePaletteChange();
4404 d->updateIsOpaque();
4467 d->updateSystemBackground();
4468 d->propagatePaletteChange();
4526#
if defined(Q_OS_WIN)
4546 QPalette naturalPalette =
d->naturalWidgetPalette(
d->inheritedPaletteResolveMask);
4548 d->setPalette_helper(resolvedPalette);
4564 const bool useStyleSheetPropagationInWidgetStyles =
4575 if (!
p->testAttribute(
Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
4577 QPalette inheritedPalette =
p->palette();
4579 naturalPalette = inheritedPalette.
resolve(naturalPalette);
4581 naturalPalette =
p->palette();
4585#if QT_CONFIG(graphicsview)
4589 naturalPalette = inheritedPalette.
resolve(naturalPalette);
4594 return naturalPalette;
4678#ifndef QT_NO_STYLE_STYLESHEET
4690 QFont naturalFont =
d->naturalWidgetFont(
d->inheritedFontResolveMask);
4692 d->setFont_helper(resolvedFont);
4711 const bool useStyleSheetPropagationInWidgetStyles =
4722 if (!
p->testAttribute(
Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
4724 if (inheritedMask != 0) {
4725 QFont inheritedFont =
p->font();
4727 naturalFont = inheritedFont.
resolve(naturalFont);
4730 naturalFont =
p->font();
4734#if QT_CONFIG(graphicsview)
4736 if (inheritedMask != 0) {
4737 QFont inheritedFont =
extra->proxyWidget->font();
4739 naturalFont = inheritedFont.
resolve(naturalFont);
4787#ifndef QT_NO_STYLE_STYLESHEET
4790 const bool useStyleSheetPropagationInWidgetStyles =
4797#if QT_CONFIG(graphicsview)
4798 if (!
q->parentWidget() &&
extra &&
extra->proxyWidget) {
4811 data.fnt.setResolveMask(newMask);
4817#ifndef QT_NO_STYLE_STYLESHEET
4818 }
else if (!useStyleSheetPropagationInWidgetStyles &&
w->testAttribute(
Qt::WA_StyleSheet)) {
4832#ifndef QT_NO_STYLE_STYLESHEET
4833 if (!useStyleSheetPropagationInWidgetStyles && cssStyle) {
4853 w->d_func()->setLayoutDirection_helper(
direction);
4908 d->resolveLayoutDirection();
4959 return (
d->extra &&
d->extra->curs)
4971 || (
d->extra &&
d->extra->curs))
4974 d->extra->curs = std::make_unique<QCursor>(
cursor);
4994 d->extra->curs.reset();
4997 d->unsetCursor_sys();
5029 }
else if (lastUnderMouse) {
5030 const WId lastWinId = lastUnderMouse->effectiveWinId();
5031 const WId winId =
w->effectiveWinId();
5032 if (lastWinId && lastWinId == winId)
5034 }
else if (!
w->internalWinId()) {
5038 while (!
w->internalWinId() &&
w->parentWidget() && !
w->isWindow()
5040 w =
w->parentWidget();
5043 if (!
w->internalWinId())
5100 const QRegion &sourceRegion, RenderFlags renderFlags)
5103 render(&
p, targetOffset, sourceRegion, renderFlags);
5120 const QRegion &sourceRegion, RenderFlags renderFlags)
5123 qWarning(
"QWidget::render: Null pointer to painter");
5128 qWarning(
"QWidget::render: Cannot render with an inactive painter");
5137 const bool inRenderWithPainter =
d->extra &&
d->extra->inRenderWithPainter;
5138 const QRegion toBePainted = !inRenderWithPainter ?
d->prepareToRender(sourceRegion, renderFlags)
5145 d->extra->inRenderWithPainter =
true;
5156 d->render_helper(
painter, targetOffset, toBePainted, renderFlags);
5157 d->extra->inRenderWithPainter = inRenderWithPainter;
5162 QPainter *oldPainter =
d->sharedPainter();
5179 d->render(
target, targetOffset, toBePainted, renderFlags);
5187 d->setSharedPainter(oldPainter);
5189 d->extra->inRenderWithPainter = inRenderWithPainter;
5198 for (
int i = 0;
i < children.
size(); ++
i) {
5227 const bool oldDirtyOpaqueChildren =
d->dirtyOpaqueChildren;
5229 if (
r.width() < 0 ||
r.height() < 0) {
5232 r =
d->prepareToRender(
QRegion(), renderFlags).boundingRect();
5236 if (!
r.intersects(
rect()))
5241 res.setDevicePixelRatio(
dpr);
5246 d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
5260#if QT_CONFIG(graphicseffect)
5264 return d->graphicsEffect;
5290#if QT_CONFIG(graphicseffect)
5294 if (
d->graphicsEffect ==
effect)
5297 if (
d->graphicsEffect) {
5298 d->invalidateBackingStore(
rect());
5299 delete d->graphicsEffect;
5300 d->graphicsEffect =
nullptr;
5312 d->updateIsOpaque();
5327 return parent ?
parent->d_func()->isAboutToShow() :
false;
5338 (
void)topLevel->d_func()->topData();
5350 widget->d_func()->updateGeometry_helper(
true);
5356 if (topLevel->d_func()->
layout)
5360 QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
5368 topLevel->d_func()->activateChildLayoutsRecursively();
5371 for (
int i = 0;
i < hiddenWidgets.
size(); ++
i) {
5378 q->window()->d_func()->sendPendingMoveAndResizeEvents(
true,
true);
5384 toBePainted &=
extra->mask;
5389 QWidget::RenderFlags renderFlags)
5396 const bool useDeviceCoordinates = originalTransform.
isScaling();
5397 if (!useDeviceCoordinates) {
5406 pixmap.setDevicePixelRatio(pixmapDevicePixelRatio);
5442 q->render(&pixmapPainter,
QPoint(), toBePainted, renderFlags);
5443 pixmapPainter.
end();
5460 qCInfo(lcWidgetPainting) <<
"Drawing" << rgn <<
"of" <<
q <<
"at" <<
offset
5461 <<
"into paint device" << pdev <<
"with" <<
flags;
5466#if QT_CONFIG(graphicseffect)
5469 QWidgetEffectSourcePrivate *sourced =
static_cast<QWidgetEffectSourcePrivate *
>
5471 if (!sourced->context) {
5485 sourced->invalidateCache();
5495 sourced->context =
nullptr;
5513 if (asRoot && !alsoInvisible)
5518 if (!toBePainted.isEmpty()) {
5519 if (!onScreen || alsoOnScreen) {
5522 qWarning(
"QWidget::repaint: Recursive repaint detected");
5533 paintEngine->d_func()->
systemRect =
q->data->crect;
5551 QColor tint =
q->palette().window().color();
5553 p.fillRect(toBePainted.boundingRect(), tint);
5560 qDebug() <<
"clipping to" << toBePainted <<
"location == " <<
offset
5561 <<
"geometry ==" <<
QRect(
q->mapTo(
q->window(),
QPoint(0, 0)),
q->size());
5564 bool skipPaintEvent =
false;
5573 }
else if (!repaintManager) {
5581 p.drawImage(
q->rect(),
img);
5582 skipPaintEvent =
true;
5588 skipPaintEvent =
true;
5591 if (!skipPaintEvent) {
5605 paintEngine->d_func()->currentClipDevice =
nullptr;
5611 qWarning(
"QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
5613 if (paintEngine && paintEngine->autoDestruct()) {
5616 }
else if (
q->isWindow()) {
5620 p.setClipRegion(toBePainted);
5623 p.drawTiledPixmap(
q->rect(), bg.
texture());
5625 p.fillRect(
q->rect(), bg);
5627 if (
engine->autoDestruct())
5643 QCoreApplication::sendSpontaneousEvent(
q, &
e);
5650 const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
5653 qWarning(
"QWidget::render: null pointer to paint device");
5657 const bool inRenderWithPainter =
extra &&
extra->inRenderWithPainter;
5658 QRegion paintRegion = !inRenderWithPainter
5670 if (targetPrivate->
extra && targetPrivate->
extra->inRenderWithPainter) {
5672 if (targetPainter && targetPainter->
isActive())
5682 QPoint redirectionOffset;
5690 offset -= redirectionOffset;
5693 if (!inRenderWithPainter) {
5695 const QRegion targetSystemClip = targetEngine->systemClip();
5696 if (!targetSystemClip.
isEmpty())
5717 if (oldSharedPainter)
5727 bool dirtyBoundingRect =
true;
5733 if (
x && !(exludeOpaqueChildren &&
x->d_func()->isOpaque) && !
x->isHidden() && !
x->isWindow()
5734 && !(excludeNativeChildren &&
x->internalWinId())) {
5735 if (dirtyBoundingRect) {
5737 dirtyBoundingRect =
false;
5746 }
while (
index >= 0);
5752 const QPoint widgetPos(
w->data->crect.topLeft());
5757 wr -= hasMask ? wd->
extra->mask.translated(widgetPos) :
w->data->crect;
5762 if (
w->updatesEnabled()
5764 && (!
w->d_func()->extra || !
w->d_func()->extra->proxyWidget)
5771 wRegion &= wd->
extra->mask;
5776#if QT_CONFIG(graphicseffect)
5780 return m_widget->rect();
5784 qWarning(
"QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
5788 return context->painter->worldTransform().mapRect(m_widget->rect());
5801 toBePainted &= m_widget->rect();
5804 toBePainted &= wd->
extra->mask;
5816 qWarning(
"QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
5821 QRectF sourceRect = m_widget->rect();
5823 if (deviceCoordinates) {
5825 sourceRect = painterTransform.
mapRect(sourceRect);
5826 pixmapOffset = painterTransform.
map(pixmapOffset);
5832 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
5841 pixmapOffset -= effectRect.
topLeft();
5844 if (
const auto *paintDevice =
context->painter->device())
5845 dpr = paintDevice->devicePixelRatio();
5847 qWarning(
"QWidgetEffectSourcePrivate::pixmap: Painter not active");
5857#if QT_CONFIG(graphicsview)
5869 const auto &
extra = origin->d_func()->extra;
5871 return extra->proxyWidget;
5872 return nearestGraphicsProxyWidget(origin->
parentWidget());
5976 if (
d->extra &&
d->extra->topextra) {
5977 if (!
d->extra->topextra->caption.isEmpty())
5978 return d->extra->topextra->caption;
5979 if (!
d->extra->topextra->filePath.isEmpty())
6004 const auto placeHolder =
"[*]"_L1;
6005 int index =
cap.indexOf(placeHolder);
6008 while (
index != -1) {
6009 index += placeHolder.size();
6013 index += placeHolder.size();
6017 int lastIndex =
cap.lastIndexOf(placeHolder,
index - 1);
6020 cap.replace(lastIndex, 3, QWidget::tr(
"*"));
6022 cap.remove(lastIndex, 3);
6028 cap.replace(
"[*][*]"_L1, placeHolder);
6047 window->setTitle(caption);
6065 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
window->handle()))
6066 xcbWindow->setWindowIconText(iconText);
6091 d->topData()->iconText = iconText;
6092 d->setWindowIconText_helper(iconText);
6115 d->topData()->caption =
title;
6116 d->setWindowTitle_helper(
title);
6144 if (
d->extra &&
d->extra->topextra &&
d->extra->topextra->icon)
6145 return *
d->extra->topextra->icon;
6146 w =
w->parentWidget();
6160 if (!
q->windowHandle())
6164 if (
w && !
w->isWindow())
6185 if (!
d->extra->topextra->icon)
6186 d->extra->topextra->icon = std::make_unique<QIcon>(
icon);
6188 *
d->extra->topextra->icon =
icon;
6190 d->setWindowIcon_sys();
6191 d->setWindowIcon_helper();
6200 window->setIcon(
q->windowIcon());
6221 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->iconText :
QString();
6251 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->filePath :
QString();
6262 d->extra->topextra->filePath = filePath;
6263 d->setWindowFilePath_helper(filePath);
6268 if (
extra->topextra &&
extra->topextra->caption.isEmpty()) {
6289 window->setFilePath(filePath);
6301 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->role :
QString();
6313 d->topData()->role = role;
6316 xcbWindow->setWindowRole(role);
6375 if (!
w && !
d->extra)
6388 d->extra->focus_proxy =
w;
6398 QWidget *firstChild =
nullptr;
6407 oldNext->d_func()->focus_prev = oldPrev;
6408 oldPrev->d_func()->focus_next = oldNext;
6410 oldPrev = firstChild->d_func()->focus_prev;
6411 d->focus_next = firstChild;
6412 d->focus_prev = oldPrev;
6413 oldPrev->d_func()->focus_next =
this;
6414 firstChild->d_func()->focus_prev =
this;
6415 }
else if (
w &&
w->isAncestorOf(
this)) {
6420 QWidget *parentsNext =
w->d_func()->focus_next;
6421 if (parentsNext ==
this) {
6426 QWidget *myOldNext =
d->focus_next;
6427 QWidget *myOldPrev =
d->focus_prev;
6428 if (myOldNext && myOldPrev) {
6429 myOldNext->d_func()->focus_prev = myOldPrev;
6430 myOldPrev->d_func()->focus_next = myOldNext;
6434 w->d_func()->focus_next =
this;
6436 d->focus_next = parentsNext;
6437 parentsNext->d_func()->focus_prev =
this;
6441 if (moveFocusToProxy)
6455 return d->extra ?
d->extra->focus_proxy.data() :
nullptr;
6474 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
6475 w =
w->d_func()->extra->focus_proxy;
6476#if QT_CONFIG(graphicsview)
6478 const auto &
e =
window->d_func()->extra;
6526 QWidget *
f = d_func()->deepestFocusProxy();
6533#if QT_CONFIG(graphicsview)
6534 QWidget *previousProxyFocus =
nullptr;
6535 if (
const auto &topData =
window()->d_func()->extra) {
6536 if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
6537 previousProxyFocus = topData->proxyWidget->widget()->
focusWidget();
6538 if (previousProxyFocus && previousProxyFocus->
focusProxy())
6539 previousProxyFocus = previousProxyFocus->
focusProxy();
6540 if (previousProxyFocus ==
f && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
6546#if QT_CONFIG(graphicsview)
6548 if (
const auto &topData =
window()->d_func()->extra) {
6549 if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {
6550 f->d_func()->updateFocusChild();
6551 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
6552 topData->proxyWidget->
setFocus(reason);
6553 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
6558 if (
f->isActiveWindow()) {
6572 f->d_func()->updateFocusChild();
6575#if QT_CONFIG(accessibility)
6577 if (!(
f->inherits(
"QMenuBar") ||
f->inherits(
"QMenu") ||
f->inherits(
"QMenuItem")))
6579 QAccessibleEvent
event(
f, QAccessible::Focus);
6580 QAccessible::updateAccessibility(&
event);
6583#if QT_CONFIG(graphicsview)
6584 if (
const auto &topData =
window()->d_func()->extra) {
6585 if (topData->proxyWidget) {
6586 if (previousProxyFocus && previousProxyFocus !=
f) {
6595#if QT_CONFIG(graphicsview)
6597 if (
const auto &topData =
window()->d_func()->extra)
6598 if (topData->proxyWidget && topData->proxyWidget->hasFocus())
6599 topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
6612 f->d_func()->updateFocusChild();
6632 focusProxy = nextFocusProxy;
6639 const auto platformWindow =
w->handle();
6640 return platformWindow && platformWindow->isEmbedded();
6666 if (
q->isHidden()) {
6667 while (
w &&
w->isHidden()) {
6668 w->d_func()->focus_child =
q;
6669 w =
w->isWindow() ?
nullptr :
w->parentWidget();
6673 w->d_func()->focus_child =
q;
6674 w =
w->isWindow() ?
nullptr :
w->parentWidget();
6717 QObject *originalFocusObject =
nullptr;
6718 if (extra && extra->
window) {
6722 if (!originalFocusObject)
6729 if (
w->d_func()->focus_child ==
this)
6730 w->d_func()->focus_child =
nullptr;
6741#if QT_CONFIG(graphicsview)
6742 const auto &topData = d_func()->extra;
6743 if (topData && topData->proxyWidget)
6744 topData->proxyWidget->clearFocus();
6750#if QT_CONFIG(accessibility)
6751 QAccessibleEvent
event(
this, QAccessible::Focus);
6752 QAccessible::updateAccessibility(&
event);
6805 return p->focusNextPrevChild(
next);
6806#if QT_CONFIG(graphicsview)
6808 if (
d->extra &&
d->extra->proxyWidget)
6809 return d->extra->proxyWidget->focusNextPrevChild(
next);
6812 bool wrappingOccurred =
false;
6815 if (!
w)
return false;
6824 if (wrappingOccurred) {
6833 if (
event.isAccepted())
return true;
6838 w->setFocus(reason);
6853 return const_cast<QWidget *
>(d_func()->focus_child);
6870 return const_cast<QWidget *
>(d_func()->focus_next);
6883 return const_cast<QWidget *
>(d_func()->focus_prev);
6907#if QT_CONFIG(graphicsview)
6908 if (
const auto &tlwExtra = tlw->d_func()->extra) {
6909 if (
isVisible() && tlwExtra->proxyWidget)
6910 return tlwExtra->proxyWidget->isActiveWindow();
6921 !
w->isModal() &&
w->parentWidget()) {
6922 w =
w->parentWidget()->window();
6946 return w->handle()->isActive();
7010 qWarning(
"QWidget::setTabOrder: 'first' and 'second' must be in the same window");
7029 for (
auto *
object :
target->children()) {
7031 if (
w &&
w->focusProxy() ==
target) {
7038 for (
QWidget *focusNext = lastFocusChild->d_func()->focus_next;
7040 focusNext = focusNext->d_func()->focus_next) {
7041 if (focusNext == noFurtherThan)
7044 lastFocusChild = focusNext;
7047 return lastFocusChild;
7050 w->d_func()->focus_prev = prev;
7053 w->d_func()->focus_next =
next;
7057 QWidget *lastFocusChildOfFirst = determineLastFocusChild(
first, second);
7058 if (lastFocusChildOfFirst == second)
7059 lastFocusChildOfFirst =
first;
7060 QWidget *lastFocusChildOfSecond = determineLastFocusChild(second,
first);
7061 if (lastFocusChildOfSecond ==
first)
7062 lastFocusChildOfSecond = second;
7066 QWidget *oldPrev = second->d_func()->focus_prev;
7067 QWidget *prevWithFocus = oldPrev;
7069 prevWithFocus = prevWithFocus->d_func()->focus_prev;
7071 if (prevWithFocus ==
first)
7073 QWidget *oldNext = lastFocusChildOfSecond->d_func()->focus_next;
7074 setPrev(oldNext, oldPrev);
7075 setNext(oldPrev, oldNext);
7080 QWidget *oldNext = lastFocusChildOfFirst->d_func()->focus_next;
7081 setPrev(second, lastFocusChildOfFirst);
7082 setNext(lastFocusChildOfFirst, second);
7083 setPrev(oldNext, lastFocusChildOfSecond);
7084 setNext(lastFocusChildOfSecond, oldNext);
7115 bool prevWasNew =
true;
7126 n->d_func()->focus_next =
w;
7127 w->d_func()->focus_prev =
n;
7134 o->d_func()->focus_next =
w;
7135 w->d_func()->focus_prev =
o;
7143 w =
w->d_func()->focus_next;
7144 prevWasNew = currentIsNew;
7149 o->d_func()->focus_next = firstOld;
7150 firstOld->d_func()->focus_prev =
o;
7153 if (!
q->isWindow()) {
7157 QWidget *prev = topLevel->d_func()->focus_prev;
7159 topLevel->d_func()->focus_prev =
n;
7160 prev->d_func()->focus_next =
q;
7163 n->d_func()->focus_next = topLevel;
7166 n->d_func()->focus_next =
q;
7183 QRect fs =
d->frameStrut();
7187 return data->crect.size();
7203 d->topData()->posIncludesFrame =
false;
7207 d->setDirtyOpaqueRegion();
7211 d->topData()->posIncludesFrame =
true;
7212 data->crect.moveTopLeft(
p);
7216 if (
d->extra &&
d->extra->hasWindowContainer)
7233 if (te->posIncludesFrame) {
7237 te->posIncludesFrame = 0;
7239 if (
q->windowHandle() &&
q->windowHandle()->handle()) {
7241 if (!
q->data->fstrut_dirty) {
7242 data.crect.translate(te->frameStrut.x(), te->frameStrut.y());
7243 te->posIncludesFrame = 0;
7262 d->fixPosIncludesFrame();
7264 d->setDirtyOpaqueRegion();
7266 const auto oldRect =
data->crect;
7268 if (oldRect !=
data->crect)
7279 d->topData()->posIncludesFrame = 0;
7281 d->setGeometry_sys(
r.x(),
r.y(),
r.width(),
r.height(),
true);
7282 d->setDirtyOpaqueRegion();
7284 const auto oldRect =
data->crect;
7285 data->crect.setTopLeft(
r.topLeft());
7287 if (oldRect !=
data->crect) {
7293 if (
d->extra &&
d->extra->hasWindowContainer)
7307 if (
q->isWindow() &&
q->windowHandle()) {
7312 w =
q->windowHandle()->width();
7313 h =
q->windowHandle()->height();
7317 QPoint oldp =
q->geometry().topLeft();
7321 bool isResize = olds !=
r.size();
7323 isMove = oldp !=
r.topLeft();
7328 if (
r.size() == olds && oldp ==
r.topLeft())
7331 if (!
data.in_set_window_state) {
7332 q->data->window_state &=
~Qt::WindowMaximized;
7333 q->data->window_state &=
~Qt::WindowFullScreen;
7341 bool needsShow =
false;
7343 if (
q->isWindow() ||
q->windowHandle()) {
7355 if (
q->isVisible()) {
7358 if (
q->isWindow()) {
7359 if (isResize && !isMove)
7361 else if (isMove && !isResize)
7362 win->setPosition(
x,
y);
7366 QPoint posInNativeParent =
q->mapTo(
q->nativeParentWidget(),
QPoint());
7374 if (!
q->isWindow()) {
7376 QRegion updateRegion(
q->geometry());
7377 updateRegion +=
QRect(oldPos, olds);
7378 q->parentWidget()->d_func()->invalidateBackingStore(updateRegion);
7379 }
else if (isMove && !isResize) {
7394 if (
q->windowHandle())
7398 if (isMove &&
q->pos() != oldPos)
7428 const quint32 magicNumber = 0x1D9D0CB;
7476 const int height = restoredGeometry->
height() + frameHeight;
7481 restoredGeometry->
setHeight(availableGeometry.
height() - 2 - frameHeight);
7482 if (availableGeometry.
width() <= restoredGeometry->
width())
7487 const QRect restored = restoredGeometry->
adjusted(0, -frameHeight, 0, 0);
7490 if (availableGeometry.
contains(restored))
7496 if (restored.
top() <= availableGeometry.
top()) {
7497 restoredGeometry->
moveTop(availableGeometry.
top() + 1 + frameHeight);
7498 }
else if (restored.
bottom() >= availableGeometry.
bottom()) {
7504 if (restored.
left() <= availableGeometry.
left()) {
7505 restoredGeometry->
moveLeft(availableGeometry.
left() + 1);
7506 }
else if (restored.
right() >= availableGeometry.
right()) {
7542 const quint32 magicNumber = 0x1D9D0CB;
7544 stream >> storedMagicNumber;
7545 if (storedMagicNumber != magicNumber)
7552 stream >> majorVersion >> minorVersion;
7558 QRect restoredFrameGeometry;
7559 QRect restoredGeometry;
7560 QRect restoredNormalGeometry;
7561 qint32 restoredScreenNumber;
7564 qint32 restoredScreenWidth = 0;
7566 stream >> restoredFrameGeometry
7567 >> restoredNormalGeometry
7568 >> restoredScreenNumber
7572 if (majorVersion > 1)
7573 stream >> restoredScreenWidth;
7574 if (majorVersion > 2)
7575 stream >> restoredGeometry;
7580 restoredScreenNumber = 0;
7585 if (restoredScreenWidth) {
7586 const qreal factor =
qreal(restoredScreenWidth) / screenWidthF;
7587 if (factor < 0.8 || factor > 1.25)
7600 if (!restoredNormalGeometry.
isValid())
7602 if (!restoredNormalGeometry.
isValid()) {
7604 restoredNormalGeometry.
setSize(restoredNormalGeometry
7606 .expandedTo(d_func()->adjustedSize()));
7634 if (restoredScreen !=
screen()) {
7647 d_func()->topData()->normalGeometry = restoredNormalGeometry;
7652 if (majorVersion > 2)
7679 if (
left ==
d->leftmargin &&
top ==
d->topmargin
7682 d->leftmargin =
left;
7687 d->updateContentsRect();
7719 q->updateGeometry();
7721 if (
q->isVisible()) {
7743 QMargins userMargins(
d->leftmargin,
d->topmargin,
d->rightmargin,
d->bottommargin);
7745 userMargins |
d->safeAreaMargins() : userMargins;
7766 if (!platformWindow)
7771 if (!
q->isWindow()) {
7785 const QWidget *assumedSafeWidget =
nullptr;
7801 assumedSafeWidget =
w;
7805#if !defined(QT_DEBUG)
7806 if (assumedSafeWidget) {
7818 QRect widgetRect =
q->isVisible() ?
q->visibleRegion().boundingRect() :
q->rect();
7824 qMax(0, bottomRightMargins.
x()),
qMax(0, bottomRightMargins.
y()));
7908 if (
d->extra &&
d->extra->focus_proxy)
7909 d->extra->focus_proxy->setFocusPolicy(
policy);
7944 d->setUpdatesEnabled_helper(
enable);
7979 q->ensurePolished();
7981 if (!
q->isWindow() &&
q->parentWidget()->d_func()->layout && !
q->parentWidget()->data->in_show)
7982 q->parentWidget()->d_func()->layout->activate();
7994 disableUpdates = disableUpdates &&
q->updatesEnabled();
8018 child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
8031 child->ensurePolished();
8035 if (childPrivate->
layout)
8039 const bool wasVisible =
child->isVisible();
8055 data.in_show =
true;
8068#if QT_CONFIG(graphicsview)
8092#if QT_CONFIG(graphicsview)
8096 if (ancestorProxy) {
8098 ancestorProxy->d_func()->embedSubWindow(
q);
8113 qApp->d_func()->openPopup(
q);
8115#if QT_CONFIG(accessibility)
8117 QAccessibleEvent
event(
q, QAccessible::ObjectShow);
8118 QAccessible::updateAccessibility(&
event);
8133 data.in_show =
false;
8169 QRect geomRect =
q->geometry();
8170 if (!
q->isWindow()) {
8171 QPoint topLeftOfWindow =
q->mapTo(
q->nativeParentWidget(),
QPoint());
8175 if (windowRect != geomRect) {
8178 window->setGeometry(geomRect);
8187 window->setNativeWindowVisibility(
true);
8189 if (
window->isTopLevel()) {
8190 const QPoint crectTopLeft =
q->data->crect.topLeft();
8191 const QPoint windowTopLeft =
window->geometry().topLeft();
8192 if (crectTopLeft ==
QPoint(0, 0) && windowTopLeft != crectTopLeft)
8193 q->data->crect.moveTopLeft(windowTopLeft);
8221#if QT_CONFIG(graphicsview)
8228 qApp->d_func()->closePopup(
q);
8247 qApp->d_func()->sendSyntheticEnterLeave(
q);
8251 q->focusNextPrevChild(
true);
8259 repaintManager->removeDirtyWidget(
q);
8261#if QT_CONFIG(accessibility)
8263 QAccessibleEvent
event(
q, QAccessible::ObjectHide);
8264 QAccessible::updateAccessibility(&
event);
8290 if (!
q->isWindow()) {
8292 if (
p &&
p->isVisible()) {
8294 p->d_func()->invalidateBackingStore(
q->geometry());
8303 window->setNativeWindowVisibility(
false);
8349 if (!
q->isWindow() &&
q->parentWidget() &&
q->parentWidget()->isVisible()
8351 q->parentWidget()->window()->d_func()->createRecursively();
8361 Qt::WindowStates initialWindowState =
q->windowState();
8364 q->ensurePolished();
8371 if (needUpdateGeometry)
8378 if (!
q->isWindow()) {
8381 parent->d_func()->layout->activate();
8387 parent->d_func()->setDirtyOpaqueRegion();
8392 && (
q->isWindow() || !
q->parentWidget()->d_func()->layout)) {
8393 if (
q->isWindow()) {
8395 if (
q->windowState() != initialWindowState)
8396 q->setWindowState(initialWindowState);
8405 if (
q->isWindow() ||
q->parentWidget()->isVisible()) {
8408 qApp->d_func()->sendSyntheticEnterLeave(
q);
8421 if (!
q->isWindow() &&
q->parentWidget())
8431 if (!
q->isWindow() &&
q->parentWidget()) {
8432 if (
q->parentWidget()->d_func()->layout)
8433 q->parentWidget()->d_func()->layout->invalidate();
8434 else if (
q->parentWidget()->isVisible())
8455 q->setVisible(
true);
8461 for (
int i = 0;
i < childList.
size(); ++
i) {
8471 widget->d_func()->showChildren(
true);
8473 QApplication::sendSpontaneousEvent(
widget, &
e);
8476 widget->d_func()->show_recursive();
8487 for (
int i = 0;
i < childList.
size(); ++
i) {
8496 widget->d_func()->hideChildren(spontaneous);
8499 QApplication::sendSpontaneousEvent(
widget, &
e);
8506 widget->d_func()->hide_sys();
8509 qApp->d_func()->sendSyntheticEnterLeave(
widget);
8510#if QT_CONFIG(accessibility)
8512 QAccessibleEvent
event(
widget, QAccessible::ObjectHide);
8513 QAccessible::updateAccessibility(&
event);
8522 widgetWindow && widgetWindow->data->is_closing) {
8547 if (
data.is_closing)
8551 data.is_closing =
true;
8556 if (
data.in_destructor)
8562 QApplication::sendSpontaneousEvent(
q, &
e);
8565 if (!that.
isNull() && !
e.isAccepted()) {
8566 data.is_closing =
false;
8572 if (!that.
isNull() && !
q->isHidden())
8576 data.is_closing =
false;
8610 return d_func()->close();
8624 if (widgetWindow->isTopLevel())
8625 return widgetWindow->close();
8694 while (!
w->isHidden()
8696 &&
w->parentWidget()
8697 &&
w->parentWidget() != ancestor)
8717 QRect clipRect =
d->clipRect();
8721 d->subtractOpaqueChildren(
r, clipRect);
8722 d->subtractOpaqueSiblings(
r);
8733 if (
q->isWindow()) {
8734 Qt::Orientations exp;
8741 if (
q->sizePolicy().hasHeightForWidth())
8742 s.setHeight(
q->heightForWidth(
s.width()));
8743 exp =
q->sizePolicy().expandingDirections();
8746 s.setWidth(
qMax(
s.width(), 200));
8748 s.setHeight(
qMax(
s.height(), 100));
8760 extra->sizeAdjusted =
true;
8767 s =
r.size() +
QSize(2 *
r.x(), 2 *
r.y());
8796 d->layout->activate();
8822 return d->layout->totalSizeHint();
8823 return QSize(-1, -1);
8849 return d->layout->totalMinimumSize();
8850 return QSize(-1, -1);
8873 if (
child->isWindow())
8918 switch(
event->type()) {
8933#if QT_CONFIG(wheelevent)
8941 switch (
event->type()) {
8974#if QT_CONFIG(wheelevent)
8976 wheelEvent((QWheelEvent*)
event);
8979#if QT_CONFIG(tabletevent)
8986 tabletEvent((QTabletEvent*)
event);
9002#ifdef QT_KEYPAD_NAVIGATION
9003 if (!k->
isAccepted() && QApplication::keypadNavigationEnabled()
9026#if QT_CONFIG(whatsthis)
9029 &&
d->whatsThis.size()) {
9050 for (
uint i = 0;
i < 32; ++
i) {
9080 d->resolvePalette();
9086 d->setWindowIcon_sys();
9087 d->setWindowIcon_helper();
9092 d->updateWidgetTransform(
event);
9100#if QT_CONFIG(statustip)
9101 if (
d->statusTip.size()) {
9110#if QT_CONFIG(statustip)
9111 if (
d->statusTip.size()) {
9134 d->updateWidgetTransform(
event);
9139 d->updateWidgetTransform(
event);
9146#ifndef QT_NO_CONTEXTMENU
9148 switch (
data->context_menu_policy) {
9159 if (
d->actions.size()) {
9173#if QT_CONFIG(draganddrop)
9175 dropEvent((QDropEvent*)
event);
9179 dragEnterEvent((QDragEnterEvent*)
event);
9183 dragMoveEvent((QDragMoveEvent*)
event);
9187 dragLeaveEvent((QDragLeaveEvent*)
event);
9209 d->resolvePalette();
9238 if (!
d->childrenShownByExpose) {
9240 d->showChildren(
true);
9244 d->childrenHiddenByWState =
false;
9248 d->hideChildren(
true);
9249 d->childrenHiddenByWState =
true;
9251 d->childrenShownByExpose =
false;
9262 for (
int i = 0;
i < childList.
size(); ++
i) {
9264 if (
w &&
w->isVisible() && !
w->isWindow())
9273 for (
int i = 0;
i < childList.
size(); ++
i) {
9283 d->resolveLayoutDirection();
9288 d->layout->invalidate();
9293 d->syncBackingStore();
9307 if (!
d->children.isEmpty()) {
9309 for (
int i = 0;
i <
d->children.size(); ++
i) {
9311 if (
o &&
o != modalWidget &&
o->isWidgetType()) {
9320#if QT_CONFIG(tooltip)
9322 if (!
d->toolTip.isEmpty())
9328#if QT_CONFIG(whatsthis)
9330 if (
d->whatsThis.size())
9336 if (
d->whatsThis.isEmpty())
9341 d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
9342 data->fstrut_dirty =
false;
9358 for (
int i = 0;
i < childList.
size(); ++
i) {
9360 if (
w &&
w->isVisible() && !
w->isWindow())
9373#ifndef QT_NO_GESTURES
9379 if (
const QTLWExtra *te =
d->maybeTopData()) {
9386 d->updateFont(
d->data.fnt);
9387 d->renderToTextureReallyDirty = 1;
9391 if (propName.
size() == 13 && !
qstrncmp(propName,
"_q_customDpi", 12)) {
9395 const char axis = propName.
at(12);
9397 d->extra->customDpiX =
value;
9398 else if (axis ==
'Y')
9399 d->extra->customDpiY =
value;
9400 d->updateFont(
d->data.fnt);
9430 switch(
event->type()) {
9433#if QT_CONFIG(accessibility)
9436 QAccessibleStateChangeEvent
event(
this,
s);
9437 QAccessible::updateAccessibility(&
event);
9448 d->layout->invalidate();
9581#if QT_CONFIG(wheelevent)
9596void QWidget::wheelEvent(QWheelEvent *
event)
9602#if QT_CONFIG(tabletevent)
9623void QWidget::tabletEvent(QTabletEvent *
event)
9654#ifndef QT_NO_SHORTCUT
9742#if !defined(QT_PLATFORM_UIKIT)
9907#ifndef QT_NO_CONTEXTMENU
9972 return d_func()->clipRect();
10007 while (
priv->inheritsInputMethodHints) {
10008 priv =
priv->q_func()->parentWidget()->d_func();
10011 return priv->imHints;
10021 if (
d->imHints == hints)
10023 d->imHints = hints;
10032#if QT_CONFIG(draganddrop)
10048void QWidget::dragEnterEvent(QDragEnterEvent *)
10066void QWidget::dragMoveEvent(QDragMoveEvent *)
10082void QWidget::dragLeaveEvent(QDragLeaveEvent *)
10097void QWidget::dropEvent(QDropEvent *)
10211 if (
m ==
d->polished)
10222 if (!
o->isWidgetType())
10225 w->ensurePolished();
10228 if (
d->parent &&
d->sendChildEvents) {
10243 return d->extra ?
d->extra->mask :
QRegion();
10257 return d_func()->
layout;
10289 qWarning(
"QWidget::setLayout: Cannot set layout to 0");
10294 qWarning(
"QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a"
10301 if (oldParent && oldParent !=
this) {
10306 oldParentWidget->takeLayout();
10308 qWarning(
"QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
10316 l->d_func()->topLevel =
true;
10318 if (oldParent !=
this) {
10320 l->d_func()->reparentChildWidgets(
this);
10325 d->topData()->sizeAdjusted =
false;
10335QLayout *QWidget::takeLayout()
10341 d->layout =
nullptr;
10374 return d->size_policy;
10381 if (
policy ==
d->size_policy)
10385 d->retainSizeWhenHiddenChanged = 1;
10389#if QT_CONFIG(graphicsview)
10390 if (
const auto &extra =
d->extra) {
10391 if (extra->proxyWidget)
10392 extra->proxyWidget->setSizePolicy(
policy);
10397 d->retainSizeWhenHiddenChanged = 0;
10400 d->topData()->sizeAdjusted =
false;
10438 return d->layout ?
d->layout->hasHeightForWidth() :
d->size_policy.hasHeightForWidth();
10458 return d_func()->childAt_helper(
p,
false);
10476 || (ignoreChildrenInDestructor &&
child->data->in_destructor)) {
10482 childPoint -=
child->data->crect.topLeft();
10485 if (!
child->d_func()->pointInsideRectAndMask(childPoint))
10489 if (
QWidget *
w =
child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
10507 if (!
q->isWindow() && !isHidden && (
parent =
q->parentWidget())) {
10508 if (
parent->d_func()->layout)
10509 parent->d_func()->layout->invalidate();
10510 else if (
parent->isVisible())
10529 d->updateGeometry_helper(
false);
10553 d->setWindowFlags(
flags);
10568 d->setWindowFlags(
data->window_flags | flag);
10570 d->setWindowFlags(
data->window_flags & ~flag);
10580 if (
q->data->window_flags ==
flags)
10586 bool visible =
q->isVisible();
10587 const bool windowFlagChanged = (
q->data->window_flags ^
flags) &
Qt::Window;
10588 q->setParent(
q->parentWidget(),
flags);
10592 if (!windowFlagChanged && (visible ||
q->testAttribute(
Qt::WA_Moved)))
10597 q->data->window_flags =
flags;
10662 if (
d->renderToTexture) {
10667 for (
int i = 0;
i <
d->children.size(); ++
i) {
10685 const auto checkForParentChildLoops =
qScopeGuard([&](){
10689 if (++
depth == QObjectPrivate::CheckForParentChildLoopsWarnDepth) {
10690 qWarning(
"QWidget %p (class: '%s', object name: '%s') may have a loop in its parent-child chain; "
10691 "this is undefined behavior",
10694 p =
p->parentWidget();
10704 d->data.fstrut_dirty =
true;
10706 QWidget *desktopWidget =
nullptr;
10711 if (newParent &&
parent && !desktopWidget) {
10713 parent->d_func()->enforceNativeChildren();
10744 if (
d->textureChildSeen &&
parent) {
10751 oldPaintManager->removeDirtyWidget(
this);
10754 oldPaintManager->moveStaticWidgets(
this);
10757 d->reparentFocusWidgets(oldtlw);
10760 const bool useStyleSheetPropagationInWidgetStyles =
10767 const auto pd =
parent->d_func();
10768 d->inheritedFontResolveMask = pd->directFontResolveMask | pd->inheritedFontResolveMask;
10769 d->inheritedPaletteResolveMask = pd->directPaletteResolveMask | pd->inheritedPaletteResolveMask;
10772 d->resolvePalette();
10774 d->resolveLayoutDirection();
10775 d->resolveLocale();
10781 if (newParent || !wasCreated
10791 d->setUpdatesEnabled_helper(
parent ?
parent->updatesEnabled() :
true);
10796 if (
parent &&
d->sendChildEvents) {
10801 if (
parent &&
d->sendChildEvents &&
d->polished) {
10812 if (
d->textureChildSeen && oldtlw !=
window())
10822 d->updateIsOpaque();
10824#if QT_CONFIG(graphicsview)
10827 if (oldtlw->graphicsProxyWidget()) {
10829 ancestorProxy->d_func()->unembedSubWindow(
this);
10833 ancestorProxy->d_func()->embedSubWindow(
this);
10837 if (
d->extra &&
d->extra->hasWindowContainer)
10841 if (oldtlw != newtlw) {
10847 newtlw->d_func()->usesRhiFlush =
true;
10849 if (
w->surfaceType() != surfaceType) {
10862 Qt::WindowFlags oldFlags =
data.window_flags;
10865 QScreen *targetScreen =
nullptr;
10870 targetScreen = newparent->
screen();
10871 newparent =
nullptr;
10876 if (
parent != newparent) {
10878 if (
q->windowHandle()) {
10879 q->windowHandle()->setFlags(
f);
10882 if (parentWithWindow) {
10886 q->windowHandle()->setParent(
nullptr);
10888 q->windowHandle()->setTransientParent(
nullptr);
10889 q->windowHandle()->setParent(parentWithWindow->
windowHandle());
10892 q->windowHandle()->setTransientParent(
nullptr);
10893 q->windowHandle()->setParent(
nullptr);
10901 targetScreen =
q->parentWidget()->window()->screen();
10912 if (!newParentWindow)
10914 newParentWindow = npw->windowHandle();
10921 QWidgetWindow *childWW = qobject_cast<QWidgetWindow *>(childWindow);
10922 QWidget *childWidget = childWW ? childWW->
widget() :
nullptr;
10924 childWindow->setParent(newParentWindow);
10930 data.window_flags =
f;
10938 if (
q->isWindow() || (!newparent || newparent->
isVisible()) || explicitlyHidden)
10943 if (!newparent && targetScreen) {
10946 q->windowHandle()->setScreen(targetScreen);
10977 if (dx == 0 && dy == 0)
10980#if QT_CONFIG(graphicsview)
10987 proxy->scroll(dx, dy,
proxy->subWidgetRect(
this));
10991 d->setDirtyOpaqueRegion();
10992 d->scroll_sys(dx, dy);
11017 if (dx == 0 && dy == 0)
11020#if QT_CONFIG(graphicsview)
11025 if (!
d->dirty.isEmpty()) {
11026 for (
const QRect &
rect :
d->dirty.translated(dx, dy) &
r)
11029 proxy->scroll(dx, dy,
r.translated(
proxy->subWidgetRect(
this).topLeft().toPoint()));
11033 d->scroll_sys(dx, dy,
r);
11072 if (
x >
data->crect.width() ||
y >
data->crect.height())
11076 w =
data->crect.width() -
x;
11078 h =
data->crect.height() -
y;
11104template <
typename T>
11109 if (!
q->isVisible() || !
q->updatesEnabled() ||
r.isEmpty())
11169template <
typename T>
11179 if (!
q->isVisible() || !
q->updatesEnabled())
11182 T clipped =
r &
q->rect();
11184 if (clipped.isEmpty())
11212 const int int_off =
x / (8*
sizeof(
uint));
11214 d->high_attributes[int_off] |= (1<<(
x-(int_off*8*
sizeof(
uint))));
11216 d->high_attributes[int_off] &= ~(1<<(
x-(int_off*8*
sizeof(
uint))));
11221void QWidgetPrivate::macUpdateSizeAttribute()
11232 w->d_func()->macUpdateSizeAttribute();
11251 "QWidget::setAttribute(WidgetAttribute, bool): "
11252 "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
11258 if (
d->noPaintOnScreen)
11274#if QT_CONFIG(draganddrop)
11285 for (
int i = 0;
i <
d->children.size(); ++
i) {
11295 d->sendChildEvents = !on;
11298 d->receiveChildEvents = !on;
11308 for (
int i = 0;
i < 3; ++
i) {
11312 d->macUpdateSizeAttribute();
11342 d->createTLExtra();
11344 d->createTLSysExtra();
11364 d->updateIsOpaque();
11367 d->updateIsOpaque();
11370 d->updateIsOpaque();
11373 d->updateSystemBackground();
11388 d->resolvePalette();
11390 d->resolveLocale();
11416 d->setNetWmWindowTypes();
11422 repaintManager->addStaticWidget(
this);
11424 repaintManager->removeStaticWidget(
this);
11430 d->updateIsTranslucent();
11451 const int int_off =
x / (8*
sizeof(
uint));
11452 return (
d->high_attributes[int_off] & (1<<(
x-(int_off*8*
sizeof(
uint)))));
11483 return (
isWindow() &&
d->maybeTopData()) ?
d->maybeTopData()->opacity / 255. : 1.0;
11496 d->setWindowOpacity_sys(opacity);
11501#if QT_CONFIG(graphicsview)
11516 if (
q->windowHandle())
11517 q->windowHandle()->setOpacity(
level);
11554 d->setWindowModified_helper();
11567 if (!platformWindow)
11571 if (
Q_UNLIKELY(on && !
q->windowTitle().contains(
"[*]"_L1)))
11572 qWarning(
"QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
11578#if QT_CONFIG(tooltip)
11597void QWidget::setToolTip(
const QString &
s)
11606QString QWidget::toolTip()
const
11623void QWidget::setToolTipDuration(
int msec)
11626 d->toolTipDuration = msec;
11629int QWidget::toolTipDuration()
const
11632 return d->toolTipDuration;
11638#if QT_CONFIG(statustip)
11647void QWidget::setStatusTip(
const QString &
s)
11653QString QWidget::statusTip()
const
11656 return d->statusTip;
11660#if QT_CONFIG(whatsthis)
11670void QWidget::setWhatsThis(
const QString &
s)
11676QString QWidget::whatsThis()
const
11679 return d->whatsThis;
11683#if QT_CONFIG(accessibility)
11705void QWidget::setAccessibleName(
const QString &
name)
11708 d->accessibleName =
name;
11709 QAccessibleEvent
event(
this, QAccessible::NameChanged);
11710 QAccessible::updateAccessibility(&
event);
11713QString QWidget::accessibleName()
const
11716 return d->accessibleName;
11735void QWidget::setAccessibleDescription(
const QString &description)
11738 d->accessibleDescription = description;
11739 QAccessibleEvent
event(
this, QAccessible::DescriptionChanged);
11740 QAccessible::updateAccessibility(&
event);
11743QString QWidget::accessibleDescription()
const
11746 return d->accessibleDescription;
11750#ifndef QT_NO_SHORTCUT
11867 const int parentChildCount =
p->d_func()->children.size();
11868 if (parentChildCount < 2)
11870 const int from =
p->d_func()->children.indexOf(
this);
11873 if (from != parentChildCount -1)
11874 p->d_func()->children.move(from, parentChildCount - 1);
11877 else if (from == parentChildCount - 1)
11881 d->subtractOpaqueSiblings(region);
11882 d->invalidateBackingStore(region);
11887 if (
d->extra &&
d->extra->hasWindowContainer)
11898 q->windowHandle()->raise();
11921 const int parentChildCount =
p->d_func()->children.size();
11922 if (parentChildCount < 2)
11924 const int from =
p->d_func()->children.indexOf(
this);
11928 p->d_func()->children.move(from, 0);
11931 else if (from == 0)
11937 if (
d->extra &&
d->extra->hasWindowContainer)
11949 q->windowHandle()->lower();
11967 if (!
w ||
isWindow() ||
p !=
w->parentWidget() ||
this ==
w)
11970 int from =
p->d_func()->children.indexOf(
this);
11971 int to =
p->d_func()->children.indexOf(
w);
11978 p->d_func()->children.move(from, to);
11981 else if (from == to)
11985 d->stackUnder_sys(
w);
12045 return QRect(0, 0, 1, 1);
12048 if (
data.fstrut_dirty
12060 if (
q->data->fstrut_dirty) {
12062 if (te->window && te->window->handle()) {
12063 const QMargins margins = te->window->frameMargins();
12064 if (!margins.
isNull()) {
12065 te->frameStrut.setCoords(margins.
left(), margins.
top(), margins.
right(), margins.
bottom());
12066 q->data->fstrut_dirty =
false;
12073#ifdef QT_KEYPAD_NAVIGATION
12082bool QWidgetPrivate::navigateToDirection(Direction
direction)
12087 return (targetWidget != 0);
12105 const int sourceX =
12107 (sourceRect.
left() + (sourceRect.
right() - sourceRect.
left()) / 2)
12109 const int sourceY =
12111 (sourceRect.
top() + (sourceRect.
bottom() - sourceRect.
top()) / 2)
12113 const QPoint sourcePoint(sourceX, sourceY);
12117 QWidget *targetWidget =
nullptr;
12118 int shortestDistance = INT_MAX;
12121 for (
QWidget *targetCandidate : targetCandidates) {
12123 const QRect targetCandidateRect = targetCandidate->rect().
translated(targetCandidate->mapToGlobal(
QPoint()));
12128 if (targetCandidate->focusProxy() || targetCandidateRect.
isEmpty())
12132 if ( targetCandidate != sourceWidget
12144 && targetCandidate->isEnabled()
12146 && targetCandidate->isVisible()
12148 && targetCandidate->window() == sourceWindow) {
12149 const int targetCandidateDistance = [](
const QPoint &sourcePoint,
12150 const QRect &targetCandidateRect) {
12153 if (
p.x() <
r.left())
12155 else if (
p.x() >
r.right())
12156 dx =
p.x() -
r.right();
12157 if (
p.y() <
r.top())
12158 dy =
r.top() -
p.y();
12159 else if (
p.y() >
r.bottom())
12160 dy =
p.y() -
r.bottom();
12163 if (targetCandidateDistance < shortestDistance) {
12164 shortestDistance = targetCandidateDistance;
12165 targetWidget = targetCandidate;
12169 return targetWidget;
12206 if (qobject_cast<const QTabWidget*>(tabWidget))
12237 if (!repaintManager)
12260 return repaintManager ? repaintManager->
backingStore() :
nullptr;
12288 q->updateGeometry();
12301 QRect liRect =
q->style()->subElementRect(element,
opt,
q);
12319 if (!
q->parentWidget()) {
12351 return widget->d_func();
12355#if QT_CONFIG(graphicsview)
12369 return d->extra->proxyWidget;
12375#ifndef QT_NO_GESTURES
12385 d->gestureContext.insert(gesture,
flags);
12399 if (
d->gestureContext.remove(gesture)) {
12401 manager->cleanupCachedGestures(
this, gesture);
12423 d->aboutToDestroy();
12426 d->deactivateWidgetCleanup();
12429 qApp->d_func()->closePopup(
this);
12441 if (destroySubWindows) {
12443 for (
int i = 0;
i < childList.
size();
i++) {
12452 if (destroyWindow) {
12453 d->deleteTLSysExtra();
12476 qWarning(
"QWidget::paintEngine: Should no longer be called");
12505#if QT_CONFIG(graphicsview)
12511 result =
d->extra->proxyWidget;
12524 result.window =
nullptr;
12525 for ( ;
w ;
w =
w->parentWidget()) {
12526#if QT_CONFIG(graphicsview)
12529 const QList <QGraphicsView *> views =
scene->
views();
12531 result.transform *= qgpw->sceneTransform();
12532 result.transform *= views.
first()->viewportTransform();
12533 w = views.
first()->viewport();
12544 const QPoint topLeft =
w->geometry().topLeft();
12545 result.transform.translate(topLeft.
x(), topLeft.
y());
12566 return t.window ?
t.window->mapToGlobal(
g) :
g;
12589 const QPointF windowLocal =
t.window ?
t.window->mapFromGlobal(
pos) :
pos;
12590 return t.transform.inverted().map(windowLocal);
12611 window = nativeParent->windowHandle();
12615#ifndef QT_NO_CURSOR
12626#ifndef QT_NO_CURSOR
12632 window->setMouseGrabEnabled(
true);
12643#ifndef QT_NO_CURSOR
12649 window->setMouseGrabEnabled(
false);
12704#ifndef QT_NO_CURSOR
12717 return window ?
window->setMouseGrabEnabled(grab) :
false;
12756 window->setKeyboardGrabEnabled(
true);
12766 return window ?
window->setKeyboardGrabEnabled(grab) :
false;
12780 window->setKeyboardGrabEnabled(
false);
12846 wnd->requestActivate();
12866 auto resolveDevicePixelRatio = [
this,
screen]() ->
qreal {
12878 return data->crect.width();
12882 return data->crect.height();
12888 for (
const QWidget *
p =
this;
p;
p =
p->parentWidget()) {
12889 if (
p->d_func()->extra &&
p->d_func()->extra->customDpiX)
12890 return p->d_func()->extra->customDpiX;
12894 for (
const QWidget *
p =
this;
p;
p =
p->parentWidget()) {
12895 if (
p->d_func()->extra &&
p->d_func()->extra->customDpiY)
12896 return p->d_func()->extra->customDpiY;
12904 return resolveDevicePixelRatio();
12924 painter->d_func()->state->deviceFont =
f;
12946 if (!d_func()->redirectDev)
12950 if (!
sp || !
sp->isActive())
12953 if (
sp->paintEngine()->paintDevice() != d_func()->redirectDev)
12986 if (newMask ==
d->extra->mask)
12989#ifndef QT_NO_BACKINGSTORE
12990 const QRegion oldMask(
d->extra->mask);
12993 d->extra->mask = newMask;
12994 d->extra->hasMask = !newMask.
isEmpty();
12999 d->setMask_sys(newMask);
13001#ifndef QT_NO_BACKINGSTORE
13005 if (!
d->extra->hasMask) {
13010 d->setDirtyOpaqueRegion();
13019 parentExpose -= newMask;
13020 if (!parentExpose.
isEmpty()) {
13021 d->setDirtyOpaqueRegion();
13028 update(newMask - oldMask);
13037 window->setMask(region);
13080 if (!
d->extra || !
d->extra->hasMask)
13099 if (
q->isVisible()) {
13100 std::stringstream
s;
13102 <<
q->width() <<
'x' <<
q->height()
13103 << std::showpos <<
q->x() <<
q->y()
13117 if (!
q->windowHandle())
13120 QXcbWindow::WindowTypes wmWindowType = QXcbWindow::None;
13122 wmWindowType |= QXcbWindow::Desktop;
13124 wmWindowType |= QXcbWindow::Dock;
13126 wmWindowType |= QXcbWindow::Toolbar;
13128 wmWindowType |= QXcbWindow::Menu;
13130 wmWindowType |= QXcbWindow::Utility;
13132 wmWindowType |= QXcbWindow::Splash;
13134 wmWindowType |= QXcbWindow::Dialog;
13136 wmWindowType |= QXcbWindow::DropDownMenu;
13138 wmWindowType |= QXcbWindow::PopupMenu;
13140 wmWindowType |= QXcbWindow::Tooltip;
13142 wmWindowType |= QXcbWindow::Notification;
13144 wmWindowType |= QXcbWindow::Combo;
13146 wmWindowType |= QXcbWindow::Dnd;
13148 if (wmWindowType == QXcbWindow::None && skipIfMissing)
13151 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
q->windowHandle()->handle()))
13152 xcbWindow->setWindowType(wmWindowType);
13158#ifndef QT_NO_DEBUG_STREAM
13164 debug <<
", attributes=[";
13184 if (
debug.verbosity() > 2) {
13188 debug <<
", visible";
13190 debug <<
", disabled";
13195 debug <<
", window";
13203 debug <<
", margins=" << margins;
13211 debug <<
"QWidget(0x0)";
13219#include "moc_qwidget.cpp"
13220#include "moc_qwidget_p.cpp"
static bool isEqual(const aiUVTransform &a, const aiUVTransform &b)
IOBluetoothDevice * device
static void(* destroyed)(QAbstractDeclarativeData *, QObject *)
The QActionEvent class provides an event that is generated when a QAction is added,...
QObjectList associatedObjects
The QAction class provides an abstraction for user commands that can be added to different user inter...
static QWidget * focus_widget
static QWidget * hidden_focus_widget
static QWidget * active_window
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason)
static QWidget * focusNextPrevChild_helper(QWidget *toplevel, bool next, bool *wrappingOccurred=nullptr)
internal Helper function that returns the new focus widget, but does not set the focus reason.
static bool isBlockedByModal(QWidget *widget)
static void setActiveWindow(QWidget *act)
static QStyle * style()
Returns the application's style object.
static QPalette palette()
Returns the current application palette.
static QWidget * activeModalWidget()
Returns the active modal widget.
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
static QFont font()
Returns the default application font.
static QWidget * activePopupWidget()
Returns the active popup widget.
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or \nullptr if no applica...
static QWidgetList allWidgets()
Returns a list of all the widgets in the application.
static QSurface::SurfaceType surfaceTypeForConfig(const QPlatformBackingStoreRhiConfig &config)
static bool checkForceRhi(QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType)
The QBackingStore class provides a drawing area for QWindow.
QPlatformBackingStore * handle() const
Returns a pointer to the QPlatformBackingStore implementation.
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set.
Qt::BrushStyle style() const
Returns the brush style.
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
char at(qsizetype i) const
Returns the byte at index position i in the byte array.
The QCloseEvent class contains parameters that describe a close event.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setAlphaF(float alpha)
Sets the alpha of this color to alpha.
static bool is_app_closing
static bool testAttribute(uint flag)
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 void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes some pending events for the calling thread according to the specified flags.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
The QCursor class provides a mouse cursor with an arbitrary shape.
Qt::CursorShape shape() const
Returns the cursor shape identifier.
\inmodule QtCore\reentrant
Type
This enum type defines the valid event types in Qt.
@ ApplicationPaletteChange
@ WindowAboutToChangeInternal
@ ApplicationLayoutDirectionChange
@ ApplicationWindowIconChange
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
\inmodule QtCore \reentrant
QString fileName() const
Returns the name of the file, excluding the path.
The QFocusEvent class contains event parameters for widget focus events.
bool isCopyOf(const QFont &) const
Returns true if this font and f are copies of each other, i.e.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
void setResolveMask(uint mask)
static QGestureManager * instance(InstanceCreation ic=ForceCreation)
The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on.
The QGraphicsEffect class is the base class for all graphics effects.
PixmapPadMode
This enum describes how the pixmap returned from sourcePixmap should be padded.
@ PadToEffectiveBoundingRect
QGraphicsEffectSource * source() const
virtual void draw(QPainter *painter)=0
This pure virtual function draws the effect and is called whenever the source needs to be drawn.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
void update(qreal x, qreal y, qreal w, qreal h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void showModalWindow(QWindow *window)
static void hideModalWindow(QWindow *window)
static QPlatformIntegration * platformIntegration()
static QGuiApplicationPrivate * instance()
static Qt::ApplicationState applicationState()
QScreen * primaryScreen
the primary (or default) screen of the application.
static QPalette palette()
Returns the current application palette.
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
static QInputMethod * inputMethod()
returns the input method.
static void setOverrideCursor(const QCursor &)
Sets the application override cursor to cursor.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
Qt::LayoutDirection layoutDirection
the default layout direction for this application
static QScreen * screenAt(const QPoint &point)
Returns the screen at point, or \nullptr if outside of any screen.
static QList< QScreen * > screens()
Returns a list of all the screens associated with the windowing system the application is connected t...
QIcon windowIcon
the default window icon
The QHelpEvent class provides an event that is used to request helpful information about a particular...
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
The QHideEvent class provides an event which is sent after a widget is hidden.
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
@ Format_ARGB32_Premultiplied
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
virtual QRect geometry() const =0
Returns the rectangle covered by this layout item.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
The QLayout class is the base class of geometry managers.
QRect geometry() const override
\reimp
int totalHeightForWidth(int w) const
void update()
Updates the layout for parentWidget().
bool activate()
Redoes the layout for parentWidget() if necessary.
Qt::Orientations expandingDirections() const override
Returns whether this layout can make use of more space than sizeHint().
void invalidate() override
\reimp
QWidget * parentWidget() const
Returns the parent widget of this layout, or \nullptr if this layout is not installed on any widget.
QLayout * layout() override
\reimp
virtual int indexOf(const QWidget *) const
Searches for widget widget in this layout (not including child layouts).
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
qsizetype removeAll(const AT &t)
void append(parameter_type t)
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr bool isNull() const noexcept
Returns true if all margins are is 0; otherwise returns false.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
The QMoveEvent class contains event parameters for move events.
void setParent_helper(QObject *)
virtual std::string flagsForDumping() const
const QObjectList & children() const
Returns a list of child objects.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QString objectName
the name of this object
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
void setParent(QObject *parent)
Makes the object a child of parent.
QList< QByteArray > dynamicPropertyNames() const
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
bool paintingActive() const
qreal devicePixelRatio() const
@ PdmDevicePixelRatioScaled
virtual QPaintDevice * redirected(QPoint *offset) const
virtual int metric(PaintDeviceMetric metric) const
virtual QPaintEngine * paintEngine() const =0
static qreal devicePixelRatioFScale()
void setSystemViewport(const QRegion ®ion)
QTransform systemTransform
virtual void systemStateChanged()
void setSystemTransformAndViewport(const QTransform &xform, const QRegion ®ion)
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
CompositionMode compositionMode() const
Returns the current composition mode.
const QPen & pen() const
Returns the painter's current pen.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is n...
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
void setBrushOrigin(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QFont & font() const
Returns the currently set font used for drawing text.
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
Draws a tiled pixmap, inside the given rectangle with its origin at the given position.
void restore()
Restores the current painter state (pops a saved state off the stack).
const QTransform & worldTransform() const
Returns the world transformation matrix.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void save()
Saves the current painter state (pushes the state onto a stack).
QRegion clipRegion() const
Returns the currently set clip region.
const QTransform & deviceTransform() const
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dep...
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
CompositionMode
Defines the modes supported for digital image compositing.
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void setRenderHints(RenderHints hints, bool on=true)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
bool hasClipping() const
Returns true if clipping has been set; otherwise returns false.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setTransform(const QTransform &transform, bool combine=false)
The QPalette class contains color groups for each widget state.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
void setResolveMask(ResolveMask mask)
ResolveMask resolveMask() const
QPalette resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other.
bool isCopyOf(const QPalette &p) const
Returns true if this palette and p are copies of each other, i.e.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
\inmodule QtCore\reentrant
QRect toAlignedRect() const noexcept
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr void moveTopLeft(const QPoint &p) noexcept
Moves the rectangle, leaving the top-left corner at the given position.
constexpr void moveBottom(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate.
constexpr void moveRight(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void moveLeft(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate.
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...
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setRect(int x, int y, int w, int h) noexcept
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
constexpr void moveTop(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
QRect boundingRect() const noexcept
Returns the bounding rectangle of this region.
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
bool intersects(const QRegion &r) const
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QRegion translated(int dx, int dy) const
The QResizeEvent class contains event parameters for resize events.
The QScreen class is used to query screen properties. \inmodule QtGui.
qreal logicalDotsPerInchY
the number of logical dots or pixels per inch in the vertical direction
qreal devicePixelRatio
the screen's ratio between physical pixels and device-independent pixels
qreal logicalDotsPerInchX
the number of logical dots or pixels per inch in the horizontal direction
QRect availableGeometry
the screen's available geometry in pixels
QSizeF physicalSize
the screen's physical size (in millimeters)
QRect geometry
the screen's geometry in pixels
qreal physicalDotsPerInchY
the number of physical dots or pixels per inch in the vertical direction
int depth
the color depth of the screen
qreal physicalDotsPerInchX
the number of physical dots or pixels per inch in the horizontal direction
bool remove(const T &value)
iterator insert(const T &value)
The QShowEvent class provides an event that is sent when a widget is shown.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
constexpr bool retainSizeWhenHidden() const noexcept
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
The QStatusTipEvent class provides an event that is used to show messages in a status bar.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isNull() const
Returns true if this string is null; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QByteArray toLocal8Bit() const &
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
void updateStyleSheetFont(QWidget *w) const
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual void polish(QWidget *widget)
Initializes the appearance of the given widget.
@ SH_Widget_ShareActivation
@ SH_TitleBar_ModifyNotification
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
virtual void unpolish(QWidget *widget)
Uninitialize the given {widget}'s appearance.
SubElement
This enum represents a sub-area of a widget.
SurfaceType
The SurfaceType enum describes what type of surface this is.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
static void showText(const QPoint &pos, const QString &text, QWidget *w=nullptr)
Shows text as a "What's This?" window, at global position pos.
static void parentWasChanged(QWidget *parent)
static void parentWasRaised(QWidget *parent)
static void parentWasMoved(QWidget *parent)
static void parentWasLowered(QWidget *parent)
static void toplevelAboutToBeDestroyed(QWidget *parent)
QPlatformWindow * platformWindow
void setAutomaticPositionAndResizeEnabled(bool a)
PositionPolicy positionPolicy
void focusObjectChanged(QObject *object)
This signal is emitted when the final receiver of events tied to focus is changed to object.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ ImInputItemClipRectangle
@ NavigationModeKeypadDirectional
@ NavigationModeKeypadTabOrder
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
@ WA_X11NetWmWindowTypeDND
@ WA_X11NetWmWindowTypePopupMenu
@ WA_WState_ExplicitShowHide
@ WA_WState_WindowOpacitySet
@ WA_TransparentForMouseEvents
@ WA_ForceUpdatesDisabled
@ WA_MacAlwaysShowToolWindow
@ WA_X11NetWmWindowTypeDock
@ WA_X11NetWmWindowTypeUtility
@ WA_X11NetWmWindowTypeDialog
@ WA_X11NetWmWindowTypeSplash
@ WA_X11NetWmWindowTypeDropDownMenu
@ WA_TranslucentBackground
@ WA_NoChildEventsFromChildren
@ WA_ContentsMarginsRespectsSafeArea
@ WA_X11NetWmWindowTypeToolTip
@ WA_X11NetWmWindowTypeCombo
@ WA_X11NetWmWindowTypeToolBar
@ WA_NoChildEventsForParent
@ WA_DontCreateNativeAncestors
@ WA_ShowWithoutActivating
@ WA_X11NetWmWindowTypeMenu
@ WA_WState_OwnSizePolicy
@ WA_X11NetWmWindowTypeDesktop
@ WA_X11NetWmWindowTypeNotification
QTextStream & noforcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() & ~QTextStream::ForceSign) on stream and...
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
@ AA_DontCreateNativeWidgetSiblings
@ AA_UseStyleSheetPropagationInWidgetStyles
QTextStream & forcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ForceSign) on stream and ...
@ WindowContextHelpButtonHint
@ WindowFullscreenButtonHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
@ WindowMinMaxButtonsHint
@ WindowTransparentForInput
@ MaximizeUsingFullscreenGeometryHint
Q_WIDGETS_EXPORT QWidget * qt_button_down
void qt_qpa_set_cursor(QWidget *w, bool force)
int qstrncmp(const char *str1, const char *str2, size_t len)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCInfo(category,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLchar * source
GLuint GLenum GLenum transform
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLdouble GLdouble GLdouble GLdouble q
static const QRectF boundingRect(const QPointF *points, int pointCount)
static constexpr quint16 currentMajorVersion
\qmltype FileInstancing \inherits Instancing \inqmlmodule QtQuick3D
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
void forceUpdate(QQuickItem *item)
#define Q_ASSERT_X(cond, x, msg)
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
#define qPrintable(string)
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
QStyleSheetStyle * qt_styleSheet(QStyle *style)
#define QT_CONFIG(feature)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
QWindow * qobject_cast< QWindow * >(QObject *o)
QT_BEGIN_NAMESPACE typedef QHash< WId, QWidget * > QWidgetMapper
static QWindowsDirect2DWindow * nativeWindow(QWindow *window)
static QRect frameGeometry(HWND hwnd, bool topLevel)
const char className[16]
[1]
if(qFloatDistance(a, b)<(1<< 7))
[0]
obj metaObject() -> className()
QGraphicsOpacityEffect * effect
the effect attached to this item
QNetworkAccessManager manager
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent