9#include "private/qduplicatetracker_p.h"
25#if QT_CONFIG(accessibility)
28#include <qpa/qplatformwindow.h>
29#include <qpa/qplatformwindow_p.h>
30#include "private/qwidgetwindow_p.h"
35#if QT_CONFIG(whatsthis)
39#include "private/qstylesheetstyle_p.h"
40#include "private/qstyle_p.h"
43#include <QtGui/private/qhighdpiscaling_p.h>
44#include <QtGui/qinputmethod.h>
46#if QT_CONFIG(graphicseffect)
47#include <private/qgraphicseffect_p.h>
50#include <private/qwidgetrepaintmanager_p.h>
51#include <private/qpaintengine_raster_p.h>
54#include <QtGui/private/qwindow_p.h>
56# include "QtGui/private/qaction_p.h"
59#if QT_CONFIG(graphicsview)
60#include "QtWidgets/qgraphicsproxywidget.h"
61#include "QtWidgets/qgraphicsscene.h"
62#include "private/qgraphicsproxywidget_p.h"
64#include "QtWidgets/qabstractscrollarea.h"
65#include "private/qabstractscrollarea_p.h"
66#include "private/qevent_p.h"
68#include "private/qgesturemanager_p.h"
70#ifdef QT_KEYPAD_NAVIGATION
71#if QT_CONFIG(tabwidget)
90#ifndef QT_NO_DEBUG_STREAM
117#
if !defined(QT_NO_IM)
118 , imHints(
Qt::ImhNone)
121 , toolTipDuration(-1)
123 , directFontResolveMask(0)
124 , inheritedFontResolveMask(0)
125 , directPaletteResolveMask(0)
126 , inheritedPaletteResolveMask(0)
131 , leftLayoutItemMargin(0)
132 , topLayoutItemMargin(0)
133 , rightLayoutItemMargin(0)
134 , bottomLayoutItemMargin(0)
139 , dirtyOpaqueChildren(1)
141 , retainSizeWhenHiddenChanged(0)
145 , usesDoubleBufferedGLContext(0)
146 , mustHaveWindowHandle(0)
148 , textureChildSeen(0)
150 , inheritsInputMethodHints(0)
152 , renderToTextureReallyDirty(1)
154 , childrenHiddenByWState(0)
155 , childrenShownByExpose(0)
161 qFatal(
"QWidget: Must construct a QApplication before a QWidget");
165#ifdef QT_BUILD_INTERNAL
171 qFatal(
"Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)",
178#ifdef QWIDGET_EXTRA_DEBUG
179 static int count = 0;
200 if (
q->children().size() > 0) {
203 for (
int i = 0;
i < childObjects.
size(); ++
i) {
205 if (
w && !
w->isWindow()) {
210 w->d_func()->setWSGeometry();
211 w->d_func()->setDirtyOpaqueRegion();
232 t.translate(
p.x(),
p.y());
239#ifdef QT_KEYPAD_NAVIGATION
240QPointer<QWidget> QWidgetPrivate::editingWidget;
249bool QWidget::hasEditFocus()
const
252 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
253 w =
w->d_func()->extra->focus_proxy;
254 return QWidgetPrivate::editingWidget ==
w;
269void QWidget::setEditFocus(
bool on)
272 while (
f->d_func()->extra &&
f->d_func()->extra->focus_proxy)
273 f =
f->d_func()->extra->focus_proxy;
275 if (QWidgetPrivate::editingWidget && QWidgetPrivate::editingWidget !=
f)
276 QWidgetPrivate::editingWidget->setEditFocus(
false);
278 if (on && !
f->hasFocus())
281 if ((!on && !QWidgetPrivate::editingWidget)
282 || (on && QWidgetPrivate::editingWidget ==
f)) {
286 if (!on && QWidgetPrivate::editingWidget ==
f) {
287 QWidgetPrivate::editingWidget = 0;
292 QWidgetPrivate::editingWidget =
f;
327 return d->extra &&
d->extra->autoFillBackground;
335 if (
d->extra->autoFillBackground ==
enabled)
338 d->extra->autoFillBackground =
enabled;
818#ifdef QT_NO_EXCEPTIONS
823 d->removeFromFocusChain();
946 qFatal(
"QWidget: Cannot create a QWidget without QApplication");
957 "Widgets must be created in the GUI thread.");
961 data.fstrut_dirty =
true;
964 data.widget_attributes = 0;
965 data.window_flags =
f;
966 data.window_state = 0;
967 data.focus_policy = 0;
971 data.sizehint_forced = 0;
972 data.is_closing =
false;
974 data.in_set_window_state = 0;
975 data.in_destructor =
false;
990 data.crect = parentWidget ?
QRect(0,0,100,30) :
QRect(0,0,640,480);
995 else if (parentWidget)
996 q->setParent(parentWidget,
data.window_flags);
1022 q->create(0,
true,
true);
1026 child->d_func()->createRecursively();
1033 return repaintManager->rhi();
1065 if (
auto nativeParent = q_func()->nativeParentWidget()) {
1066 if (
auto window = nativeParent->windowHandle())
1071 if (
auto topLevel = q_func()->topLevelWidget()) {
1092#if QT_CONFIG(graphicsview)
1094 if (nearestGraphicsProxyWidget(q_func()))
1106 if (
config.isEnabled()) {
1114 if (
const QWidget *childWidget = qobject_cast<const QWidget *>(
child)) {
1129 qCDebug(lcWidgetPainting) <<
"Tree with root" <<
w <<
"evaluated to forced flushing with QRhi";
1136 qCDebug(lcWidgetPainting) <<
"Tree with root" <<
w <<
"evaluates to flushing with QRhi";
1163 qWarning(
"QWidget::create(): Parameter 'window' does not have any effect.");
1167 if (
d->data.in_destructor)
1171 Qt::WindowFlags &
flags =
data->window_flags;
1197 if (paintOnScreenEnv)
1203 d->updateIsOpaque();
1219 d->setWindowIcon_sys();
1221 if (
isWindow() && !
d->topData()->iconText.isEmpty())
1222 d->setWindowIconText_helper(
d->topData()->iconText);
1223 if (
isWindow() && !
d->topData()->caption.isEmpty())
1224 d->setWindowTitle_helper(
d->topData()->caption);
1225 if (
isWindow() && !
d->topData()->filePath.isEmpty())
1226 d->setWindowFilePath_helper(
d->topData()->filePath);
1228 d->updateSystemBackground();
1231 d->setWindowIcon_sys();
1239 d->updateFrameStrut();
1245 for (
int i = 0;
i < children.
size();
i++) {
1251 childWidget->
winId();
1285 for (
const QByteArray &propertyName : dynamicPropertyNames) {
1286 if (!
qstrncmp(propertyName,
"_q_platform_", 12))
1290 Qt::WindowFlags &
flags =
data.window_flags;
1292#if defined(QT_PLATFORM_UIKIT)
1308 if (
win->isTopLevel()) {
1311 if (!targetScreen) {
1313 ?
q->screen() :
nullptr;
1321 format.setAlphaBufferSize(8);
1326 if (nativeParent->windowHandle()) {
1328 win->setTransientParent(nativeParent->window()->windowHandle());
1331 win->setTransientParent(
nullptr);
1344 platformWindow->setFrameStrutEventsEnabled(
true);
1347 data.window_flags =
win->flags();
1350 if (!
topData()->role.isNull()) {
1351 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
win->handle()))
1361 if (
q->isWindow()) {
1370 }
else if (
win->handle()) {
1376 if (
win->handle()) {
1390 if (
data.crect.width() == 0 ||
data.crect.height() == 0) {
1392 }
else if (
q->isVisible()) {
1394 win->setNativeWindowVisibility(
true);
1399static const char activeXNativeParentHandleProperty[] =
"_q_embedded_native_parent_handle";
1411 if (
extra->topextra->opacity != 255 &&
q->isWindow())
1414 const bool isTipLabel =
q->inherits(
"QTipLabel");
1415 const bool isAlphaWidget = !isTipLabel &&
q->inherits(
"QAlphaWidget");
1418 const QVariant activeXNativeParentHandle =
q->property(activeXNativeParentHandleProperty);
1419 if (activeXNativeParentHandle.isValid())
1420 extra->topextra->window->setProperty(activeXNativeParentHandleProperty, activeXNativeParentHandle);
1421 if (isTipLabel || isAlphaWidget)
1422 extra->topextra->window->setProperty(
"_q_windowsDropShadow",
QVariant(
true));
1424 if (isTipLabel || isAlphaWidget ||
q->inherits(
"QRollEffect"))
1442 d->data.in_destructor =
true;
1444#if defined (QT_CHECK_STATE)
1449#ifndef QT_NO_GESTURES
1452 for (
auto it =
d->gestureContext.keyBegin(),
end =
d->gestureContext.keyEnd();
it !=
end; ++
it)
1453 manager->cleanupCachedGestures(
this, *
it);
1455 d->gestureContext.clear();
1460 for (
auto action : std::as_const(
d->actions)) {
1467#ifndef QT_NO_SHORTCUT
1476 d->layout =
nullptr;
1482#if QT_CONFIG(graphicsview)
1484 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
1485 w =
w->d_func()->extra->focus_proxy;
1488 if (!e || !e->proxyWidget || (
w->parentWidget() &&
w->parentWidget()->d_func()->focus_child ==
this))
1495 d->setDirtyOpaqueRegion();
1509 qApp->d_func()->sendSyntheticEnterLeave(
this);
1513 repaintManager->removeDirtyWidget(
this);
1515 repaintManager->removeStaticWidget(
this);
1518 delete d->needsFlush;
1519 d->needsFlush =
nullptr;
1523 bool blocked =
d->blockSig;
1526 if (
d->isSignalConnected(0)) {
1532 qWarning(
"Detected an unexpected exception in ~QWidget while emitting destroyed().");
1537 if (
d->declarativeData) {
1538 d->wasDeleted =
true;
1541 d->declarativeData =
nullptr;
1542 d->wasDeleted =
false;
1545 d->blockSig = blocked;
1547 if (!
d->children.isEmpty())
1548 d->deleteChildren();
1565 }
QT_CATCH(
const std::exception&) {
1569#if QT_CONFIG(graphicseffect)
1570 delete d->graphicsEffect;
1573 d->isWidget =
false;
1586 const WId oldWinId =
data.winid;
1593 if (oldWinId !=
id) {
1603 if (!
extra->topextra) {
1604 extra->topextra = std::make_unique<QTLWExtra>();
1607 x->sharedPainter =
nullptr;
1608 x->incw =
x->inch = 0;
1609 x->basew =
x->baseh = 0;
1610 x->frameStrut.setCoords(0, 0, 0, 0);
1611 x->normalGeometry =
QRect(0,0,-1,-1);
1612 x->savedFlags = { };
1614 x->posIncludesFrame = 0;
1615 x->sizeAdjusted =
false;
1617 x->window =
nullptr;
1618 x->initialScreen =
nullptr;
1620#ifdef QWIDGET_EXTRA_DEBUG
1621 static int count = 0;
1635 extra = std::make_unique<QWExtra>();
1636 extra->glContext =
nullptr;
1637#if QT_CONFIG(graphicsview)
1638 extra->proxyWidget =
nullptr;
1644 extra->customDpiX = 0;
1645 extra->customDpiY = 0;
1646 extra->explicitMinSize = 0;
1647 extra->explicitMaxSize = 0;
1648 extra->autoFillBackground = 0;
1649 extra->nativeChildrenForced = 0;
1650 extra->inRenderWithPainter = 0;
1651 extra->hasWindowContainer =
false;
1654#ifdef QWIDGET_EXTRA_DEBUG
1655 static int count = 0;
1674#ifndef QT_NO_STYLE_STYLESHEET
1679 if (
extra->topextra)
1694 delete extra->topextra->window;
1695 extra->topextra->window =
nullptr;
1722 above = (sibling ==
w);
1726 const QRect siblingRect = sibling->d_func()->effectiveRectFor(sibling->data->crect);
1728 const auto &siblingExtra = sibling->d_func()->extra;
1729 if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
1734 if (breakAfterFirst)
1738 w =
w->parentWidget();
1751 repaintManager->sync();
1760 repaintManager->sync(q_func(), region);
1766 if (
data.in_destructor)
1776 extra->staticContentsSize =
data.crect.size();
1787 QRegion toBePainted(noPartialUpdateSupport ?
q->rect() : rgn);
1791 if (toBePainted.isEmpty())
1797 qWarning(
"QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
1804 if (
enable && !
q->isWindow() &&
q->parentWidget() && !
q->parentWidget()->updatesEnabled())
1817 if (
w && !
w->isWindow() && !
w->testAttribute(
attribute))
1818 w->d_func()->setUpdatesEnabled_helper(
enable);
1833#if QT_CONFIG(graphicsview)
1834 if (!
q->parentWidget() &&
extra &&
extra->proxyWidget) {
1846 const bool useStyleSheetPropagationInWidgetStyles =
1869 if (!
w->isVisible())
1877 &&
w->parentWidget()) {
1880 w =
w->parentWidget();
1881 r &=
QRect(ox, oy,
w->width(),
w->height());
1892 if (!
q->isVisible())
1902 &&
w->parentWidget()) {
1906 w =
w->parentWidget();
1907 r &=
QRegion(ox, oy,
w->width(),
w->height());
1910 while(
w->d_func()->children.at(
i++) !=
static_cast<const QObject *
>(ignoreUpTo))
1913 if (
QWidget *sibling = qobject_cast<QWidget *>(
w->d_func()->children.at(
i))) {
1914 if (sibling->isVisible() && !sibling->isWindow()) {
1915 QRect siblingRect(ox+sibling->x(), oy+sibling->y(),
1916 sibling->width(), sibling->height());
1930 scaleTransform.
scale(devicePixelRatio, devicePixelRatio);
1932 paintEngine->d_func()->baseSystemClip = region;
1933 paintEngine->d_func()->setSystemTransform(scaleTransform);
1937#if QT_CONFIG(graphicseffect)
1938void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
1943 if (
w->graphicsEffect()) {
1944 QWidgetEffectSourcePrivate *sourced =
1945 static_cast<QWidgetEffectSourcePrivate *
>(
w->graphicsEffect()->source()->d_func());
1946 if (!sourced->updateDueToGraphicsEffect)
1947 w->graphicsEffect()->source()->d_func()->invalidateCache();
1960#if QT_CONFIG(graphicseffect)
1961 invalidateGraphicsEffectsRecursively();
1992 QRegion r = childd->isOpaque ?
child->rect() : childd->getOpaqueChildren();
1993 if (childd->extra && childd->extra->hasMask)
1994 r &= childd->extra->mask;
1998 that->opaqueChildren +=
r;
2001 that->opaqueChildren &= q_func()->rect();
2002 that->dirtyOpaqueChildren =
false;
2004 return that->opaqueChildren;
2019 bool alsoNonOpaque)
const
2023 if (disableSubtractOpaqueSiblings ||
q->isWindow())
2026 QRect clipBoundingRect;
2027 bool dirtyClipBoundingRect =
true;
2030 bool dirtyParentClip =
true;
2041 const QRect widgetGeometry =
w->d_func()->effectiveRectFor(
w->data->crect);
2047 const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
2051 if (dirtyClipBoundingRect) {
2052 clipBoundingRect = sourceRegion.boundingRect();
2053 dirtyClipBoundingRect =
false;
2059 if (dirtyParentClip) {
2060 parentClip = sourceRegion.
translated(parentOffset);
2061 dirtyParentClip =
false;
2064 const QPoint siblingPos(sibling->data->crect.topLeft());
2065 const QRect siblingClipRect(sibling->d_func()->clipRect());
2066 QRegion siblingDirty(parentClip);
2067 siblingDirty &= (siblingClipRect.translated(siblingPos));
2068 const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
2069 && !sibling->d_func()->graphicsEffect;
2071 siblingDirty &= sibling->d_func()->extra->
mask.
translated(siblingPos);
2072 if (siblingDirty.isEmpty())
2075 if (sibling->d_func()->isOpaque || alsoNonOpaque) {
2078 sourceRegion -= siblingDirty;
2080 sourceRegion -= siblingGeometry.translated(-parentOffset);
2083 if (hasDirtySiblingsAbove)
2084 *hasDirtySiblingsAbove =
true;
2087 QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
2088 opaqueSiblingChildren.translate(-parentOffset + siblingPos);
2089 sourceRegion -= opaqueSiblingChildren;
2091 if (sourceRegion.isEmpty())
2094 dirtyClipBoundingRect =
true;
2095 dirtyParentClip =
true;
2098 w =
w->parentWidget();
2100 dirtyParentClip =
true;
2111#if QT_CONFIG(graphicseffect)
2113 w =
q->parentWidget();
2125 w =
w->parentWidget();
2131#if defined(QT_NO_BACKINGSTORE)
2149#if QT_CONFIG(graphicseffect)
2165 if (
q->autoFillBackground()) {
2166 const QBrush &autoFillBrush = pal.
brush(
q->backgroundRole());
2167 if (autoFillBrush.style() !=
Qt::NoBrush && autoFillBrush.isOpaque()) {
2175 if (windowBrush.style() !=
Qt::NoBrush && windowBrush.isOpaque()) {
2196 const int oldAlpha =
format.alphaBufferSize();
2198 if (oldAlpha != newAlpha) {
2216 format.setAlphaBufferSize(newAlpha);
2231 }
else if (
brush.gradient()
2246#if QT_CONFIG(scrollarea)
2251 QAbstractScrollArea *
scrollArea = qobject_cast<QAbstractScrollArea *>(
parent);
2254 QAbstractScrollAreaPrivate *
priv =
static_cast<QAbstractScrollAreaPrivate *
>(scrollPrivate);
2265 bool brushOriginSet =
false;
2266 const QBrush autoFillBrush =
q->palette().brush(
q->backgroundRole());
2268 if ((
flags &
DrawAsRoot) && !(
q->autoFillBackground() && autoFillBrush.isOpaque())) {
2270 if (!brushOriginSet)
2283 if (
q->autoFillBackground()) {
2284 if (!brushOriginSet)
2359 if (!
data->in_destructor
2364 that->d_func()->createWinId();
2365 return that->data->winid;
2376 if (!
q->isWindow()) {
2381 if (!
parent->internalWinId()) {
2423 if (!
screen || !
q->isWindow())
2426 if (currentScreen !=
screen) {
2468 return realParent->internalWinId();
2486 return d->windowHandle();
2499 if (
auto associatedScreen =
d->associatedScreen())
2500 return associatedScreen;
2501 if (
auto topLevel =
window()) {
2503 if (topData->initialScreen)
2504 return topData->initialScreen;
2530#ifndef QT_NO_STYLE_STYLESHEET
2552 return d->extra->styleSheet;
2558 if (
data->in_destructor)
2573 bool repolish =
d->polished;
2575 const auto childWidgets = findChildren<QWidget*>();
2576 for (
auto child : childWidgets) {
2577 repolish =
child->d_func()->polished;
2583 proxy->repolish(
this);
2604 if (
d->extra &&
d->extra->style)
2605 return d->extra->style;
2635#ifndef QT_NO_STYLE_STYLESHEET
2639 styleSheetStyle->ref();
2640 d->setStyle_helper(
style,
false);
2646 d->setStyle_helper(
style,
false);
2652 QStyle *oldStyle =
q->style();
2656#ifndef QT_NO_STYLE_STYLESHEET
2657 QPointer<QStyle> origStyle =
extra->style;
2659 extra->style = newStyle;
2663 oldStyle->unpolish(
q);
2664 q->style()->polish(
q);
2670 for (
int i = 0;
i < childrenList.size(); ++
i) {
2673 c->d_func()->inheritStyle();
2677#ifndef QT_NO_STYLE_STYLESHEET
2680 cssStyle->clearWidgetFont(
q);
2688#ifndef QT_NO_STYLE_STYLESHEET
2698#ifndef QT_NO_STYLE_STYLESHEET
2705 if (!
q->styleSheet().isEmpty()) {
2717 QStyle *newStyle = parentStyle;
2729 if (origStyle == extraStyle)
2736 origStyle =
nullptr;
2810 if (
q->windowHandle())
2811 q->windowHandle()->setModality(
q->windowModality());
2890 return Qt::WindowStates(
data->window_state);
2903 data->window_state = newstate;
2943 if (oldstate == newstate)
2948 data->window_state = newstate;
2949 data->in_set_window_state = 1;
2957 d->topData()->normalGeometry =
geometry();
2962 data->in_set_window_state = 0;
3028#if !defined Q_OS_QNX
3095 &&
w->parentWidget()
3096 &&
w->parentWidget() != ancestor)
3145 qWarning(
"QWidget::insertAction: Attempt to insert null action");
3150 if (
d->actions.contains(action))
3153 int pos =
d->actions.indexOf(before);
3156 pos =
d->actions.size();
3158 d->actions.insert(
pos, action);
3196 if (
d->actions.removeAll(action)) {
3243#if QT_CONFIG(shortcut)
3286 const QObject *receiver,
const char* member,
3294#if QT_CONFIG(shortcut)
3296 const QObject *receiver,
const char* member,
3305 const QObject *receiver,
const char* member,
3369 if (
enable && !
q->isWindow() &&
q->parentWidget() && !
q->parentWidget()->isEnabled())
3378 if (!
enable &&
q->window()->focusWidget() ==
q) {
3379 bool parentIsEnabled = (!
q->parentWidget() ||
q->parentWidget()->isEnabled());
3380 if (!parentIsEnabled || !
q->focusNextChild())
3388 w->d_func()->setEnabled_helper(
enable);
3472 QRect fs =
d->frameStrut();
3498 return data->crect.x() -
d->frameStrut().left();
3499 return data->crect.x();
3518 return data->crect.y() -
d->frameStrut().top();
3519 return data->crect.y();
3554 if (!
d->maybeTopData() || !
d->maybeTopData()->posIncludesFrame)
3555 result -=
d->frameStrut().topLeft();
3677 return d->topData()->normalGeometry;
3697 for (
int i = 0;
i <
d->children.size(); ++
i) {
3699 if (
w && !
w->isWindow() && !
w->isHidden())
3721 for (
int i = 0;
i <
d->children.size(); ++
i) {
3723 if (
w && !
w->isWindow() && !
w->isHidden()) {
3755 return d->extra ?
QSize(
d->extra->minw,
d->extra->minh) :
QSize(0, 0);
3777 return d->extra ?
QSize(
d->extra->maxw,
d->extra->maxh)
3856 return (
d->extra &&
d->extra->topextra)
3857 ?
QSize(
d->extra->topextra->incw,
d->extra->topextra->inch)
3877 return (
d->extra &&
d->extra->topextra)
3878 ?
QSize(
d->extra->topextra->basew,
d->extra->topextra->baseh)
3886 int mw = minw, mh = minh;
3892 qWarning(
"QWidget::setMinimumSize: (%s/%s) "
3893 "The largest allowed size is (%d,%d)",
3894 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(),
QWIDGETSIZE_MAX,
3900 qWarning(
"QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
3902 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(), minw, minh);
3903 minw = mw =
qMax(minw, 0);
3904 minh = mh =
qMax(minh, 0);
3918 if (
extra &&
q->windowHandle()) {
3925 if (
extra->topextra) {
3926 winp->baseSize =
QSize(
extra->topextra->basew,
extra->topextra->baseh);
3927 winp->sizeIncrement =
QSize(
extra->topextra->incw,
extra->topextra->inch);
3930 if (winp->platformWindow) {
3932 winp->platformWindow->propagateSizeHints();
3948 if (!
d->setMinimumSize_helper(minw, minh))
3952 d->setConstraints_sys();
3961#if QT_CONFIG(graphicsview)
3963 if (
d->extra->proxyWidget)
3964 d->extra->proxyWidget->setMinimumSize(minw, minh);
3967 d->updateGeometry_helper(
d->extra->minw ==
d->extra->maxw &&
d->extra->minh ==
d->extra->maxh);
3974 qWarning(
"QWidget::setMaximumSize: (%s/%s) "
3975 "The largest allowed size is (%d,%d)",
3976 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(),
QWIDGETSIZE_MAX,
3982 qWarning(
"QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
3984 q->objectName().toLocal8Bit().data(),
q->metaObject()->className(), maxw, maxh);
3985 maxw =
qMax(maxw, 0);
3986 maxh =
qMax(maxh, 0);
3989 if (
extra->maxw == maxw &&
extra->maxh == maxh)
4008 if (!
d->setMaximumSize_helper(maxw, maxh))
4012 d->setConstraints_sys();
4019#if QT_CONFIG(graphicsview)
4021 if (
d->extra->proxyWidget)
4022 d->extra->proxyWidget->setMaximumSize(maxw, maxh);
4026 d->updateGeometry_helper(
d->extra->minw ==
d->extra->maxw &&
d->extra->minh ==
d->extra->maxh);
4040 if (
x->incw ==
w &&
x->inch ==
h)
4045 d->setConstraints_sys();
4059 if (
x->basew == basew &&
x->baseh == baseh)
4064 d->setConstraints_sys();
4098 bool minSizeSet =
d->setMinimumSize_helper(
w,
h);
4099 bool maxSizeSet =
d->setMaximumSize_helper(
w,
h);
4100 if (!minSizeSet && !maxSizeSet)
4104 d->setConstraints_sys();
4106 d->updateGeometry_helper(
true);
4118 d->extra->explicitMinSize = expl;
4127 d->extra->explicitMinSize = expl;
4136 d->extra->explicitMaxSize = expl;
4145 d->extra->explicitMaxSize = expl;
4163 d->extra->explicitMinSize = explMin;
4164 d->extra->explicitMaxSize = explMax;
4183 d->extra->explicitMinSize = explMin;
4184 d->extra->explicitMaxSize = explMax;
4203 Q_ASSERT_X(
w,
"QWidget::mapTo(const QWidget *parent, const QPointF &pos)",
4204 "parent must be in parent hierarchy");
4205 p =
w->mapToParent(
p);
4206 w =
w->parentWidget();
4235 Q_ASSERT_X(
w,
"QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
4236 "parent must be in parent hierarchy");
4238 p =
w->mapFromParent(
p);
4239 w =
w->parentWidget();
4273 return pos +
data->crect.topLeft();
4296 return pos -
data->crect.topLeft();
4317 while (!
w->isWindow() &&
p) {
4395 d->updateSystemBackground();
4396 d->propagatePaletteChange();
4397 d->updateIsOpaque();
4460 d->updateSystemBackground();
4461 d->propagatePaletteChange();
4519#
if defined(Q_OS_WIN)
4539 QPalette naturalPalette =
d->naturalWidgetPalette(
d->inheritedPaletteResolveMask);
4541 d->setPalette_helper(resolvedPalette);
4557 const bool useStyleSheetPropagationInWidgetStyles =
4568 if (!
p->testAttribute(
Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
4570 QPalette inheritedPalette =
p->palette();
4572 naturalPalette = inheritedPalette.resolve(naturalPalette);
4574 naturalPalette =
p->palette();
4578#if QT_CONFIG(graphicsview)
4582 naturalPalette = inheritedPalette.resolve(naturalPalette);
4586 naturalPalette.setResolveMask(0);
4587 return naturalPalette;
4671#ifndef QT_NO_STYLE_STYLESHEET
4683 QFont naturalFont =
d->naturalWidgetFont(
d->inheritedFontResolveMask);
4685 d->setFont_helper(resolvedFont);
4704 const bool useStyleSheetPropagationInWidgetStyles =
4715 if (!
p->testAttribute(
Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
4717 if (inheritedMask != 0) {
4718 QFont inheritedFont =
p->font();
4720 naturalFont = inheritedFont.resolve(naturalFont);
4723 naturalFont =
p->font();
4727#if QT_CONFIG(graphicsview)
4729 if (inheritedMask != 0) {
4730 QFont inheritedFont =
extra->proxyWidget->font();
4732 naturalFont = inheritedFont.resolve(naturalFont);
4737 naturalFont.setResolveMask(0);
4780#ifndef QT_NO_STYLE_STYLESHEET
4783 const bool useStyleSheetPropagationInWidgetStyles =
4790#if QT_CONFIG(graphicsview)
4791 if (!
q->parentWidget() &&
extra &&
extra->proxyWidget) {
4804 data.fnt.setResolveMask(newMask);
4810#ifndef QT_NO_STYLE_STYLESHEET
4811 }
else if (!useStyleSheetPropagationInWidgetStyles &&
w->testAttribute(
Qt::WA_StyleSheet)) {
4814 cssStyle->updateStyleSheetFont(
w);
4825#ifndef QT_NO_STYLE_STYLESHEET
4826 if (!useStyleSheetPropagationInWidgetStyles && cssStyle) {
4827 cssStyle->updateStyleSheetFont(
q);
4846 w->d_func()->setLayoutDirection_helper(
direction);
4901 d->resolveLayoutDirection();
4952 return (
d->extra &&
d->extra->curs)
4964 || (
d->extra &&
d->extra->curs))
4967 d->extra->curs = std::make_unique<QCursor>(
cursor);
4987 d->extra->curs.reset();
4990 d->unsetCursor_sys();
5019 static QPointer<QWidget> lastUnderMouse =
nullptr;
5022 }
else if (lastUnderMouse) {
5023 const WId lastWinId = lastUnderMouse->effectiveWinId();
5024 const WId winId =
w->effectiveWinId();
5025 if (lastWinId && lastWinId == winId)
5027 }
else if (!
w->internalWinId()) {
5031 while (!
w->internalWinId() &&
w->parentWidget() && !
w->isWindow()
5033 w =
w->parentWidget();
5036 if (!
w->internalWinId())
5038 if (!nativeParent || !nativeParent->internalWinId())
5093 const QRegion &sourceRegion, RenderFlags renderFlags)
5096 render(&
p, targetOffset, sourceRegion, renderFlags);
5113 const QRegion &sourceRegion, RenderFlags renderFlags)
5116 qWarning(
"QWidget::render: Null pointer to painter");
5121 qWarning(
"QWidget::render: Cannot render with an inactive painter");
5130 const bool inRenderWithPainter =
d->extra &&
d->extra->inRenderWithPainter;
5131 const QRegion toBePainted = !inRenderWithPainter ?
d->prepareToRender(sourceRegion, renderFlags)
5133 if (toBePainted.isEmpty())
5138 d->extra->inRenderWithPainter =
true;
5149 d->render_helper(
painter, targetOffset, toBePainted, renderFlags);
5150 d->extra->inRenderWithPainter = inRenderWithPainter;
5155 QPainter *oldPainter =
d->sharedPainter();
5168 enginePriv->
setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip);
5174 d->render(
target, targetOffset, toBePainted, renderFlags);
5183 d->setSharedPainter(oldPainter);
5185 d->extra->inRenderWithPainter = inRenderWithPainter;
5194 for (
int i = 0;
i < children.
size(); ++
i) {
5223 const bool oldDirtyOpaqueChildren =
d->dirtyOpaqueChildren;
5225 if (
r.width() < 0 ||
r.height() < 0) {
5228 r =
d->prepareToRender(
QRegion(), renderFlags).boundingRect();
5232 if (!
r.intersects(
rect()))
5237 res.setDevicePixelRatio(
dpr);
5242 d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
5256#if QT_CONFIG(graphicseffect)
5260 return d->graphicsEffect;
5286#if QT_CONFIG(graphicseffect)
5290 if (
d->graphicsEffect ==
effect)
5293 if (
d->graphicsEffect) {
5294 d->invalidateBackingStore(
rect());
5295 delete d->graphicsEffect;
5296 d->graphicsEffect =
nullptr;
5308 d->updateIsOpaque();
5323 return parent ?
parent->d_func()->isAboutToShow() :
false;
5334 (
void)topLevel->d_func()->topData();
5344 hiddenWidgets.append(
widget);
5346 widget->d_func()->updateGeometry_helper(
true);
5352 if (topLevel->d_func()->
layout)
5356 QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
5357 if (topLevelExtra && !topLevelExtra->sizeAdjusted
5364 topLevel->d_func()->activateChildLayoutsRecursively();
5367 for (
int i = 0;
i < hiddenWidgets.size(); ++
i) {
5374 q->window()->d_func()->sendPendingMoveAndResizeEvents(
true,
true);
5380 toBePainted &=
extra->mask;
5385 QWidget::RenderFlags renderFlags)
5392 const bool useDeviceCoordinates = originalTransform.
isScaling();
5393 if (!useDeviceCoordinates) {
5395 const QRect rect = toBePainted.boundingRect();
5402 pixmap.setDevicePixelRatio(pixmapDevicePixelRatio);
5425 const QRectF rect(toBePainted.boundingRect());
5438 q->render(&pixmapPainter,
QPoint(), toBePainted, renderFlags);
5439 pixmapPainter.end();
5456 qCInfo(lcWidgetPainting) <<
"Drawing" << rgn <<
"of" <<
q <<
"at" <<
offset
5457 <<
"into paint device" << pdev <<
"with" <<
flags;
5462#if QT_CONFIG(graphicseffect)
5465 QWidgetEffectSourcePrivate *sourced =
static_cast<QWidgetEffectSourcePrivate *
>
5467 if (!sourced->context) {
5481 sourced->invalidateCache();
5491 sourced->context =
nullptr;
5509 if (asRoot && !alsoInvisible)
5514 if (!toBePainted.isEmpty()) {
5515 if (!onScreen || alsoOnScreen) {
5518 qWarning(
"QWidget::repaint: Recursive repaint detected");
5529 paintEngine->d_func()->
systemRect =
q->data->crect;
5547 QColor tint =
q->palette().window().color();
5549 p.fillRect(toBePainted.boundingRect(), tint);
5556 qDebug() <<
"clipping to" << toBePainted <<
"location == " <<
offset
5557 <<
"geometry ==" <<
QRect(
q->mapTo(
q->window(),
QPoint(0, 0)),
q->size());
5560 bool skipPaintEvent =
false;
5569 }
else if (!repaintManager) {
5577 p.drawImage(
q->rect(),
img);
5578 skipPaintEvent =
true;
5584 skipPaintEvent =
true;
5587 if (!skipPaintEvent) {
5601 paintEngine->d_func()->currentClipDevice =
nullptr;
5607 qWarning(
"QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
5609 if (paintEngine && paintEngine->autoDestruct()) {
5612 }
else if (
q->isWindow()) {
5616 p.setClipRegion(toBePainted);
5619 p.drawTiledPixmap(
q->rect(), bg.
texture());
5621 p.fillRect(
q->rect(), bg);
5623 if (
engine->autoDestruct())
5639 QCoreApplication::sendSpontaneousEvent(
q, &e);
5646 const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
5649 qWarning(
"QWidget::render: null pointer to paint device");
5653 const bool inRenderWithPainter =
extra &&
extra->inRenderWithPainter;
5654 QRegion paintRegion = !inRenderWithPainter
5657 if (paintRegion.isEmpty())
5666 if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
5667 QPainter *targetPainter = targetPrivate->sharedPainter();
5668 if (targetPainter && targetPainter->isActive())
5677 offset -= paintRegion.boundingRect().topLeft();
5678 QPoint redirectionOffset;
5686 offset -= redirectionOffset;
5689 if (!inRenderWithPainter) {
5691 const QRegion targetSystemClip = targetEngine->systemClip();
5692 if (!targetSystemClip.isEmpty())
5713 if (oldSharedPainter)
5723 bool dirtyBoundingRect =
true;
5729 if (
x && !(exludeOpaqueChildren &&
x->d_func()->isOpaque) && !
x->isHidden() && !
x->isWindow()
5730 && !(excludeNativeChildren &&
x->internalWinId())) {
5731 if (dirtyBoundingRect) {
5733 dirtyBoundingRect =
false;
5742 }
while (
index >= 0);
5748 const QPoint widgetPos(
w->data->crect.topLeft());
5753 wr -= hasMask ? wd->
extra->mask.translated(widgetPos) :
w->data->crect;
5758 if (
w->updatesEnabled()
5760 && (!
w->d_func()->extra || !
w->d_func()->extra->proxyWidget)
5767 wRegion &= wd->
extra->mask;
5772#if QT_CONFIG(graphicseffect)
5776 return m_widget->rect();
5780 qWarning(
"QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
5784 return context->painter->worldTransform().mapRect(m_widget->rect());
5797 toBePainted &= m_widget->rect();
5800 toBePainted &= wd->
extra->mask;
5812 qWarning(
"QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
5817 QRectF sourceRect = m_widget->rect();
5819 if (deviceCoordinates) {
5821 sourceRect = painterTransform.mapRect(sourceRect);
5822 pixmapOffset = painterTransform.map(pixmapOffset);
5828 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
5830 effectRect = sourceRect.
adjusted(-1, -1, 1, 1).toAlignedRect();
5837 pixmapOffset -= effectRect.topLeft();
5840 if (
const auto *paintDevice =
context->painter->device())
5841 dpr = paintDevice->devicePixelRatio();
5843 qWarning(
"QWidgetEffectSourcePrivate::pixmap: Painter not active");
5853#if QT_CONFIG(graphicsview)
5865 const auto &
extra = origin->d_func()->extra;
5867 return extra->proxyWidget;
5868 return nearestGraphicsProxyWidget(origin->
parentWidget());
5972 if (
d->extra &&
d->extra->topextra) {
5973 if (!
d->extra->topextra->caption.isEmpty())
5974 return d->extra->topextra->caption;
5975 if (!
d->extra->topextra->filePath.isEmpty())
6000 const auto placeHolder =
"[*]"_L1;
6004 while (
index != -1) {
6005 index += placeHolder.size();
6009 index += placeHolder.size();
6013 int lastIndex =
cap.lastIndexOf(placeHolder,
index - 1);
6016 cap.replace(lastIndex, 3, QWidget::tr(
"*"));
6018 cap.remove(lastIndex, 3);
6024 cap.replace(
"[*][*]"_L1, placeHolder);
6043 window->setTitle(caption);
6061 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
window->handle()))
6062 xcbWindow->setWindowIconText(iconText);
6087 d->topData()->iconText = iconText;
6088 d->setWindowIconText_helper(iconText);
6111 d->topData()->caption =
title;
6112 d->setWindowTitle_helper(
title);
6140 if (
d->extra &&
d->extra->topextra &&
d->extra->topextra->icon)
6141 return *
d->
extra->topextra->icon;
6142 w =
w->parentWidget();
6156 if (!
q->windowHandle())
6160 if (
w && !
w->isWindow())
6181 if (!
d->extra->topextra->icon)
6182 d->extra->topextra->icon = std::make_unique<QIcon>(
icon);
6184 *
d->extra->topextra->icon =
icon;
6186 d->setWindowIcon_sys();
6187 d->setWindowIcon_helper();
6196 window->setIcon(
q->windowIcon());
6217 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->iconText :
QString();
6247 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->filePath :
QString();
6258 d->extra->topextra->filePath = filePath;
6259 d->setWindowFilePath_helper(filePath);
6264 if (
extra->topextra &&
extra->topextra->caption.isEmpty()) {
6285 window->setFilePath(filePath);
6297 return (
d->extra &&
d->extra->topextra) ?
d->extra->topextra->role :
QString();
6309 d->topData()->role = role;
6312 xcbWindow->setWindowRole(role);
6371 if (!
w && !
d->extra)
6384 d->extra->focus_proxy =
w;
6394 QWidget *firstChild =
nullptr;
6397 if ((firstChild = qobject_cast<QWidget *>(
child)))
6401 d->insertIntoFocusChainBefore(firstChild);
6402 }
else if (
w &&
w->isAncestorOf(
this)) {
6408 if (parentsNext ==
this) {
6412 d->QWidgetPrivate::insertIntoFocusChainAfter(
w);
6416 if (moveFocusToProxy)
6430 return d->extra ?
d->extra->focus_proxy.data() :
nullptr;
6449 while (
w->d_func()->extra &&
w->d_func()->extra->focus_proxy)
6450 w =
w->d_func()->extra->focus_proxy;
6451#if QT_CONFIG(graphicsview)
6453 const auto &e =
window->d_func()->extra;
6501 QWidget *
f = d_func()->deepestFocusProxy();
6508#if QT_CONFIG(graphicsview)
6509 QWidget *previousProxyFocus =
nullptr;
6510 if (
const auto &topData =
window()->d_func()->extra) {
6511 if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
6512 previousProxyFocus = topData->proxyWidget->widget()->
focusWidget();
6513 if (previousProxyFocus && previousProxyFocus->focusProxy())
6514 previousProxyFocus = previousProxyFocus->
focusProxy();
6515 if (previousProxyFocus ==
f && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
6521#if QT_CONFIG(graphicsview)
6523 if (
const auto &topData =
window()->d_func()->extra) {
6524 if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {
6525 f->d_func()->updateFocusChild();
6526 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1;
6527 topData->proxyWidget->
setFocus(reason);
6528 topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0;
6533 if (
f->isActiveWindow()) {
6547 f->d_func()->updateFocusChild();
6550#if QT_CONFIG(accessibility)
6552 if (!(
f->inherits(
"QMenuBar") ||
f->inherits(
"QMenu") ||
f->inherits(
"QMenuItem")))
6554 QAccessibleEvent
event(
f, QAccessible::Focus);
6555 QAccessible::updateAccessibility(&
event);
6558#if QT_CONFIG(graphicsview)
6559 if (
const auto &topData =
window()->d_func()->extra) {
6560 if (topData->proxyWidget) {
6561 if (previousProxyFocus && previousProxyFocus !=
f) {
6564 QPointer<QWidget> that = previousProxyFocus;
6570#if QT_CONFIG(graphicsview)
6572 if (
const auto &topData =
window()->d_func()->extra)
6573 if (topData->proxyWidget && topData->proxyWidget->hasFocus())
6574 topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
6578 QPointer<QWidget> that =
f;
6587 f->d_func()->updateFocusChild();
6607 focusProxy = nextFocusProxy;
6614 const auto platformWindow =
w->handle();
6615 return platformWindow && platformWindow->isEmbedded();
6643 if (
q->isHidden()) {
6644 while (
w &&
w->isHidden()) {
6645 w->d_func()->focus_child =
q;
6650 w->d_func()->focus_child =
q;
6651 w =
w->isWindow() ?
nullptr :
w->parentWidget();
6694 QObject *originalFocusObject =
nullptr;
6695 if (extra && extra->
window) {
6699 if (!originalFocusObject)
6706 if (
w->d_func()->focus_child ==
this)
6707 w->d_func()->focus_child =
nullptr;
6718#if QT_CONFIG(graphicsview)
6719 const auto &topData = d_func()->extra;
6720 if (topData && topData->proxyWidget)
6721 topData->proxyWidget->clearFocus();
6727#if QT_CONFIG(accessibility)
6728 QAccessibleEvent
event(
this, QAccessible::Focus);
6729 QAccessible::updateAccessibility(&
event);
6782 return p->focusNextPrevChild(
next);
6783#if QT_CONFIG(graphicsview)
6785 if (
d->extra &&
d->extra->proxyWidget)
6786 return d->extra->proxyWidget->focusNextPrevChild(
next);
6789 bool wrappingOccurred =
false;
6792 if (!
w)
return false;
6801 if (wrappingOccurred) {
6806 if (winp->platformWindow !=
nullptr) {
6809 winp->platformWindow->windowEvent(&
event);
6810 if (
event.isAccepted())
return true;
6815 w->setFocus(reason);
6830 return const_cast<QWidget *
>(d_func()->focus_child);
6886#if QT_CONFIG(graphicsview)
6887 if (
const auto &tlwExtra = tlw->d_func()->extra) {
6888 if (
isVisible() && tlwExtra->proxyWidget)
6889 return tlwExtra->proxyWidget->isActiveWindow();
6900 !
w->isModal() &&
w->parentWidget()) {
6901 w =
w->parentWidget()->window();
6911 QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0;
6912 if (qwc && qwc->topLevelWidget() == tlw)
6925 return w->handle()->isActive();
6989 qWarning(
"QWidget::setTabOrder: 'first' and 'second' must be in the same window");
7008 for (
auto *
object :
target->children()) {
7010 if (
w &&
w->focusProxy() ==
target) {
7020 if (focusNext == noFurtherThan)
7023 lastFocusChild = focusNext;
7026 return lastFocusChild;
7029 QWidget *lastFocusChildOfFirst = determineLastFocusChild(
first, second);
7030 if (lastFocusChildOfFirst == second)
7031 lastFocusChildOfFirst =
first;
7032 QWidget *lastFocusChildOfSecond = determineLastFocusChild(second,
first);
7033 if (lastFocusChildOfSecond ==
first)
7034 lastFocusChildOfSecond = second;
7038 QWidget *prevWithFocus = oldPrev;
7039 while (prevWithFocus->focusPolicy() ==
Qt::NoFocus)
7041 if (prevWithFocus ==
first)
7076 if (oldtlw ==
q->window())
7097 QRect fs =
d->frameStrut();
7101 return data->crect.size();
7117 d->topData()->posIncludesFrame =
false;
7121 d->setDirtyOpaqueRegion();
7125 d->topData()->posIncludesFrame =
true;
7126 data->crect.moveTopLeft(
p);
7130 if (
d->extra &&
d->extra->hasWindowContainer)
7147 if (te->posIncludesFrame) {
7151 te->posIncludesFrame = 0;
7153 if (
q->windowHandle() &&
q->windowHandle()->handle()) {
7155 if (!
q->data->fstrut_dirty) {
7156 data.crect.translate(te->frameStrut.x(), te->frameStrut.y());
7157 te->posIncludesFrame = 0;
7176 d->fixPosIncludesFrame();
7178 d->setDirtyOpaqueRegion();
7180 const auto oldRect =
data->crect;
7182 if (oldRect !=
data->crect)
7193 d->topData()->posIncludesFrame = 0;
7195 d->setGeometry_sys(
r.x(),
r.y(),
r.width(),
r.height(),
true);
7196 d->setDirtyOpaqueRegion();
7198 const auto oldRect =
data->crect;
7199 data->crect.setTopLeft(
r.topLeft());
7201 if (oldRect !=
data->crect) {
7207 if (
d->extra &&
d->extra->hasWindowContainer)
7221 if (
q->isWindow() &&
q->windowHandle()) {
7226 w =
q->windowHandle()->width();
7227 h =
q->windowHandle()->height();
7231 QPoint oldp =
q->geometry().topLeft();
7235 bool isResize = olds !=
r.size();
7237 isMove = oldp !=
r.topLeft();
7242 if (
r.size() == olds && oldp ==
r.topLeft())
7245 if (!
data.in_set_window_state) {
7246 q->data->window_state &=
~Qt::WindowMaximized;
7247 q->data->window_state &=
~Qt::WindowFullScreen;
7255 bool needsShow =
false;
7257 if (
q->isWindow() ||
q->windowHandle()) {
7269 if (
q->isVisible()) {
7272 if (
q->isWindow()) {
7273 if (isResize && !isMove)
7275 else if (isMove && !isResize)
7276 win->setPosition(
x,
y);
7280 QPoint posInNativeParent =
q->mapTo(
q->nativeParentWidget(),
QPoint());
7288 if (!
q->isWindow()) {
7290 QRegion updateRegion(
q->geometry());
7291 updateRegion +=
QRect(oldPos, olds);
7292 q->parentWidget()->d_func()->invalidateBackingStore(updateRegion);
7293 }
else if (isMove && !isResize) {
7308 if (
q->windowHandle())
7312 if (isMove &&
q->pos() != oldPos)
7341 stream.setVersion(QDataStream::Qt_4_0);
7342 const quint32 magicNumber = 0x1D9D0CB;
7390 const int height = restoredGeometry->height() + frameHeight;
7395 restoredGeometry->setHeight(availableGeometry.
height() - 2 - frameHeight);
7396 if (availableGeometry.
width() <= restoredGeometry->width())
7397 restoredGeometry->setWidth(availableGeometry.
width() - 2);
7401 const QRect restored = restoredGeometry->
adjusted(0, -frameHeight, 0, 0);
7404 if (availableGeometry.
contains(restored))
7410 if (restored.top() <= availableGeometry.
top()) {
7411 restoredGeometry->moveTop(availableGeometry.
top() + 1 + frameHeight);
7412 }
else if (restored.bottom() >= availableGeometry.
bottom()) {
7414 restoredGeometry->moveBottom(availableGeometry.
bottom() - 1);
7418 if (restored.left() <= availableGeometry.
left()) {
7419 restoredGeometry->moveLeft(availableGeometry.
left() + 1);
7420 }
else if (restored.right() >= availableGeometry.
right()) {
7422 restoredGeometry->moveRight(availableGeometry.
right() - 1);
7454 stream.setVersion(QDataStream::Qt_4_0);
7456 const quint32 magicNumber = 0x1D9D0CB;
7458 stream >> storedMagicNumber;
7459 if (storedMagicNumber != magicNumber)
7466 stream >> majorVersion >> minorVersion;
7472 QRect restoredFrameGeometry;
7473 QRect restoredGeometry;
7474 QRect restoredNormalGeometry;
7475 qint32 restoredScreenNumber;
7478 qint32 restoredScreenWidth = 0;
7480 stream >> restoredFrameGeometry
7481 >> restoredNormalGeometry
7482 >> restoredScreenNumber
7486 if (majorVersion > 1)
7487 stream >> restoredScreenWidth;
7488 if (majorVersion > 2)
7489 stream >> restoredGeometry;
7494 restoredScreenNumber = 0;
7496 const qreal screenWidthF = restoredScreen ?
qreal(restoredScreen->geometry().width()) : 0;
7499 if (restoredScreenWidth) {
7500 const qreal factor =
qreal(restoredScreenWidth) / screenWidthF;
7501 if (factor < 0.8 || factor > 1.25)
7514 if (!restoredNormalGeometry.isValid())
7516 if (!restoredNormalGeometry.isValid()) {
7518 restoredNormalGeometry.setSize(restoredNormalGeometry
7520 .expandedTo(d_func()->adjustedSize()));
7523 const QRect availableGeometry = restoredScreen ? restoredScreen->availableGeometry()
7548 if (restoredScreen !=
screen()) {
7561 d_func()->topData()->normalGeometry = restoredNormalGeometry;
7566 if (majorVersion > 2)
7593 if (
left ==
d->leftmargin &&
top ==
d->topmargin
7596 d->leftmargin =
left;
7601 d->updateContentsRect();
7633 q->updateGeometry();
7635 if (
q->isVisible()) {
7657 QMargins userMargins(
d->leftmargin,
d->topmargin,
d->rightmargin,
d->bottommargin);
7659 userMargins |
d->safeAreaMargins() : userMargins;
7676 if (!nativeWidget->windowHandle())
7679 QPlatformWindow *platformWindow = nativeWidget->windowHandle()->handle();
7680 if (!platformWindow)
7685 if (!
q->isWindow()) {
7700 const QWidget *assumedSafeWidget =
nullptr;
7719 assumedSafeWidget =
w;
7723#if !defined(QT_DEBUG)
7724 if (assumedSafeWidget) {
7736 QRect widgetRect =
q->isVisible() ?
q->visibleRegion().boundingRect() :
q->rect();
7737 QPoint bottomRightMargins = widgetRect.bottomRight() -
q->mapFrom(nativeWidget,
7742 qMax(0, bottomRightMargins.x()),
qMax(0, bottomRightMargins.y()));
7826 if (
d->extra &&
d->extra->focus_proxy)
7827 d->extra->focus_proxy->setFocusPolicy(
policy);
7862 d->setUpdatesEnabled_helper(
enable);
7883 Qt::WindowState defaultState = platformIntegration->defaultWindowState(
data->window_flags);
7905 q->ensurePolished();
7907 if (!
q->isWindow() &&
q->parentWidget()->d_func()->layout && !
q->parentWidget()->data->in_show)
7908 q->parentWidget()->d_func()->layout->activate();
7920 disableUpdates = disableUpdates &&
q->updatesEnabled();
7944 child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
7957 child->ensurePolished();
7961 if (childPrivate->layout)
7962 childPrivate->
layout->activate();
7965 const bool wasVisible =
child->isVisible();
7970 childPrivate->activateChildLayoutsRecursively();
7981 data.in_show =
true;
7994#if QT_CONFIG(graphicsview)
8018#if QT_CONFIG(graphicsview)
8022 if (ancestorProxy) {
8024 ancestorProxy->d_func()->embedSubWindow(
q);
8039 qApp->d_func()->openPopup(
q);
8041#if QT_CONFIG(accessibility)
8043 QAccessibleEvent
event(
q, QAccessible::ObjectShow);
8044 QAccessible::updateAccessibility(&
event);
8059 data.in_show =
false;
8095 QRect geomRect =
q->geometry();
8096 if (!
q->isWindow()) {
8097 QPoint topLeftOfWindow =
q->mapTo(
q->nativeParentWidget(),
QPoint());
8098 geomRect.moveTopLeft(topLeftOfWindow);
8101 if (windowRect != geomRect) {
8104 window->setGeometry(geomRect);
8106 window->resize(geomRect.size());
8113 window->setNativeWindowVisibility(
true);
8115 if (
window->isTopLevel()) {
8116 const QPoint crectTopLeft =
q->data->crect.topLeft();
8117 const QPoint windowTopLeft =
window->geometry().topLeft();
8118 if (crectTopLeft ==
QPoint(0, 0) && windowTopLeft != crectTopLeft)
8119 q->data->crect.moveTopLeft(windowTopLeft);
8147#if QT_CONFIG(graphicsview)
8154 qApp->d_func()->closePopup(
q);
8173 qApp->d_func()->sendSyntheticEnterLeave(
q);
8177 q->focusNextPrevChild(
true);
8185 repaintManager->removeDirtyWidget(
q);
8187#if QT_CONFIG(accessibility)
8189 QAccessibleEvent
event(
q, QAccessible::ObjectHide);
8190 QAccessible::updateAccessibility(&
event);
8216 if (!
q->isWindow()) {
8218 if (
p &&
p->isVisible()) {
8220 p->d_func()->invalidateBackingStore(
q->geometry());
8229 window->setNativeWindowVisibility(
false);
8258 qCDebug(lcWidgetShowHide) <<
"Setting visibility of" <<
this
8259 <<
"with attributes" << WidgetAttributes{
this}
8260 <<
"to" <<
visible <<
"via QWidget";
8277 qCDebug(lcWidgetShowHide) <<
"Setting visibility of" <<
q
8278 <<
"with attributes" << WidgetAttributes{
q}
8279 <<
"to" << visible <<
"via QWidgetPrivate";
8283 if (!
q->isWindow() &&
q->parentWidget() &&
q->parentWidget()->isVisible()
8285 q->parentWidget()->window()->d_func()->createRecursively();
8295 Qt::WindowStates initialWindowState =
q->windowState();
8298 q->ensurePolished();
8305 if (needUpdateGeometry)
8312 if (!
q->isWindow()) {
8315 parent->d_func()->layout->activate();
8321 parent->d_func()->setDirtyOpaqueRegion();
8326 && (
q->isWindow() || !
q->parentWidget()->d_func()->layout)) {
8327 if (
q->isWindow()) {
8329 if (
q->windowState() != initialWindowState)
8330 q->setWindowState(initialWindowState);
8339 if (
q->isWindow() ||
q->parentWidget()->isVisible()) {
8342 qApp->d_func()->sendSyntheticEnterLeave(
q);
8355 if (!
q->isWindow() &&
q->parentWidget())
8356 q->parentWidget()->d_func()->setDirtyOpaqueRegion();
8364 if (!
q->isWindow() &&
q->parentWidget()) {
8365 if (
q->parentWidget()->d_func()->layout)
8366 q->parentWidget()->d_func()->layout->invalidate();
8367 else if (
q->parentWidget()->isVisible())
8394 q->setVisible(
true);
8400 qCDebug(lcWidgetShowHide) <<
"Showing children of" <<
q
8401 <<
"spontaneously" << spontaneous;
8403 QList<QObject*> childList =
children;
8404 for (
int i = 0;
i < childList.size(); ++
i) {
8409 <<
"with attributes" << WidgetAttributes{
widget};
8416 widget->d_func()->showChildren(
true);
8418 QApplication::sendSpontaneousEvent(
widget, &e);
8421 widget->d_func()->show_recursive();
8431 qCDebug(lcWidgetShowHide) <<
"Hiding children of" <<
q
8432 <<
"spontaneously" << spontaneous;
8434 QList<QObject*> childList =
children;
8435 for (
int i = 0;
i < childList.size(); ++
i) {
8440 <<
"with attributes" << WidgetAttributes{
widget};
8448 widget->d_func()->hideChildren(spontaneous);
8451 QApplication::sendSpontaneousEvent(
widget, &e);
8458 widget->d_func()->hide_sys();
8461 qApp->d_func()->sendSyntheticEnterLeave(
widget);
8462#if QT_CONFIG(accessibility)
8464 QAccessibleEvent
event(
widget, QAccessible::ObjectHide);
8465 QAccessible::updateAccessibility(&
event);
8474 widgetWindow && widgetWindow->data->is_closing) {
8500 qCDebug(lcWidgetShowHide) <<
"Handling close event for" <<
q;
8502 if (
data.is_closing)
8506 data.is_closing =
true;
8508 QPointer<QWidget> that =
q;
8510 if (
data.in_destructor)
8516 QApplication::sendSpontaneousEvent(
q, &e);
8520 data.is_closing =
false;
8526 if (!that.isNull() && !
q->isHidden())
8529 if (!that.isNull()) {
8530 data.is_closing =
false;
8564 return d_func()->close();
8578 if (widgetWindow->isTopLevel())
8579 return widgetWindow->close();
8648 while (!
w->isHidden()
8650 &&
w->parentWidget()
8651 &&
w->parentWidget() != ancestor)
8671 QRect clipRect =
d->clipRect();
8675 d->subtractOpaqueChildren(
r, clipRect);
8676 d->subtractOpaqueSiblings(
r);
8687 if (
q->isWindow()) {
8688 Qt::Orientations exp;
8695 if (
q->sizePolicy().hasHeightForWidth())
8696 s.setHeight(
q->heightForWidth(
s.width()));
8697 exp =
q->sizePolicy().expandingDirections();
8700 s.setWidth(
qMax(
s.width(), 200));
8702 s.setHeight(
qMax(
s.height(), 100));
8714 extra->sizeAdjusted =
true;
8750 d->layout->activate();
8776 return d->layout->totalSizeHint();
8777 return QSize(-1, -1);
8803 return d->layout->totalMinimumSize();
8804 return QSize(-1, -1);
8827 if (
child->isWindow())
8872 switch(
event->type()) {
8887#if QT_CONFIG(wheelevent)
8895 switch (
event->type()) {
8928#if QT_CONFIG(wheelevent)
8930 wheelEvent((QWheelEvent*)
event);
8933#if QT_CONFIG(tabletevent)
8940 tabletEvent((QTabletEvent*)
event);
8956#ifdef QT_KEYPAD_NAVIGATION
8957 if (!k->
isAccepted() && QApplication::keypadNavigationEnabled()
8980#if QT_CONFIG(whatsthis)
8983 &&
d->whatsThis.size()) {
9004 for (
uint i = 0;
i < 32; ++
i) {
9034 d->resolvePalette();
9040 d->setWindowIcon_sys();
9041 d->setWindowIcon_helper();
9046 d->updateWidgetTransform(
event);
9054#if QT_CONFIG(statustip)
9055 if (
d->statusTip.size()) {
9064#if QT_CONFIG(statustip)
9065 if (
d->statusTip.size()) {
9088 d->updateWidgetTransform(
event);
9093 d->updateWidgetTransform(
event);
9100#ifndef QT_NO_CONTEXTMENU
9102 switch (
data->context_menu_policy) {
9113 if (
d->actions.size()) {
9127#if QT_CONFIG(draganddrop)
9129 dropEvent((QDropEvent*)
event);
9133 dragEnterEvent((QDragEnterEvent*)
event);
9137 dragMoveEvent((QDragMoveEvent*)
event);
9141 dragLeaveEvent((QDragLeaveEvent*)
event);
9163 d->resolvePalette();
9192 if (!
d->childrenShownByExpose) {
9194 d->showChildren(
true);
9198 d->childrenHiddenByWState =
false;
9202 d->hideChildren(
true);
9203 d->childrenHiddenByWState =
true;
9205 d->childrenShownByExpose =
false;
9215 QList<QObject*> childList =
d->children;
9216 for (
int i = 0;
i < childList.size(); ++
i) {
9218 if (
w &&
w->isVisible() && !
w->isWindow())
9226 QList<QObject*> childList =
d->children;
9227 for (
int i = 0;
i < childList.size(); ++
i) {
9237 d->resolveLayoutDirection();
9242 d->layout->invalidate();
9247 d->syncBackingStore();
9261 if (!
d->children.isEmpty()) {
9263 for (
int i = 0;
i <
d->children.size(); ++
i) {
9265 if (
o &&
o != modalWidget &&
o->isWidgetType()) {
9274#if QT_CONFIG(tooltip)
9276 if (!
d->toolTip.isEmpty())
9282#if QT_CONFIG(whatsthis)
9284 if (
d->whatsThis.size())
9290 if (
d->whatsThis.isEmpty())
9295 d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
9296 data->fstrut_dirty =
false;
9311 QList<QObject*> childList =
d->children;
9312 for (
int i = 0;
i < childList.size(); ++
i) {
9314 if (
w &&
w->isVisible() && !
w->isWindow())
9327#ifndef QT_NO_GESTURES
9333 if (
const QTLWExtra *te =
d->maybeTopData()) {
9340 d->updateFont(
d->data.fnt);
9341 d->renderToTextureReallyDirty = 1;
9345 if (propName.
size() == 13 && !
qstrncmp(propName,
"_q_customDpi", 12)) {
9349 const char axis = propName.
at(12);
9351 d->extra->customDpiX =
value;
9352 else if (axis ==
'Y')
9353 d->extra->customDpiY =
value;
9354 d->updateFont(
d->data.fnt);
9384 switch(
event->type()) {
9387#if QT_CONFIG(accessibility)
9390 QAccessibleStateChangeEvent
event(
this,
s);
9391 QAccessible::updateAccessibility(&
event);
9402 d->layout->invalidate();
9535#if QT_CONFIG(wheelevent)
9550void QWidget::wheelEvent(QWheelEvent *
event)
9556#if QT_CONFIG(tabletevent)
9577void QWidget::tabletEvent(QTabletEvent *
event)
9608#ifndef QT_NO_SHORTCUT
9696#if !defined(QT_PLATFORM_UIKIT)
9861#ifndef QT_NO_CONTEXTMENU
9926 return d_func()->clipRect();
9961 while (
priv->inheritsInputMethodHints) {
9962 priv =
priv->q_func()->parentWidget()->d_func();
9965 return priv->imHints;
9975 if (
d->imHints == hints)
9986#if QT_CONFIG(draganddrop)
10002void QWidget::dragEnterEvent(QDragEnterEvent *)
10020void QWidget::dragMoveEvent(QDragMoveEvent *)
10036void QWidget::dragLeaveEvent(QDragLeaveEvent *)
10051void QWidget::dropEvent(QDropEvent *)
10165 if (
m ==
d->polished)
10173 QList<QObject*>
children =
d->children;
10176 if (!
o->isWidgetType())
10178 if (
QWidget *
w = qobject_cast<QWidget *>(
o))
10179 w->ensurePolished();
10182 if (
d->parent &&
d->sendChildEvents) {
10197 return d->extra ?
d->extra->mask :
QRegion();
10211 return d_func()->
layout;
10243 qWarning(
"QWidget::setLayout: Cannot set layout to 0");
10248 qWarning(
"QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", which already has a"
10255 if (oldParent && oldParent !=
this) {
10256 if (oldParent->isWidgetType()) {
10260 oldParentWidget->takeLayout();
10262 qWarning(
"QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
10270 l->d_func()->topLevel =
true;
10272 if (oldParent !=
this) {
10274 l->d_func()->reparentChildWidgets(
this);
10279 d->topData()->sizeAdjusted =
false;
10289QLayout *QWidget::takeLayout()
10295 d->layout =
nullptr;
10328 return d->size_policy;
10335 if (
policy ==
d->size_policy)
10339 d->retainSizeWhenHiddenChanged = 1;
10343#if QT_CONFIG(graphicsview)
10344 if (
const auto &extra =
d->extra) {
10345 if (extra->proxyWidget)
10346 extra->proxyWidget->setSizePolicy(
policy);
10351 d->retainSizeWhenHiddenChanged = 0;
10354 d->topData()->sizeAdjusted =
false;
10392 return d->layout ?
d->layout->hasHeightForWidth() :
d->size_policy.hasHeightForWidth();
10412 return d_func()->childAt_helper(
p,
false);
10430 || (ignoreChildrenInDestructor &&
child->data->in_destructor)) {
10436 childPoint -=
child->data->crect.topLeft();
10439 if (!
child->d_func()->pointInsideRectAndMask(childPoint))
10443 if (
QWidget *
w =
child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
10461 if (!
q->isWindow() && !isHidden && (
parent =
q->parentWidget())) {
10462 if (
parent->d_func()->layout)
10463 parent->d_func()->layout->invalidate();
10464 else if (
parent->isVisible())
10483 d->updateGeometry_helper(
false);
10507 d->setWindowFlags(
flags);
10522 d->setWindowFlags(
data->window_flags | flag);
10524 d->setWindowFlags(
data->window_flags & ~flag);
10534 if (
q->data->window_flags ==
flags)
10540 bool visible =
q->isVisible();
10541 const bool windowFlagChanged = (
q->data->window_flags ^
flags) &
Qt::Window;
10542 q->setParent(
q->parentWidget(),
flags);
10546 if (!windowFlagChanged && (visible ||
q->testAttribute(
Qt::WA_Moved)))
10551 q->data->window_flags =
flags;
10616 if (
d->renderToTexture) {
10621 for (
int i = 0;
i <
d->children.size(); ++
i) {
10623 if (
w && !
w->isWindow())
10645 const auto checkForParentChildLoops =
qScopeGuard([&](){
10649 if (++
depth == QObjectPrivate::CheckForParentChildLoopsWarnDepth) {
10650 qWarning(
"QWidget %p (class: '%s', object name: '%s') may have a loop in its parent-child chain; "
10651 "this is undefined behavior",
10654 p =
p->parentWidget();
10665 d->data.fstrut_dirty =
true;
10667 QWidget *desktopWidget =
nullptr;
10672 if (newParent &&
parent && !desktopWidget) {
10674 parent->d_func()->enforceNativeChildren();
10718 if (
d->textureChildSeen &&
parent) {
10725 oldPaintManager->removeDirtyWidget(
this);
10728 oldPaintManager->moveStaticWidgets(
this);
10731 d->reparentFocusWidgets(oldtlw);
10734 const bool useStyleSheetPropagationInWidgetStyles =
10741 const auto pd =
parent->d_func();
10742 d->inheritedFontResolveMask = pd->directFontResolveMask | pd->inheritedFontResolveMask;
10743 d->inheritedPaletteResolveMask = pd->directPaletteResolveMask | pd->inheritedPaletteResolveMask;
10746 d->resolvePalette();
10748 d->resolveLayoutDirection();
10749 d->resolveLocale();
10755 if (newParent || !wasCreated
10765 d->setUpdatesEnabled_helper(
parent ?
parent->updatesEnabled() :
true);
10770 if (
parent &&
d->sendChildEvents) {
10775 if (
parent &&
d->sendChildEvents &&
d->polished) {
10786 if (oldtlw->d_func()->usesRhiFlush && oldtlw !=
window())
10796 d->updateIsOpaque();
10798#if QT_CONFIG(graphicsview)
10801 if (oldtlw->graphicsProxyWidget()) {
10803 ancestorProxy->d_func()->unembedSubWindow(
this);
10807 ancestorProxy->d_func()->embedSubWindow(
this);
10811 if (
d->extra &&
d->extra->hasWindowContainer)
10815 if (oldtlw != newtlw) {
10821 const bool wasUsingRhiFlush = newtlw->d_func()->usesRhiFlush;
10822 newtlw->d_func()->usesRhiFlush =
true;
10823 bool recreate =
false;
10824 if (
QWindow *
w = newtlw->windowHandle()) {
10825 if (
w->surfaceType() != surfaceType || !wasUsingRhiFlush)
10830 if (
w->surfaceType() != surfaceType)
10834 const auto windowStateBeforeDestroy = newtlw->windowState();
10835 const auto visibilityBeforeDestroy = newtlw->isVisible();
10839 newtlw->windowHandle()->setWindowStates(windowStateBeforeDestroy);
10850 Qt::WindowFlags oldFlags =
data.window_flags;
10853 QScreen *targetScreen =
nullptr;
10855 if (newparent && newparent->windowType() ==
Qt::Desktop) {
10858 targetScreen = newparent->screen();
10859 newparent =
nullptr;
10867 targetScreen =
q->parentWidget()->window()->screen();
10870 const bool destroyWindow = (
10877 if (
parent != newparent) {
10881 if (
q->windowHandle())
10882 q->windowHandle()->setFlags(
f);
10897 if (destroyWindow) {
10903 if (!
q->windowHandle()->children().isEmpty()) {
10905 QWindow *newParentWindow = parentWithWindow ? parentWithWindow->windowHandle() :
nullptr;
10907 if (
QWindow *childWindow = qobject_cast<QWindow *>(
child)) {
10908 qCWarning(lcWidgetWindow) <<
"Reparenting" << childWindow
10909 <<
"before destroying" <<
this;
10910 childWindow->setParent(newParentWindow);
10918 q->destroy(
true,
false);
10922 data.window_flags =
f;
10930 if (
q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)
10935 if (!newparent && targetScreen) {
10938 q->windowHandle()->setScreen(targetScreen);
10948 if (parentWithWindow) {
10962 qCDebug(lcWidgetWindow) <<
"Setting" <<
window <<
"transient parent to" << transientParent;
10963 window->setTransientParent(transientParent);
10964 window->setParent(
nullptr);
10966 auto *parentWindow = parentWithWindow->windowHandle();
10967 qCDebug(lcWidgetWindow) <<
"Reparenting" <<
window <<
"into" << parentWindow;
10968 window->setTransientParent(
nullptr);
10969 window->setParent(parentWindow);
10972 qCDebug(lcWidgetWindow) <<
"Making" <<
window <<
"top level window";
10973 window->setTransientParent(
nullptr);
10974 window->setParent(
nullptr);
10984 if (
auto *childWidget = qobject_cast<QWidget*>(
child)) {
10986 childPrivate->reparentWidgetWindows(parentWithWindow);
11016 if (dx == 0 && dy == 0)
11019#if QT_CONFIG(graphicsview)
11026 proxy->scroll(dx, dy,
proxy->subWidgetRect(
this));
11030 d->setDirtyOpaqueRegion();
11031 d->scroll_sys(dx, dy);
11056 if (dx == 0 && dy == 0)
11059#if QT_CONFIG(graphicsview)
11064 if (!
d->dirty.isEmpty()) {
11065 for (
const QRect &
rect :
d->dirty.translated(dx, dy) &
r)
11068 proxy->scroll(dx, dy,
r.translated(
proxy->subWidgetRect(
this).topLeft().toPoint()));
11072 d->scroll_sys(dx, dy,
r);
11111 if (
x >
data->crect.width() ||
y >
data->crect.height())
11115 w =
data->crect.width() -
x;
11117 h =
data->crect.height() -
y;
11143template <
typename T>
11148 if (!
q->isVisible() || !
q->updatesEnabled() ||
r.isEmpty())
11152 if (tlwExtra && tlwExtra->backingStore && tlwExtra->repaintManager)
11208template <
typename T>
11218 if (!
q->isVisible() || !
q->updatesEnabled())
11221 T clipped =
r &
q->rect();
11223 if (clipped.isEmpty())
11232 if (tlwExtra && tlwExtra->backingStore && tlwExtra->repaintManager)
11233 tlwExtra->repaintManager->markDirty(clipped,
q);
11251 const int int_off =
x / (8*
sizeof(
uint));
11253 d->high_attributes[int_off] |= (1<<(
x-(int_off*8*
sizeof(
uint))));
11255 d->high_attributes[int_off] &= ~(1<<(
x-(int_off*8*
sizeof(
uint))));
11260void QWidgetPrivate::macUpdateSizeAttribute()
11271 w->d_func()->macUpdateSizeAttribute();
11290 "QWidget::setAttribute(WidgetAttribute, bool): "
11291 "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
11297 if (
d->noPaintOnScreen)
11313#if QT_CONFIG(draganddrop)
11324 for (
int i = 0;
i <
d->children.size(); ++
i) {
11334 d->sendChildEvents = !on;
11337 d->receiveChildEvents = !on;
11347 for (
int i = 0;
i < 3; ++
i) {
11351 d->macUpdateSizeAttribute();
11381 d->createTLExtra();
11383 d->createTLSysExtra();
11403 d->updateIsOpaque();
11406 d->updateIsOpaque();
11409 d->updateIsOpaque();
11412 d->updateSystemBackground();
11427 d->resolvePalette();
11429 d->resolveLocale();
11455 d->setNetWmWindowTypes();
11461 repaintManager->addStaticWidget(
this);
11463 repaintManager->removeStaticWidget(
this);
11469 d->updateIsTranslucent();
11490 const int int_off =
x / (8*
sizeof(
uint));
11491 return (
d->high_attributes[int_off] & (1<<(
x-(int_off*8*
sizeof(
uint)))));
11522 return (
isWindow() &&
d->maybeTopData()) ?
d->maybeTopData()->opacity / 255. : 1.0;
11535 d->setWindowOpacity_sys(opacity);
11540#if QT_CONFIG(graphicsview)
11555 if (
q->windowHandle())
11556 q->windowHandle()->setOpacity(
level);
11593 d->setWindowModified_helper();
11606 if (!platformWindow)
11610 if (
Q_UNLIKELY(on && !
q->windowTitle().contains(
"[*]"_L1)))
11611 qWarning(
"QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
11617#if QT_CONFIG(tooltip)
11636void QWidget::setToolTip(
const QString &
s)
11645QString QWidget::toolTip()
const
11662void QWidget::setToolTipDuration(
int msec)
11665 d->toolTipDuration = msec;
11668int QWidget::toolTipDuration()
const
11671 return d->toolTipDuration;
11677#if QT_CONFIG(statustip)
11686void QWidget::setStatusTip(
const QString &
s)
11692QString QWidget::statusTip()
const
11695 return d->statusTip;
11699#if QT_CONFIG(whatsthis)
11709void QWidget::setWhatsThis(
const QString &
s)
11715QString QWidget::whatsThis()
const
11718 return d->whatsThis;
11722#if QT_CONFIG(accessibility)
11744void QWidget::setAccessibleName(
const QString &
name)
11747 d->accessibleName =
name;
11748 QAccessibleEvent
event(
this, QAccessible::NameChanged);
11749 QAccessible::updateAccessibility(&
event);
11752QString QWidget::accessibleName()
const
11755 return d->accessibleName;
11774void QWidget::setAccessibleDescription(
const QString &description)
11777 d->accessibleDescription = description;
11778 QAccessibleEvent
event(
this, QAccessible::DescriptionChanged);
11779 QAccessible::updateAccessibility(&
event);
11782QString QWidget::accessibleDescription()
const
11785 return d->accessibleDescription;
11789#ifndef QT_NO_SHORTCUT
11906 const int parentChildCount =
p->d_func()->children.size();
11907 if (parentChildCount < 2)
11909 const int from =
p->d_func()->children.indexOf(
this);
11912 if (from != parentChildCount -1)
11913 p->d_func()->children.move(from, parentChildCount - 1);
11916 else if (from == parentChildCount - 1)
11920 d->subtractOpaqueSiblings(region);
11921 d->invalidateBackingStore(region);
11926 if (
d->extra &&
d->extra->hasWindowContainer)
11937 q->windowHandle()->raise();
11960 const int parentChildCount =
p->d_func()->children.size();
11961 if (parentChildCount < 2)
11963 const int from =
p->d_func()->children.indexOf(
this);
11967 p->d_func()->children.move(from, 0);
11970 else if (from == 0)
11976 if (
d->extra &&
d->extra->hasWindowContainer)
11988 q->windowHandle()->lower();
12006 if (!
w ||
isWindow() ||
p !=
w->parentWidget() ||
this ==
w)
12009 int from =
p->d_func()->children.indexOf(
this);
12010 int to =
p->d_func()->children.indexOf(
w);
12017 p->d_func()->children.move(from, to);
12020 else if (from == to)
12024 d->stackUnder_sys(
w);
12084 return QRect(0, 0, 1, 1);
12087 if (
data.fstrut_dirty
12099 if (
q->data->fstrut_dirty) {
12101 if (te->window && te->window->handle()) {
12102 const QMargins margins = te->window->frameMargins();
12103 if (!margins.
isNull()) {
12104 te->frameStrut.setCoords(margins.
left(), margins.
top(), margins.
right(), margins.
bottom());
12105 q->data->fstrut_dirty =
false;
12112#ifdef QT_KEYPAD_NAVIGATION
12121bool QWidgetPrivate::navigateToDirection(Direction
direction)
12126 return (targetWidget != 0);
12144 const int sourceX =
12146 (sourceRect.
left() + (sourceRect.
right() - sourceRect.
left()) / 2)
12148 const int sourceY =
12150 (sourceRect.
top() + (sourceRect.
bottom() - sourceRect.
top()) / 2)
12152 const QPoint sourcePoint(sourceX, sourceY);
12156 QWidget *targetWidget =
nullptr;
12157 int shortestDistance = INT_MAX;
12160 for (
QWidget *targetCandidate : targetCandidates) {
12162 const QRect targetCandidateRect = targetCandidate->rect().
translated(targetCandidate->mapToGlobal(
QPoint()));
12167 if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty())
12171 if ( targetCandidate != sourceWidget
12183 && targetCandidate->isEnabled()
12185 && targetCandidate->isVisible()
12187 && targetCandidate->window() == sourceWindow) {
12188 const int targetCandidateDistance = [](
const QPoint &sourcePoint,
12189 const QRect &targetCandidateRect) {
12192 if (
p.x() <
r.left())
12193 dx =
r.left() -
p.x();
12194 else if (
p.x() >
r.right())
12195 dx =
p.x() -
r.right();
12196 if (
p.y() <
r.top())
12197 dy =
r.top() -
p.y();
12198 else if (
p.y() >
r.bottom())
12199 dy =
p.y() -
r.bottom();
12202 if (targetCandidateDistance < shortestDistance) {
12203 shortestDistance = targetCandidateDistance;
12204 targetWidget = targetCandidate;
12208 return targetWidget;
12245 if (qobject_cast<const QTabWidget*>(tabWidget))
12276 if (!repaintManager)
12299 return repaintManager ? repaintManager->
backingStore() :
nullptr;
12327 q->updateGeometry();
12336 myOpt.rect.setRect(0, 0, 32768, 32768);
12340 QRect liRect =
q->style()->subElementRect(element,
opt,
q);
12341 if (liRect.isValid()) {
12358 if (!
q->parentWidget()) {
12390 return widget->d_func();
12394#if QT_CONFIG(graphicsview)
12408 return d->extra->proxyWidget;
12414#ifndef QT_NO_GESTURES
12424 d->gestureContext.insert(gesture,
flags);
12438 if (
d->gestureContext.remove(gesture)) {
12440 manager->cleanupCachedGestures(
this, gesture);
12462 d->aboutToDestroy();
12465 d->deactivateWidgetCleanup();
12468 qApp->d_func()->closePopup(
this);
12470 if (
this ==
qApp->activeWindow())
12480 if (destroySubWindows) {
12482 for (
int i = 0;
i < childList.size();
i++) {
12491 if (destroyWindow) {
12492 d->deleteTLSysExtra();
12515 qWarning(
"QWidget::paintEngine: Should no longer be called");
12544#if QT_CONFIG(graphicsview)
12550 result =
d->extra->proxyWidget;
12563 result.window =
nullptr;
12564 for ( ;
w ;
w =
w->parentWidget()) {
12565#if QT_CONFIG(graphicsview)
12568 const QList <QGraphicsView *> views =
scene->
views();
12569 if (!views.isEmpty()) {
12570 result.transform *= qgpw->sceneTransform();
12571 result.transform *= views.first()->viewportTransform();
12572 w = views.first()->viewport();
12583 const QPoint topLeft =
w->geometry().topLeft();
12584 result.transform.translate(topLeft.
x(), topLeft.
y());
12605 return t.window ?
t.window->mapToGlobal(
g) :
g;
12628 const QPointF windowLocal =
t.window ?
t.window->mapFromGlobal(
pos) :
pos;
12629 return t.transform.inverted().map(windowLocal);
12650 window = nativeParent->windowHandle();
12654#ifndef QT_NO_CURSOR
12665#ifndef QT_NO_CURSOR
12671 window->setMouseGrabEnabled(
true);
12682#ifndef QT_NO_CURSOR
12688 window->setMouseGrabEnabled(
false);
12743#ifndef QT_NO_CURSOR
12756 return window ?
window->setMouseGrabEnabled(grab) :
false;
12795 window->setKeyboardGrabEnabled(
true);
12805 return window ?
window->setKeyboardGrabEnabled(grab) :
false;
12819 window->setKeyboardGrabEnabled(
false);
12885 wnd->requestActivate();
12905 auto resolveDevicePixelRatio = [
this,
screen]() ->
qreal {
12917 return data->crect.width();
12921 return data->crect.height();
12928 if (
p->d_func()->extra &&
p->d_func()->extra->customDpiX)
12929 return p->d_func()->extra->customDpiX;
12934 if (
p->d_func()->extra &&
p->d_func()->extra->customDpiY)
12935 return p->d_func()->extra->customDpiY;
12943 return resolveDevicePixelRatio();
12963 painter->d_func()->state->deviceFont =
f;
12985 if (!d_func()->redirectDev)
12989 if (!
sp || !
sp->isActive())
12992 if (
sp->paintEngine()->paintDevice() != d_func()->redirectDev)
13025 if (newMask ==
d->extra->mask)
13028#ifndef QT_NO_BACKINGSTORE
13029 const QRegion oldMask(
d->extra->mask);
13032 d->extra->mask = newMask;
13033 d->extra->hasMask = !newMask.isEmpty();
13038 d->setMask_sys(newMask);
13040#ifndef QT_NO_BACKINGSTORE
13044 if (!
d->extra->hasMask) {
13048 if (!expose.isEmpty()) {
13049 d->setDirtyOpaqueRegion();
13058 parentExpose -= newMask;
13059 if (!parentExpose.isEmpty()) {
13060 d->setDirtyOpaqueRegion();
13061 parentExpose.translate(
data->crect.topLeft());
13066 if (!oldMask.isEmpty())
13067 update(newMask - oldMask);
13076 window->setMask(region);
13119 if (!
d->extra || !
d->extra->hasMask)
13126 Q_ASSERT(widgetAsObject->isWidgetType());
13138 if (
q->isVisible()) {
13139 std::stringstream
s;
13141 <<
q->width() <<
'x' <<
q->height()
13142 << std::showpos <<
q->x() <<
q->y()
13156 if (!
q->windowHandle())
13159 QXcbWindow::WindowTypes wmWindowType = QXcbWindow::None;
13161 wmWindowType |= QXcbWindow::Desktop;
13163 wmWindowType |= QXcbWindow::Dock;
13165 wmWindowType |= QXcbWindow::Toolbar;
13167 wmWindowType |= QXcbWindow::Menu;
13169 wmWindowType |= QXcbWindow::Utility;
13171 wmWindowType |= QXcbWindow::Splash;
13173 wmWindowType |= QXcbWindow::Dialog;
13175 wmWindowType |= QXcbWindow::DropDownMenu;
13177 wmWindowType |= QXcbWindow::PopupMenu;
13179 wmWindowType |= QXcbWindow::Tooltip;
13181 wmWindowType |= QXcbWindow::Notification;
13183 wmWindowType |= QXcbWindow::Combo;
13185 wmWindowType |= QXcbWindow::Dnd;
13187 if (wmWindowType == QXcbWindow::None && skipIfMissing)
13190 if (
auto *xcbWindow =
dynamic_cast<QXcbWindow*
>(
q->windowHandle()->handle()))
13191 xcbWindow->setWindowType(wmWindowType);
13208 && (!excludeChildrenOf || !excludeChildrenOf->isAncestorOf(
child))) {
13215#ifndef QT_NO_DEBUG_STREAM
13225 const QMetaEnum me = qtMo->enumerator(qtMo->indexOfEnumerator(
"WidgetAttribute"));
13248 if (
debug.verbosity() > 2) {
13252 debug <<
", visible";
13254 debug <<
", disabled";
13257 debug <<
", attributes=" << WidgetAttributes{
widget};
13259 debug <<
", window";
13267 debug <<
", margins=" << margins;
13275 debug <<
"QWidget(0x0)";
13284#define FOCUS_NEXT(w) w->d_func()->focus_next
13285#define FOCUS_PREV(w) w->d_func()->focus_prev
13315 qFatal() <<
q <<
"has inconsistent focus chain.";
13317 qCDebug(lcWidgetFocus) <<
q <<
"wasn't removed, because of inconsistent focus chain.";
13322 qCDebug(lcWidgetFocus) <<
q <<
"wasn't removed, because it is not part of a focus chain.";
13332 qCDebug(lcWidgetFocus) <<
q <<
"removed from focus chain.";
13343 qCDebug(lcWidgetFocus) <<
"Initializing focus chain of" <<
q;
13359 QDuplicateTracker<QWidget *> seen;
13361 while (
q->isAncestorOf(
widget)
13362 && !seen.hasSeen(
widget)
13365 focusChildrenInsideChain <<
widget;
13374 if (!focusChildrenInsideChain.contains(
child))
13375 focusChildrenOutsideChain <<
child;
13377 if (focusChildrenOutsideChain.isEmpty())
13381 for (
auto *
child : focusChildrenOutsideChain) {
13403 qCDebug(lcWidgetFocus) <<
"No-op insertion." <<
q <<
"is already before" <<
position;
13418 qCDebug(lcWidgetFocus) <<
"No-op insertion." <<
q <<
"is already after" <<
position;
13447 if (toBeInserted.isEmpty()) {
13448 qCDebug(lcWidgetFocus) <<
"No-op insertion of an empty list";
13454 "Coding error: toBeInserted contains position");
13457 QWidget *last = toBeInserted.constLast();
13460 if (toBeInserted.count() == 1)
13467 qCDebug(lcWidgetFocus) <<
"No-op insertion." << toBeInserted <<
"is already before"
13475 qCDebug(lcWidgetFocus) << toBeInserted <<
"inserted before" <<
position;
13479 qCDebug(lcWidgetFocus) <<
"No-op insertion." << toBeInserted <<
"is already after"
13487 qCDebug(lcWidgetFocus) << toBeInserted <<
"inserted after" <<
position;
13516 if (
path.contains(current))
13519 }
while (current != to);
13536 if (
path.isEmpty()) {
13537 qCDebug(lcWidgetFocus) <<
"No-op removal. Focus chain from" << from <<
"doesn't lead to " << to;
13543 if (
first == last) {
13544 first->d_func()->removeFromFocusChain();
13552 qCDebug(lcWidgetFocus) <<
path <<
"removed from focus chain";
13577 for (
auto *
object : std::as_const(
q->children())) {
13579 if (
w &&
w->focusProxy() ==
q) {
13580 lastFocusChild =
w;
13584 }
else if (
q->isAncestorOf(focusProxy)) {
13585 lastFocusChild = focusProxy;
13588 && focusNext->window() == focusProxy->
window();
13590 if (focusNext == noFurtherThan)
13593 lastFocusChild = focusNext;
13596 return lastFocusChild;
13671 qCDebug(lcWidgetFocus) <<
"Focus chain leading from" <<
q <<
"to" <<
position <<
"is not closed.";
13681#include "moc_qwidget.cpp"
13682#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...
QList< QObject * > associatedObjects() const
static QWidget * focus_widget
static QWidget * hidden_focus_widget
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).
The QFocusEvent class contains event parameters for widget focus events.
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.
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise \nullptr is returned.
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
qsizetype removeAll(const AT &t)
void append(parameter_type t)
bool isDebugEnabled() const
Returns true if debug messages should be shown for this category; false otherwise.
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.
Qt::LayoutDirection layoutDirection() const
Returns the layout direction used by the painter when drawing text.
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 setLayoutDirection(Qt::LayoutDirection direction)
Sets the layout direction used by the painter when drawing text, to the specified direction.
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.
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.
\inmodule QtCore\reentrant
QRect toAlignedRect() const noexcept
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
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 int height() const noexcept
Returns the height of the rectangle.
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 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.
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 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 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 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.
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
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
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
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
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QByteArray toLocal8Bit() const &
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
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...
SubElement
This enum represents a sub-area of a widget.
SurfaceType
The SurfaceType enum describes what type of surface this is.
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)
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.
@ FindChildrenRecursively
@ 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 qCWarning(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
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
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
GLsizei const GLchar *const * path
static const QRectF boundingRect(const QPointF *points, int pointCount)
static constexpr quint16 currentMajorVersion
\qmltype FileInstancing \inherits Instancing \inqmlmodule QtQuick3D
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
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)
QT_BEGIN_NAMESPACE typedef QHash< WId, QWidget * > QWidgetMapper
QList< QWidget * > QWidgetList
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()
QList< QWidget * > widgets
[11]
QGraphicsOpacityEffect * effect
the effect attached to this item
QNetworkAccessManager manager
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept