Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwidget.cpp File Reference
#include "qapplication.h"
#include "qapplication_p.h"
#include "qbrush.h"
#include "qcursor.h"
#include "qevent.h"
#include "qlayout.h"
#include "qmetaobject.h"
#include "qpixmap.h"
#include "qpointer.h"
#include "qstack.h"
#include "qstyle.h"
#include "qstylefactory.h"
#include "qvariant.h"
#include "qwidget.h"
#include "qstyleoption.h"
#include "qstylehints.h"
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformwindow_p.h>
#include "private/qwidgetwindow_p.h"
#include "qpainter.h"
#include "qdebug.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qfileinfo.h"
#include "qscopeguard.h"
#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qinputmethod.h>
#include <qbackingstore.h>
#include <private/qwidgetrepaintmanager_p.h>
#include <private/qpaintengine_raster_p.h>
#include "qwidget_p.h"
#include <QtGui/private/qwindow_p.h>
#include "qlayout_p.h"
#include "QtWidgets/qabstractscrollarea.h"
#include "private/qabstractscrollarea_p.h"
#include "private/qevent_p.h"
#include "private/qgesturemanager_p.h"
#include "qwindowcontainer_p.h"
#include <sstream>
#include "moc_qwidget.cpp"
#include "moc_qwidget_p.cpp"
+ Include dependency graph for qwidget.cpp:

Go to the source code of this file.

Classes

struct  QWidgetExceptionCleaner
 
struct  MapToGlobalTransformResult
 

Functions

 Q_LOGGING_CATEGORY (lcWidgetPainting, "qt.widgets.painting", QtWarningMsg)
 
static bool qRectIntersects (const QRect &r1, const QRect &r2)
 
bool qt_sendSpontaneousEvent (QObject *, QEvent *)
 
static bool q_evaluateRhiConfigRecursive (const QWidget *w, QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType)
 
bool q_evaluateRhiConfig (const QWidget *w, QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType)
 
void q_createNativeChildrenAndSetParent (const QWidget *parentWidget)
 
static void deleteBackingStore (QWidgetPrivate *d)
 
static void fillRegion (QPainter *painter, const QRegion &rgn, const QBrush &brush)
 
static void applyCursor (QWidget *w, const QCursor &c)
 
static void unsetCursor (QWidget *w)
 
void qt_qpa_set_cursor (QWidget *w, bool force)
 
static void sendResizeEvents (QWidget *target)
 
QString qt_setWindowTitle_helperHelper (const QString &title, const QWidget *widget)
 Returns a modified window title with the [*] place holder replaced according to the rules described in QWidget::setWindowTitle.
 
static bool isEmbedded (const QWindow *w)
 
void qSendWindowChangeToTextureChildrenRecursively (QWidget *widget, QEvent::Type eventType)
 
static void setAttribute_internal (Qt::WidgetAttribute attribute, bool on, QWidgetData *data, QWidgetPrivate *d)
 
Q_WIDGETS_EXPORT QWidgetDataqt_qwidget_data (QWidget *widget)
 
Q_WIDGETS_EXPORT QWidgetPrivateqt_widget_private (QWidget *widget)
 
static bool canMapPosition (QWindow *window)
 
static MapToGlobalTransformResult mapToGlobalTransform (const QWidget *w)
 
static QWindowgrabberWindow (const QWidget *w)
 
static void grabMouseForWidget (QWidget *widget, const QCursor *cursor=nullptr)
 
static void releaseMouseGrabOfWidget (QWidget *widget)
 
static void formatWidgetAttributes (QDebug debug, const QWidget *widget)
 
QDebug operator<< (QDebug debug, const QWidget *widget)
 

Variables

QWidgetqt_button_down
 
QWidgetqt_pressGrab = nullptr
 
QWidgetqt_mouseGrb = nullptr
 
static bool mouseGrabWithCursor = false
 
static QWidgetkeyboardGrb = nullptr
 

Function Documentation

◆ applyCursor()

static void applyCursor ( QWidget w,
const QCursor c 
)
inlinestatic

Definition at line 5009 of file qwidget.cpp.

References window().

+ Here is the call graph for this function:

◆ canMapPosition()

static bool canMapPosition ( QWindow window)
inlinestatic

Definition at line 12500 of file qwidget.cpp.

References qt_window_private(), QWindowPrivate::resizeEventPending, and window().

Referenced by mapToGlobalTransform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteBackingStore()

static void deleteBackingStore ( QWidgetPrivate d)
static

Definition at line 1675 of file qwidget.cpp.

References QTLWExtra::backingStore, and d.

Referenced by QWidgetPrivate::deleteTLSysExtra().

+ Here is the caller graph for this function:

◆ fillRegion()

static void fillRegion ( QPainter painter,
const QRegion rgn,
const QBrush brush 
)
inlinestatic

Definition at line 2230 of file qwidget.cpp.

References QRegion::boundingRect(), QPainter::device(), QPainter::drawTiledPixmap(), QPainter::fillRect(), QPaintDevice::height(), QGradient::ObjectBoundingMode, QGradient::ObjectMode, painter, Q_ASSERT, rect, QPainter::restore(), QPainter::save(), QPainter::setClipRegion(), Qt::TexturePattern, and QPaintDevice::width().

Referenced by QWidgetPrivate::paintBackground().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatWidgetAttributes()

static void formatWidgetAttributes ( QDebug  debug,
const QWidget widget 
)
inlinestatic

Definition at line 13160 of file qwidget.cpp.

References debug, QMetaObject::enumerator(), QMetaObject::indexOfEnumerator(), QWidget::testAttribute(), QMetaEnum::valueToKey(), Qt::WA_AttributeCount, and widget.

Referenced by operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ grabberWindow()

static QWindow * grabberWindow ( const QWidget w)
inlinestatic

Definition at line 12606 of file qwidget.cpp.

References QWidget::nativeParentWidget(), and window().

Referenced by QWidget::grabKeyboard(), grabMouseForWidget(), QWidget::releaseKeyboard(), releaseMouseGrabOfWidget(), QWidgetPrivate::stealKeyboardGrab(), and QWidgetPrivate::stealMouseGrab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ grabMouseForWidget()

static void grabMouseForWidget ( QWidget widget,
const QCursor cursor = nullptr 
)
static

Definition at line 12616 of file qwidget.cpp.

References cursor, grabberWindow(), mouseGrabWithCursor, qt_mouseGrb, qt_pressGrab, QWidget::releaseMouse(), QGuiApplication::setOverrideCursor(), widget, and window().

Referenced by QWidget::grabMouse(), and QWidget::grabMouse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEmbedded()

static bool isEmbedded ( const QWindow w)
inlinestatic

Definition at line 6637 of file qwidget.cpp.

Referenced by QWidgetPrivate::hide_helper(), QMenuPrivate::popup(), QWidgetPrivate::setFocus_sys(), QWidgetPrivate::show_helper(), and QQuick3DSceneRenderer::synchronize().

+ Here is the caller graph for this function:

◆ mapToGlobalTransform()

static MapToGlobalTransformResult mapToGlobalTransform ( const QWidget w)
static

Definition at line 12521 of file qwidget.cpp.

References canMapPosition(), QList< T >::first(), QList< T >::isEmpty(), scene, QGraphicsScene::views(), window(), QPoint::x(), and QPoint::y().

Referenced by QWidget::mapFromGlobal(), and QWidget::mapToGlobal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

◆ q_createNativeChildrenAndSetParent()

void q_createNativeChildrenAndSetParent ( const QWidget parentWidget)

Definition at line 1215 of file qwidget.cpp.

References QList< T >::at(), QObject::children(), i, QWidget::internalWinId(), QObject::isWidgetType(), QWidget::isWindow(), QWidget::nativeParentWidget(), q_createNativeChildrenAndSetParent(), qobject_cast< const QWidget * >(), QList< T >::size(), QWidget::testAttribute(), Qt::WA_NativeWindow, QWidget::window(), QWidget::windowHandle(), and QWidget::winId().

Referenced by QWidgetPrivate::create(), and q_createNativeChildrenAndSetParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ q_evaluateRhiConfig()

bool q_evaluateRhiConfig ( const QWidget w,
QPlatformBackingStoreRhiConfig outConfig,
QSurface::SurfaceType outType 
)

Definition at line 1095 of file qwidget.cpp.

References QBackingStoreRhiSupport::checkForceRhi(), q_evaluateRhiConfigRecursive(), and qCDebug.

Referenced by QWidgetWindow::QWidgetWindow(), QWidgetPrivate::create(), and QWidget::setParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ q_evaluateRhiConfigRecursive()

static bool q_evaluateRhiConfigRecursive ( const QWidget w,
QPlatformBackingStoreRhiConfig outConfig,
QSurface::SurfaceType outType 
)
static

Definition at line 1076 of file qwidget.cpp.

References child, QWidgetPrivate::get(), q_evaluateRhiConfigRecursive(), qobject_cast< const QWidget * >(), QWidgetPrivate::rhiConfig(), and QBackingStoreRhiSupport::surfaceTypeForConfig().

Referenced by q_evaluateRhiConfig(), and q_evaluateRhiConfigRecursive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_LOGGING_CATEGORY()

Q_LOGGING_CATEGORY ( lcWidgetPainting  ,
"qt.widgets.painting"  ,
QtWarningMsg   
)

◆ qRectIntersects()

static bool qRectIntersects ( const QRect r1,
const QRect r2 
)
inlinestatic

Definition at line 86 of file qwidget.cpp.

References QRect::bottom(), QRect::left(), qMax(), qMin(), r1, r2, QRect::right(), and QRect::top().

Referenced by QWidgetPrivate::clipRegion(), QWidgetPrivate::overlappedRegion(), QWidgetPrivate::paintSiblingsRecursive(), and QWidgetPrivate::subtractOpaqueSiblings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qSendWindowChangeToTextureChildrenRecursively()

void qSendWindowChangeToTextureChildrenRecursively ( QWidget widget,
QEvent::Type  eventType 
)

Definition at line 10659 of file qwidget.cpp.

References d, e, QWidgetPrivate::get(), i, qobject_cast< QWidget * >(), qSendWindowChangeToTextureChildrenRecursively(), QCoreApplication::sendEvent(), QWidgetPrivate::textureChildSeen, and widget.

Referenced by qSendWindowChangeToTextureChildrenRecursively(), and QWidget::setParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_qpa_set_cursor()

void qt_qpa_set_cursor ( QWidget w,
bool  force 
)

Definition at line 5021 of file qwidget.cpp.

Referenced by QApplicationPrivate::dispatchEnterLeave(), QWidgetPrivate::setCursor_sys(), QWidgetPrivate::setEnabled_helper(), QWidgetPrivate::show_sys(), and QWidgetPrivate::unsetCursor_sys().

+ Here is the caller graph for this function:

◆ qt_qwidget_data()

Q_WIDGETS_EXPORT QWidgetData * qt_qwidget_data ( QWidget widget)

Definition at line 12344 of file qwidget.cpp.

◆ qt_sendSpontaneousEvent()

bool qt_sendSpontaneousEvent ( QObject ,
QEvent  
)
related

◆ qt_setWindowTitle_helperHelper()

QString qt_setWindowTitle_helperHelper ( const QString title,
const QWidget widget 
)

Returns a modified window title with the [*] place holder replaced according to the rules described in QWidget::setWindowTitle.

This function assumes that "[*]" can be quoted by another "[*]", so it will replace two place holders by one and a single last one by either "*" or nothing depending on the modified flag.

Definition at line 5996 of file qwidget.cpp.

References QWidget::isWindowModified(), Q_ASSERT, QStyle::SH_TitleBar_ModifyNotification, QWidget::style(), QStyle::styleHint(), title, and widget.

Referenced by QDockWidget::changeEvent(), QDockWidgetPrivate::init(), QWidgetPrivate::setWindowIconText_helper(), QWidgetPrivate::setWindowTitle_helper(), tabTextFor(), and QMdiSubWindowPrivate::updateInternalWindowTitle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_widget_private()

◆ releaseMouseGrabOfWidget()

static void releaseMouseGrabOfWidget ( QWidget widget)
static

Definition at line 12639 of file qwidget.cpp.

References grabberWindow(), mouseGrabWithCursor, qt_mouseGrb, QGuiApplication::restoreOverrideCursor(), widget, and window().

Referenced by QWidget::releaseMouse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResizeEvents()

static void sendResizeEvents ( QWidget target)
static

Definition at line 5192 of file qwidget.cpp.

References QList< T >::at(), child, e, i, QObject::isWidgetType(), QCoreApplication::sendEvent(), sendResizeEvents(), QList< T >::size(), and Qt::WA_PendingResizeEvent.

Referenced by QWidget::grab(), and sendResizeEvents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAttribute_internal()

static void setAttribute_internal ( Qt::WidgetAttribute  attribute,
bool  on,
QWidgetData data,
QWidgetPrivate d 
)
static

This just sets the corresponding attribute bit to 1 or 0

Definition at line 11202 of file qwidget.cpp.

References d.

Referenced by QWidget::setAttribute().

+ Here is the caller graph for this function:

◆ unsetCursor()

static void unsetCursor ( QWidget w)
inlinestatic

Definition at line 5015 of file qwidget.cpp.

References window().

+ Here is the call graph for this function:

Variable Documentation

◆ keyboardGrb

QWidget* keyboardGrb = nullptr
static

◆ mouseGrabWithCursor

bool mouseGrabWithCursor = false
static

Definition at line 12603 of file qwidget.cpp.

Referenced by grabMouseForWidget(), and releaseMouseGrabOfWidget().

◆ qt_button_down

QWidget* qt_button_down
extern

Definition at line 26 of file qwidgetwindow.cpp.

◆ qt_mouseGrb

QWidget* qt_mouseGrb = nullptr

◆ qt_pressGrab

QWidget* qt_pressGrab = nullptr

Definition at line 12601 of file qwidget.cpp.

Referenced by grabMouseForWidget(), and QWidget::mouseGrabber().