Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | Static Public Variables | List of all members
QWidgetPrivate Class Reference

#include <qwidget_p.h>

Inheritance diagram for QWidgetPrivate:
QObjectPrivate QObjectData QAbstractButtonPrivate QAbstractSliderPrivate QAbstractSpinBoxPrivate QCalendarWidgetPrivate QColumnViewGripPrivate QComboBoxPrivate QDesktopWidgetPrivate QDesktopWidgetPrivate QDesktopWidgetPrivate QDialogButtonBoxPrivate QDialogPrivate QDockWidgetPrivate QFocusFramePrivate QFramePrivate QGLWidgetPrivate QGroupBoxPrivate QLineEditPrivate QMacCocoaViewContainerPrivate QMacNativeWidgetPrivate QMainWindowPrivate QMdiSubWindowPrivate QMenuBarPrivate QMenuPrivate QPrintPreviewWidgetPrivate QProgressBarPrivate QRubberBandPrivate QScriptBreakpointsWidgetInterfacePrivate QScriptDebuggerCodeFinderWidgetInterfacePrivate QScriptDebuggerCodeViewInterfacePrivate QScriptDebuggerCodeWidgetInterfacePrivate QScriptDebuggerConsoleWidgetInterfacePrivate QScriptDebuggerLocalsWidgetInterfacePrivate QScriptDebuggerScriptsWidgetInterfacePrivate QScriptDebuggerStackWidgetInterfacePrivate QScriptDebugOutputWidgetInterfacePrivate QScriptErrorLogWidgetInterfacePrivate QSizeGripPrivate QSplashScreenPrivate QSplitterHandlePrivate QStatusBarPrivate QSvgWidgetPrivate QTabBarPrivate QTabWidgetPrivate QToolBarPrivate QWizardPagePrivate QWorkspacePrivate QWorkspaceTitleBarPrivate QWSEmbedWidgetPrivate QX11EmbedContainerPrivate QX11EmbedWidgetPrivate

Public Types

enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Public Functions

void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Static Public Functions

static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Public Variables

QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Static Public Variables

static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 363 of file qwidget_p.h.

Enumerations

◆ CloseMode

Enumerator
CloseNoEvent 
CloseWithEvent 
CloseWithSpontaneousEvent 

Definition at line 380 of file qwidget_p.h.

◆ Direction

Enumerator
DirectionNorth 
DirectionEast 
DirectionSouth 
DirectionWest 

Definition at line 386 of file qwidget_p.h.

◆ DrawWidgetFlags

Enumerator
DrawAsRoot 
DrawPaintOnScreen 
DrawRecursive 
DrawInvisible 
DontSubtractOpaqueChildren 
DontSetCompositionMode 
DontDrawOpaqueChildren 
DontDrawNativeChildren 

Definition at line 369 of file qwidget_p.h.

Constructors and Destructors

◆ QWidgetPrivate()

QWidgetPrivate::QWidgetPrivate ( int  version = QObjectPrivateVersion)
explicit

Definition at line 288 of file qwidget.cpp.

289  : QObjectPrivate(version)
290  , extra(0)
291  , focus_next(0)
292  , focus_prev(0)
293  , focus_child(0)
294  , layout(0)
295  , needsFlush(0)
296  , redirectDev(0)
297  , widgetItem(0)
298  , extraPaintEngine(0)
299  , polished(0)
300  , graphicsEffect(0)
301 #if !defined(QT_NO_IM)
303 #endif
306  , leftmargin(0)
307  , topmargin(0)
308  , rightmargin(0)
309  , bottommargin(0)
314  , hd(0)
319  , isOpaque(0)
320  , inDirtyList(0)
321  , isScrolled(0)
322  , isMoved(0)
323  , isGLWidget(0)
325 #ifndef QT_NO_IM
327 #endif
328  , inSetParent(0)
329 #if defined(Q_WS_X11)
330  , picture(0)
331 #elif defined(Q_WS_WIN)
332  , noPaintOnScreen(0)
333  #ifndef QT_NO_GESTURES
334  , nativeGesturePanEnabled(0)
335  #endif
336 #elif defined(Q_WS_MAC)
337  , needWindowChange(0)
338  , window_event(0)
339  , qd_hd(0)
340 #elif defined(Q_OS_SYMBIAN)
341  , symbianScreenNumber(0)
342  , fixNativeOrientationCalled(false)
343  , isGLGlobalShareWidget(0)
344 #endif
345 {
346  if (!qApp) {
347  qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
348  return;
349  }
350 
351  if (version != QObjectPrivateVersion)
352  qFatal("Cannot mix incompatible Qt libraries");
353 
354  isWidget = true;
355  memset(high_attributes, 0, sizeof(high_attributes));
356 #if QT_MAC_USE_COCOA
357  drawRectOriginalAdded = false;
358  originalDrawMethod = true;
359  changeMethods = false;
360  isInUnifiedToolbar = false;
361  unifiedSurface = 0;
362  toolbar_ancestor = 0;
363  flushRequested = false;
364  touchEventsEnabled = false;
365 #endif // QT_MAC_USE_COCOA
366 #ifdef QWIDGET_EXTRA_DEBUG
367  static int count = 0;
368  qDebug() << "widgets" << ++count;
369 #endif
370 }
short rightmargin
Definition: qwidget_p.h:746
Qt::InputMethodHints imHints
Definition: qwidget_p.h:718
short topmargin
Definition: qwidget_p.h:745
Qt::HANDLE hd
Definition: qwidget_p.h:754
QLayout * layout
Definition: qwidget_p.h:704
uint inheritsInputMethodHints
Definition: qwidget_p.h:778
uint isWidget
Definition: qobject.h:95
QSizePolicy size_policy
Definition: qwidget_p.h:756
const QMetaObject * polished
Definition: qwidget_p.h:709
signed char topLayoutItemMargin
Definition: qwidget_p.h:749
signed char bottomLayoutItemMargin
Definition: qwidget_p.h:751
QPaintDevice * redirectDev
Definition: qwidget_p.h:706
QPaintEngine * extraPaintEngine
Definition: qwidget_p.h:708
Q_CORE_EXPORT void qDebug(const char *,...)
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
QObjectPrivate(int version=QObjectPrivateVersion)
Definition: qobject.cpp:133
#define qApp
QPalette::ColorRole bg_role
Definition: qwidget_p.h:769
uint inSetParent
Definition: qwidget_p.h:780
short leftmargin
Definition: qwidget_p.h:744
QWidget * focus_child
Definition: qwidget_p.h:703
QWidget * focus_next
Definition: qwidget_p.h:701
uint inDirtyList
Definition: qwidget_p.h:772
QPalette::ColorRole fg_role
Definition: qwidget_p.h:768
uint dirtyOpaqueChildren
Definition: qwidget_p.h:770
uint high_attributes[4]
Definition: qwidget_p.h:767
uint inheritedPaletteResolveMask
Definition: qwidget_p.h:743
QRegion * needsFlush
Definition: qwidget_p.h:705
Q_CORE_EXPORT void qFatal(const char *,...)
QWidget * focus_prev
Definition: qwidget_p.h:702
QWidgetItemV2 * widgetItem
Definition: qwidget_p.h:707
signed char rightLayoutItemMargin
Definition: qwidget_p.h:750
signed char leftLayoutItemMargin
Definition: qwidget_p.h:748
uint inheritedFontResolveMask
Definition: qwidget_p.h:742
Qt::HANDLE picture
Definition: qwidget_p.h:785
QWExtra * extra
Definition: qwidget_p.h:700
uint usesDoubleBufferedGLContext
Definition: qwidget_p.h:776
short bottommargin
Definition: qwidget_p.h:747

◆ ~QWidgetPrivate()

QWidgetPrivate::~QWidgetPrivate ( )

Definition at line 373 of file qwidget.cpp.

374 {
375 #ifdef Q_OS_SYMBIAN
376  _q_cleanupWinIds();
377 #endif
378 
379  if (widgetItem)
380  widgetItem->wid = 0;
381 
382  if (extra)
383  deleteExtra();
384 
385 #ifndef QT_NO_GRAPHICSEFFECT
386  delete graphicsEffect;
387 #endif //QT_NO_GRAPHICSEFFECT
388 }
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
QWidgetItemV2 * widgetItem
Definition: qwidget_p.h:707
QWExtra * extra
Definition: qwidget_p.h:700
QWidget * wid
Definition: qlayoutitem.h:141
void deleteExtra()
Deletes the widget extra data.
Definition: qwidget.cpp:1843

Functions

◆ _q_showIfNotHidden()

void QWidgetPrivate::_q_showIfNotHidden ( )

Definition at line 8137 of file qwidget.cpp.

8138 {
8139  Q_Q(QWidget);
8140  if ( !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)) )
8141  q->setVisible(true);
8142 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ aboutToDestroy()

virtual void QWidgetPrivate::aboutToDestroy ( )
inlinevirtual

Reimplemented in QGLWidgetPrivate.

Definition at line 581 of file qwidget_p.h.

581 {}

◆ activateChildLayoutsRecursively()

void QWidgetPrivate::activateChildLayoutsRecursively ( )

Definition at line 7752 of file qwidget.cpp.

Referenced by activateChildLayoutsRecursively().

7753 {
7754  sendPendingMoveAndResizeEvents(false, true);
7755 
7756  for (int i = 0; i < children.size(); ++i) {
7757  QWidget *child = qobject_cast<QWidget *>(children.at(i));
7758  if (!child || child->isHidden() || child->isWindow())
7759  continue;
7760 
7761  child->ensurePolished();
7762 
7763  // Activate child's layout
7764  QWidgetPrivate *childPrivate = child->d_func();
7765  if (childPrivate->layout)
7766  childPrivate->layout->activate();
7767 
7768  // Pretend we're visible.
7769  const bool wasVisible = child->isVisible();
7770  if (!wasVisible)
7772 
7773  // Do the same for all my children.
7774  childPrivate->activateChildLayoutsRecursively();
7775 
7776  // We're not cheating anymore.
7777  if (!wasVisible)
7778  child->setAttribute(Qt::WA_WState_Visible, false);
7779  }
7780 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
QLayout * layout
Definition: qwidget_p.h:704
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool activate()
Redoes the layout for parentWidget() if necessary.
Definition: qlayout.cpp:1249
QObjectList children
Definition: qobject.h:93
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void activateChildLayoutsRecursively()
Definition: qwidget.cpp:7752
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
void sendPendingMoveAndResizeEvents(bool recursive=false, bool disableUpdates=false)
Definition: qwidget.cpp:7720

◆ adjustedSize()

QSize QWidgetPrivate::adjustedSize ( ) const

Definition at line 8425 of file qwidget.cpp.

8426 {
8427  Q_Q(const QWidget);
8428 
8429  QSize s = q->sizeHint();
8430 
8431  if (q->isWindow()) {
8432  Qt::Orientations exp;
8433  if (layout) {
8434  if (layout->hasHeightForWidth())
8436  exp = layout->expandingDirections();
8437  } else
8438  {
8439  if (q->sizePolicy().hasHeightForWidth())
8440  s.setHeight(q->heightForWidth(s.width()));
8441  exp = q->sizePolicy().expandingDirections();
8442  }
8443  if (exp & Qt::Horizontal)
8444  s.setWidth(qMax(s.width(), 200));
8445  if (exp & Qt::Vertical)
8446  s.setHeight(qMax(s.height(), 100));
8447 #if defined(Q_WS_X11)
8448  QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen());
8449 #else // all others
8450  QRect screen = QApplication::desktop()->screenGeometry(q->pos());
8451 #endif
8452 #if defined (Q_WS_WINCE) || defined (Q_OS_SYMBIAN)
8453  s.setWidth(qMin(s.width(), screen.width()));
8454  s.setHeight(qMin(s.height(), screen.height()));
8455 #else
8456  s.setWidth(qMin(s.width(), screen.width()*2/3));
8457  s.setHeight(qMin(s.height(), screen.height()*2/3));
8458 #endif
8459  if (QTLWExtra *extra = maybeTopData())
8460  extra->sizeAdjusted = true;
8461  }
8462 
8463  if (!s.isValid()) {
8464  QRect r = q->childrenRect(); // get children rectangle
8465  if (r.isNull())
8466  return s;
8467  s = r.size() + QSize(2 * r.x(), 2 * r.y());
8468  }
8469 
8470  return s;
8471 }
int totalHeightForWidth(int w) const
Also takes contentsMargins and menu bar into account.
Definition: qlayout.cpp:823
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QLayout * layout
Definition: qwidget_p.h:704
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
virtual bool hasHeightForWidth() const
Returns true if this layout&#39;s preferred height depends on its width; otherwise returns false...
QTLWExtra * maybeTopData() const
Definition: qwidget_p.h:1010
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Qt::Orientations expandingDirections() const
Returns whether this layout can make use of more space than sizeHint().
Definition: qlayout.cpp:1198
#define Q_Q(Class)
Definition: qglobal.h:2483
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
int width() const
Returns the width.
Definition: qsize.h:126
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
const QRect screenGeometry(int screen=-1) const
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
QWExtra * extra
Definition: qwidget_p.h:700
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ adjustFlags()

void QWidgetPrivate::adjustFlags ( Qt::WindowFlags &  flags,
QWidget w = 0 
)
static

Definition at line 1242 of file qwidget.cpp.

Referenced by QWorkspace::addWindow(), isServerProcess(), and setParent_sys().

1243 {
1244  bool customize = (flags & (Qt::CustomizeWindowHint
1252 
1253  uint type = (flags & Qt::WindowType_Mask);
1254 
1255  if ((type == Qt::Widget || type == Qt::SubWindow) && w && !w->parent()) {
1256  type = Qt::Window;
1257  flags |= Qt::Window;
1258  }
1259 
1260  if (flags & Qt::CustomizeWindowHint) {
1261  // modify window flags to make them consistent.
1262  // Only enable this on non-Mac platforms. Since the old way of doing this would
1263  // interpret WindowSystemMenuHint as a close button and we can't change that behavior
1264  // we can't just add this in.
1265 #ifndef Q_WS_MAC
1267  flags |= Qt::WindowSystemMenuHint;
1268 #else
1271 #endif
1272  flags |= Qt::WindowTitleHint;
1273  flags &= ~Qt::FramelessWindowHint;
1274  }
1275  } else if (customize && !(flags & Qt::FramelessWindowHint)) {
1276  // if any of the window hints that affect the titlebar are set
1277  // and the window is supposed to have frame, we add a titlebar
1278  // and system menu by default.
1279  flags |= Qt::WindowSystemMenuHint;
1280  flags |= Qt::WindowTitleHint;
1281  }
1282  if (customize)
1283  ; // don't modify window flags if the user explicitly set them.
1284  else if (type == Qt::Dialog || type == Qt::Sheet)
1285 #ifndef Q_WS_WINCE
1287 #else
1289 #endif
1290  else if (type == Qt::Tool)
1292  else
1294 
1295 
1296 }
int type
Definition: qmetatype.cpp:239
unsigned int uint
Definition: qglobal.h:996
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
Definition: qnamespace.h:54

◆ adjustQuitOnCloseAttribute()

void QWidgetPrivate::adjustQuitOnCloseAttribute ( )

Definition at line 12900 of file qwidget.cpp.

12901 {
12902  Q_Q(QWidget);
12903 
12904  if (!q->parentWidget()) {
12905  Qt::WindowType type = q->windowType();
12906  if (type == Qt::Widget || type == Qt::SubWindow)
12907  type = Qt::Window;
12908  if (type != Qt::Widget && type != Qt::Window && type != Qt::Dialog)
12909  q->setAttribute(Qt::WA_QuitOnClose, false);
12910  }
12911 }
int type
Definition: qmetatype.cpp:239
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
WindowType
Definition: qnamespace.h:270
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ assignedInputContext()

QInputContext * QWidgetPrivate::assignedInputContext ( ) const

Definition at line 446 of file qwidget.cpp.

Referenced by inputContext().

447 {
448  const QWidget *widget = q_func();
449  while (widget) {
450  if (QInputContext *qic = widget->d_func()->ic)
451  return qic;
452  widget = widget->parentWidget();
453  }
454  return 0;
455 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83

◆ beginSharedPainter()

QPainter* QWidgetPrivate::beginSharedPainter ( )

◆ childAt_helper()

QWidget * QWidgetPrivate::childAt_helper ( const QPoint p,
bool  ignoreChildrenInDestructor 
) const

Definition at line 10288 of file qwidget.cpp.

10289 {
10290  if (children.isEmpty())
10291  return 0;
10292 
10293 #ifdef Q_WS_MAC
10294  Q_Q(const QWidget);
10295  // Unified tool bars on the Mac require special handling since they live outside
10296  // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8
10297  bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q)
10298  && static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac();
10299  if (includeFrame)
10300  return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame);
10301 #endif
10302 
10303  if (!pointInsideRectAndMask(p))
10304  return 0;
10305  return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
10306 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame=false) const
Definition: qwidget.cpp:10308
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
bool unifiedTitleAndToolBarOnMac
whether the window uses the unified title and toolbar look on Mac OS X
Definition: qmainwindow.h:83
bool pointInsideRectAndMask(const QPoint &) const
Definition: qwidget_p.h:1029
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63

◆ childAtRecursiveHelper()

QWidget * QWidgetPrivate::childAtRecursiveHelper ( const QPoint p,
bool  ignoreChildrenInDestructor,
bool  includeFrame = false 
) const

Definition at line 10308 of file qwidget.cpp.

10309 {
10310 #ifndef Q_WS_MAC
10311  Q_UNUSED(includeFrame);
10312 #endif
10313  for (int i = children.size() - 1; i >= 0; --i) {
10314  QWidget *child = qobject_cast<QWidget *>(children.at(i));
10315  if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)
10316  || (ignoreChildrenInDestructor && child->data->in_destructor)) {
10317  continue;
10318  }
10319 
10320  // Map the point 'p' from parent coordinates to child coordinates.
10321  QPoint childPoint = p;
10322 #ifdef Q_WS_MAC
10323  // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar.
10324  // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal
10325  // QWidget::mapFromParent won't do the trick.
10326  if (includeFrame && qobject_cast<QToolBar *>(child))
10327  childPoint = qt_mac_nativeMapFromParent(child, p);
10328  else
10329 #endif
10330  childPoint -= child->data->crect.topLeft();
10331 
10332  // Check if the point hits the child.
10333  if (!child->d_func()->pointInsideRectAndMask(childPoint))
10334  continue;
10335 
10336  // Do the same for the child's descendants.
10337  if (QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
10338  return w;
10339 
10340  // We have found our target; namely the child at position 'p'.
10341  return child;
10342  }
10343  return 0;
10344 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt)
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWidgetData * data
Definition: qwidget.h:815
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
uint in_destructor
Definition: qwidget.h:129
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ clipRect()

QRect QWidgetPrivate::clipRect ( ) const

Definition at line 1997 of file qwidget.cpp.

Referenced by QX11PaintEngine::begin(), QIconModeViewBase::doDynamicLayout(), QListModeViewBase::doStaticLayout(), effectiveState(), moveRect(), QFocusFrame::paintEvent(), QWidgetBackingStore::staticContents(), and QWidgetBackingStore::sync().

1998 {
1999  Q_Q(const QWidget);
2000  const QWidget * w = q;
2001  if (!w->isVisible())
2002  return QRect();
2003  QRect r = effectiveRectFor(q->rect());
2004  int ox = 0;
2005  int oy = 0;
2006  while (w
2007  && w->isVisible()
2008  && !w->isWindow()
2009  && w->parentWidget()) {
2010  ox -= w->x();
2011  oy -= w->y();
2012  w = w->parentWidget();
2013  r &= QRect(ox, oy, w->width(), w->height());
2014  }
2015  return r;
2016 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int x
the x coordinate of the widget relative to its parent including any window frame
Definition: qwidget.h:161
#define Q_Q(Class)
Definition: qglobal.h:2483
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
int y
the y coordinate of the widget relative to its parent and including any window frame ...
Definition: qwidget.h:162
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658

◆ clipRegion()

QRegion QWidgetPrivate::clipRegion ( ) const

Definition at line 2021 of file qwidget.cpp.

Referenced by effectiveState().

2022 {
2023  Q_Q(const QWidget);
2024  if (!q->isVisible())
2025  return QRegion();
2026  QRegion r(q->rect());
2027  const QWidget * w = q;
2028  const QWidget *ignoreUpTo;
2029  int ox = 0;
2030  int oy = 0;
2031  while (w
2032  && w->isVisible()
2033  && !w->isWindow()
2034  && w->parentWidget()) {
2035  ox -= w->x();
2036  oy -= w->y();
2037  ignoreUpTo = w;
2038  w = w->parentWidget();
2039  r &= QRegion(ox, oy, w->width(), w->height());
2040 
2041  int i = 0;
2042  while(w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo))
2043  ;
2044  for ( ; i < w->d_func()->children.size(); ++i) {
2045  if(QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) {
2046  if(sibling->isVisible() && !sibling->isWindow()) {
2047  QRect siblingRect(ox+sibling->x(), oy+sibling->y(),
2048  sibling->width(), sibling->height());
2049  if (qRectIntersects(siblingRect, q->rect()))
2050  r -= QRegion(siblingRect);
2051  }
2052  }
2053  }
2054  }
2055  return r;
2056 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
int x
the x coordinate of the widget relative to its parent including any window frame
Definition: qwidget.h:161
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool qRectIntersects(const QRect &r1, const QRect &r2)
Definition: qwidget.cpp:163
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ clipToEffectiveMask()

void QWidgetPrivate::clipToEffectiveMask ( QRegion region) const

Definition at line 2230 of file qwidget.cpp.

Referenced by QX11PaintEngine::begin(), QWidgetBackingStore::staticContents(), and QWidgetBackingStore::sync().

2231 {
2232  Q_Q(const QWidget);
2233 
2234  const QWidget *w = q;
2235  QPoint offset;
2236 
2237 #ifndef QT_NO_GRAPHICSEFFECT
2238  if (graphicsEffect) {
2239  w = q->parentWidget();
2240  offset -= data.crect.topLeft();
2241  }
2242 #endif //QT_NO_GRAPHICSEFFECT
2243 
2244  while (w) {
2245  const QWidgetPrivate *wd = w->d_func();
2246  if (wd->extra && wd->extra->hasMask)
2247  region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask;
2248  if (w->isWindow())
2249  return;
2250  offset -= wd->data.crect.topLeft();
2251  w = w->parentWidget();
2252  }
2253 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
QRegion mask
Definition: qwidget_p.h:260
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ close_helper()

bool QWidgetPrivate::close_helper ( CloseMode  mode)

Definition at line 8218 of file qwidget.cpp.

Referenced by QApplication::qwsProcessEvent().

8219 {
8220  if (data.is_closing)
8221  return true;
8222 
8223  Q_Q(QWidget);
8224  data.is_closing = 1;
8225 
8226  QPointer<QWidget> that = q;
8228 
8229 #ifdef QT3_SUPPORT
8230  bool isMain = (QApplicationPrivate::main_widget == q);
8231 #endif
8232  bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
8233  if (mode != CloseNoEvent) {
8234  QCloseEvent e;
8235  if (mode == CloseWithSpontaneousEvent)
8237  else
8238  QApplication::sendEvent(q, &e);
8239  if (!that.isNull() && !e.isAccepted()) {
8240  data.is_closing = 0;
8241  return false;
8242  }
8243  }
8244 
8245  if (!that.isNull() && !q->isHidden())
8246  q->hide();
8247 
8248 #ifdef QT3_SUPPORT
8249  if (isMain)
8251 #endif
8252  // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
8253  quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
8254 
8255  if (quitOnClose) {
8256  /* if there is no non-withdrawn primary window left (except
8257  the ones without QuitOnClose), we emit the lastWindowClosed
8258  signal */
8260  bool lastWindowClosed = true;
8261  for (int i = 0; i < list.size(); ++i) {
8262  QWidget *w = list.at(i);
8263  if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))
8264  continue;
8265  lastWindowClosed = false;
8266  break;
8267  }
8268  if (lastWindowClosed)
8270  }
8271 
8272  if (!that.isNull()) {
8273  data.is_closing = 0;
8274  if (q->testAttribute(Qt::WA_DeleteOnClose)) {
8275  q->setAttribute(Qt::WA_DeleteOnClose, false);
8276  q->deleteLater();
8277  }
8278  }
8279  return true;
8280 }
static QWidget * main_widget
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
Definition: qpointer.h:70
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
static void quit()
Tells the application to exit with return code 0 (success).
bool isAccepted() const
Definition: qcoreevent.h:307
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
uint is_closing
Definition: qwidget.h:123
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
static QWidget * parentWidget(const QWidget *w)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static void emitLastWindowClosed()
The QCloseEvent class contains parameters that describe a close event.
Definition: qevent.h:364
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ create_sys()

void QWidgetPrivate::create_sys ( WId  window,
bool  initializeWindow,
bool  destroyOldWindow 
)

Definition at line 2480 of file qwidget_mac.mm.

Referenced by getNetWmState(), isServerProcess(), q_createNativeChildrenAndSetParent(), and qt_tablet_cleanup_wce().

2481 {
2482  Q_Q(QWidget);
2484 
2485  OSViewRef destroyid = 0;
2486 #ifndef QT_MAC_USE_COCOA
2487  window_event = 0;
2488 #endif
2489 
2490  Qt::WindowType type = q->windowType();
2491  Qt::WindowFlags flags = data.window_flags;
2493 
2494  bool topLevel = (flags & Qt::Window);
2495  bool popup = (type == Qt::Popup);
2496  bool dialog = (type == Qt::Dialog
2497  || type == Qt::Sheet
2498  || type == Qt::Drawer
2499  || (flags & Qt::MSWindowsFixedSizeDialogHint));
2500  bool desktop = (type == Qt::Desktop);
2501 
2502  // Determine this early for top-levels so, we can use it later.
2503  if (topLevel)
2504  determineWindowClass();
2505 
2506  if (desktop) {
2507  QSize desktopSize = qt_mac_desktopSize();
2508  q->setAttribute(Qt::WA_WState_Visible);
2509  data.crect.setRect(0, 0, desktopSize.width(), desktopSize.height());
2510  dialog = popup = false; // force these flags off
2511  } else {
2512  if (topLevel && (type != Qt::Drawer)) {
2513  if (QDesktopWidget *dsk = QApplication::desktop()) { // calc pos/size from screen
2514  const bool wasResized = q->testAttribute(Qt::WA_Resized);
2515  const bool wasMoved = q->testAttribute(Qt::WA_Moved);
2516  int deskn = dsk->primaryScreen();
2517  if (parentWidget && parentWidget->windowType() != Qt::Desktop)
2518  deskn = dsk->screenNumber(parentWidget);
2519  QRect screenGeo = dsk->screenGeometry(deskn);
2520  if (!wasResized) {
2521 #ifndef QT_MAC_USE_COCOA
2522  data.crect.setSize(QSize(screenGeo.width()/2, 4*screenGeo.height()/10));
2523 #else
2524  NSRect newRect = [NSWindow frameRectForContentRect:NSMakeRect(0, 0,
2525  screenGeo.width() / 2.,
2526  4 * screenGeo.height() / 10.)
2527  styleMask:topData()->wattr];
2528  data.crect.setSize(QSize(newRect.size.width, newRect.size.height));
2529 #endif
2530  // Constrain to minimums and maximums we've set
2531  if (extra->minw > 0)
2533  if (extra->minh > 0)
2535  if (extra->maxw > 0)
2537  if (extra->maxh > 0)
2539  }
2540  if (!wasMoved && !q->testAttribute(Qt::WA_DontShowOnScreen))
2541  data.crect.moveTopLeft(QPoint(screenGeo.width()/4,
2542  3 * screenGeo.height() / 10));
2543  }
2544  }
2545  }
2546 
2547 
2548  if(!window) // always initialize
2549  initializeWindow=true;
2550 
2551  hd = 0;
2552  if(window) { // override the old window (with a new NSView)
2553  OSViewRef nativeView = OSViewRef(window);
2554  OSViewRef parent = 0;
2555 #ifndef QT_MAC_USE_COCOA
2556  CFRetain(nativeView);
2557 #else
2558  [nativeView retain];
2559 #endif
2560  if (destroyOldWindow)
2561  destroyid = qt_mac_nativeview_for(q);
2562  bool transfer = false;
2563  setWinId((WId)nativeView);
2564 #ifndef QT_MAC_USE_COCOA
2565 #ifndef HIViewInstallEventHandler
2566  // Macro taken from the CarbonEvents Header on Tiger
2567 #define HIViewInstallEventHandler( target, handler, numTypes, list, userData, outHandlerRef ) \
2568  InstallEventHandler( HIObjectGetEventTarget( (HIObjectRef) (target) ), (handler), (numTypes), (list), (userData), (outHandlerRef) )
2569 #endif
2570  HIViewInstallEventHandler(nativeView, make_widget_eventUPP(), GetEventTypeCount(widget_events), widget_events, 0, 0);
2571 #endif
2572  if(topLevel) {
2573  for(int i = 0; i < 2; ++i) {
2574  if(i == 1) {
2575  if(!initializeWindow)
2576  break;
2577  createWindow_sys();
2578  }
2579  if(OSWindowRef windowref = qt_mac_window_for(nativeView)) {
2580 #ifndef QT_MAC_USE_COCOA
2581  CFRetain(windowref);
2582 #else
2583  [windowref retain];
2584 #endif
2585  if (initializeWindow) {
2586  parent = qt_mac_get_contentview_for(windowref);
2587  } else {
2588 #ifndef QT_MAC_USE_COCOA
2589  parent = HIViewGetSuperview(nativeView);
2590 #else
2591  parent = [nativeView superview];
2592 #endif
2593  }
2594  break;
2595  }
2596  }
2597  if(!parent)
2598  transfer = true;
2599  } else if (parentWidget) {
2600  // I need to be added to my parent, therefore my parent needs an NSView
2601  // Alien note: a 'window' was supplied as argument, meaning this widget
2602  // is not alien. So therefore the parent cannot be alien either.
2603  parentWidget->createWinId();
2604  parent = qt_mac_nativeview_for(parentWidget);
2605  }
2606  if(parent != nativeView && parent) {
2607 #ifndef QT_MAC_USE_COCOA
2608  HIViewAddSubview(parent, nativeView);
2609 #else
2610  [parent addSubview:nativeView];
2611 #endif
2612  }
2613  if(transfer)
2614  transferChildren();
2615  data.fstrut_dirty = true; // we'll re calculate this later
2616  q->setAttribute(Qt::WA_WState_Visible,
2617 #ifndef QT_MAC_USE_COCOA
2618  HIViewIsVisible(nativeView)
2619 #else
2620  ![nativeView isHidden]
2621 #endif
2622  );
2623  if(initializeWindow) {
2624 #ifndef QT_MAC_USE_COCOA
2625  HIRect bounds = CGRectMake(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
2626  HIViewSetFrame(nativeView, &bounds);
2627  q->setAttribute(Qt::WA_WState_Visible, HIViewIsVisible(nativeView));
2628 #else
2629  NSRect bounds = NSMakeRect(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
2630  [nativeView setFrame:bounds];
2631  q->setAttribute(Qt::WA_WState_Visible, [nativeView isHidden]);
2632 #endif
2633  }
2634 #ifndef QT_MAC_USE_COCOA
2635  initWindowPtr();
2636 #endif
2637  } else if (desktop) { // desktop widget
2638  if (!qt_root_win)
2639  QWidgetPrivate::qt_create_root_win();
2641  WId rootWinID = 0;
2642 #ifndef QT_MAC_USE_COCOA
2643  CFRetain(qt_root_win);
2644  if(HIViewRef rootContentView = HIViewGetRoot(qt_root_win)) {
2645  rootWinID = (WId)rootContentView;
2646  CFRetain(rootContentView);
2647  }
2648 #else
2649  [qt_root_win retain];
2650  if (OSViewRef rootContentView = [qt_root_win contentView]) {
2651  rootWinID = (WId)rootContentView;
2652  [rootContentView retain];
2653  }
2654 #endif
2655  setWinId(rootWinID);
2656  } else if (topLevel) {
2657  determineWindowClass();
2658  if(OSViewRef osview = qt_mac_create_widget(q, this, 0)) {
2659 #ifndef QT_MAC_USE_COCOA
2660  HIRect bounds = CGRectMake(data.crect.x(), data.crect.y(),
2661  data.crect.width(), data.crect.height());
2662  HIViewSetFrame(osview, &bounds);
2663 #else
2664  NSRect bounds = NSMakeRect(data.crect.x(), flipYCoordinate(data.crect.y()),
2665  data.crect.width(), data.crect.height());
2666  [osview setFrame:bounds];
2667 #endif
2668  setWinId((WId)osview);
2669  }
2670  } else {
2671  data.fstrut_dirty = false; // non-toplevel widgets don't have a frame, so no need to update the strut
2672 
2673 #ifdef QT_MAC_USE_COCOA
2674  if (q->testAttribute(Qt::WA_NativeWindow) == false || q->internalWinId() != 0) {
2675  // INVARIANT: q is Alien, and we should not create an NSView to back it up.
2676  } else
2677 #endif
2678  if (OSViewRef osview = qt_mac_create_widget(q, this, qt_mac_nativeview_for(parentWidget))) {
2679 #ifndef QT_MAC_USE_COCOA
2680  HIRect bounds = CGRectMake(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
2681  HIViewSetFrame(osview, &bounds);
2682  setWinId((WId)osview);
2683 #else
2684  NSRect bounds = NSMakeRect(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
2685  [osview setFrame:bounds];
2686  setWinId((WId)osview);
2687  if (q->isVisible()) {
2688  // If q were Alien before, but now became native (e.g. if a call to
2689  // winId was done from somewhere), we need to show the view immidiatly:
2691  [osview setHidden:NO];
2692  }
2693 #endif
2694  }
2695  }
2696 
2697  updateIsOpaque();
2698 
2699  if (q->testAttribute(Qt::WA_DropSiteRegistered))
2700  registerDropSite(true);
2701  if (q->hasFocus())
2702  setFocus_sys();
2703  if (!topLevel && initializeWindow)
2704  setWSGeometry();
2705  if (destroyid)
2706  qt_mac_destructView(destroyid);
2707 }
static const EventHandlerUPP make_widget_eventUPP()
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
unsigned long WId
Definition: qwindowdefs.h:119
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
int type
Definition: qmetatype.cpp:239
static EventTypeSpec widget_events[]
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QRect crect
Definition: qwidget.h:131
int flipYCoordinate(int y)
Qt::HANDLE hd
Definition: qwidget_p.h:754
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
WindowType
Definition: qnamespace.h:270
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define HIViewInstallEventHandler(target, handler, numTypes, list, userData, outHandlerRef)
qint32 minw
Definition: qwidget_p.h:264
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void registerDropSite(bool)
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
WindowRef OSWindowRef
qint32 maxw
Definition: qwidget_p.h:266
Qt::WindowFlags window_flags
Definition: qwidget.h:119
qint32 maxh
Definition: qwidget_p.h:267
struct OpaqueControlRef * HIViewRef
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
OSViewRef qt_mac_create_widget(QWidget *widget, QWidgetPrivate *widgetPrivate, OSViewRef parent)
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
static OSWindowRef qt_root_win
Definition: qwidget_mac.mm:155
Q_GUI_EXPORT OSViewRef qt_mac_get_contentview_for(OSWindowRef w)
Definition: qwidget_mac.mm:431
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
Definition: qrect.h:368
static QWidget * parentWidget(const QWidget *w)
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
static QSize qt_mac_desktopSize()
Definition: qwidget_mac.mm:203
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
QObject * parent
Definition: qobject.h:92
static void qt_mac_destructView(OSViewRef view)
Definition: qwidget_mac.mm:235
void createWinId()
Definition: qwidget.cpp:2626
qint32 minh
Definition: qwidget_p.h:265
void setWinId(WId)
Definition: qwidget.cpp:1726
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void updateIsOpaque()
Definition: qwidget.cpp:2272
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
uint fstrut_dirty
Definition: qwidget.h:126
HIViewRef OSViewRef

◆ createDefaultWindowSurface()

QWindowSurface * QWidgetPrivate::createDefaultWindowSurface ( )

Definition at line 398 of file qwidget.cpp.

399 {
400  Q_Q(QWidget);
401 
402  QWindowSurface *surface;
403 #ifndef QT_NO_PROPERTIES
404  if (q->property("_q_DummyWindowSurface").toBool()) {
405  surface = new QDummyWindowSurface(q);
406  } else
407 #endif
408  {
411  else
412  surface = createDefaultWindowSurface_sys();
413  }
414 
415  return surface;
416 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual QWindowSurface * createWindowSurface(QWidget *widget) const =0
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWindowSurface class provides the drawing area for top-level windows.
QWindowSurface * createDefaultWindowSurface_sys()
static QGraphicsSystem * graphicsSystem()

◆ createDefaultWindowSurface_sys()

QWindowSurface * QWidgetPrivate::createDefaultWindowSurface_sys ( )

◆ createExtra()

void QWidgetPrivate::createExtra ( )

Creates the widget extra data.

Warning
This function is not part of the public interface.

Definition at line 1802 of file qwidget.cpp.

Referenced by QGLWindowSurface::hijackWindow(), qt_grab_cursor(), and QWidgetBackingStore::updateStaticContentsSize().

1803 {
1804  if (!extra) { // if not exists
1805  extra = new QWExtra;
1806  extra->glContext = 0;
1807  extra->topextra = 0;
1808 #ifndef QT_NO_GRAPHICSVIEW
1809  extra->proxyWidget = 0;
1810 #endif
1811 #ifndef QT_NO_CURSOR
1812  extra->curs = 0;
1813 #endif
1814  extra->minw = 0;
1815  extra->minh = 0;
1818  extra->customDpiX = 0;
1819  extra->customDpiY = 0;
1820  extra->explicitMinSize = 0;
1821  extra->explicitMaxSize = 0;
1825  extra->hasMask = 0;
1826  createSysExtra();
1827 #ifdef QWIDGET_EXTRA_DEBUG
1828  static int count = 0;
1829  qDebug() << "extra" << ++count;
1830 #endif
1831  }
1832 }
QCursor * curs
Definition: qwidget_p.h:254
#define QWIDGETSIZE_MAX
Defines the maximum size for a QWidget object.
Definition: qwidget.h:1087
quint16 customDpiY
Definition: qwidget_p.h:269
qint32 minw
Definition: qwidget_p.h:264
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
Q_CORE_EXPORT void qDebug(const char *,...)
qint32 maxw
Definition: qwidget_p.h:266
qint32 maxh
Definition: qwidget_p.h:267
uint inRenderWithPainter
Definition: qwidget_p.h:277
uint explicitMaxSize
Definition: qwidget_p.h:274
QTLWExtra * topextra
Definition: qwidget_p.h:249
void * glContext
Definition: qwidget_p.h:248
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
uint nativeChildrenForced
Definition: qwidget_p.h:276
uint autoFillBackground
Definition: qwidget_p.h:275
qint32 minh
Definition: qwidget_p.h:265
void createSysExtra()
quint16 customDpiX
Definition: qwidget_p.h:268
uint explicitMinSize
Definition: qwidget_p.h:273

◆ createRecursively()

void QWidgetPrivate::createRecursively ( )

Definition at line 1423 of file qwidget.cpp.

1424 {
1425  Q_Q(QWidget);
1426  q->create(0, true, true);
1427  for (int i = 0; i < children.size(); ++i) {
1428  QWidget *child = qobject_cast<QWidget *>(children.at(i));
1429  if (child && !child->isHidden() && !child->isWindow() && !child->testAttribute(Qt::WA_WState_Created))
1430  child->d_func()->createRecursively();
1431  }
1432 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ createSysExtra()

void QWidgetPrivate::createSysExtra ( )

Definition at line 4958 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), and qt_grab_cursor().

4959 {
4960 #ifdef QT_MAC_USE_COCOA
4961  extra->imageMask = 0;
4962 #endif
4963 }
QWExtra * extra
Definition: qwidget_p.h:700

◆ createTLExtra()

void QWidgetPrivate::createTLExtra ( )

Definition at line 1755 of file qwidget.cpp.

Referenced by isServerProcess().

1756 {
1757  if (!extra)
1758  createExtra();
1759  if (!extra->topextra) {
1760  QTLWExtra* x = extra->topextra = new QTLWExtra;
1761  x->icon = 0;
1762  x->iconPixmap = 0;
1763  x->windowSurface = 0;
1764  x->sharedPainter = 0;
1765  x->incw = x->inch = 0;
1766  x->basew = x->baseh = 0;
1767  x->frameStrut.setCoords(0, 0, 0, 0);
1768  x->normalGeometry = QRect(0,0,-1,-1);
1769  x->savedFlags = 0;
1770  x->opacity = 255;
1771  x->posFromMove = false;
1772  x->sizeAdjusted = false;
1773  x->inTopLevelResize = false;
1774  x->inRepaint = false;
1775  x->embedded = 0;
1776 #ifdef Q_WS_MAC
1777 #ifdef QT_MAC_USE_COCOA
1778  x->wasMaximized = false;
1779 #endif // QT_MAC_USE_COCOA
1780 #endif // Q_WS_MAC
1781  createTLSysExtra();
1782 #ifdef QWIDGET_EXTRA_DEBUG
1783  static int count = 0;
1784  qDebug() << "tlextra" << ++count;
1785 #endif
1786 #if defined(Q_WS_QPA)
1787  x->platformWindow = 0;
1788  x->platformWindowFormat = QPlatformWindowFormat::defaultFormat();
1789  x->screenIndex = 0;
1790 #endif
1791  }
1792 }
QRect frameStrut
Definition: qwidget_p.h:180
QWindowSurface * windowSurface
Definition: qwidget_p.h:167
static QPlatformWindowFormat defaultFormat()
Returns the default QPlatformWindowFormat for the application.
uint inTopLevelResize
Definition: qwidget_p.h:188
short baseh
Definition: qwidget_p.h:178
uint embedded
Definition: qwidget_p.h:190
Q_CORE_EXPORT void qDebug(const char *,...)
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
QRect normalGeometry
Definition: qwidget_p.h:181
short inch
Definition: qwidget_p.h:177
uint inRepaint
Definition: qwidget_p.h:189
Qt::WindowFlags savedFlags
Definition: qwidget_p.h:182
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
short incw
Definition: qwidget_p.h:177
QPainter * sharedPainter
Definition: qwidget_p.h:168
QTLWExtra * topextra
Definition: qwidget_p.h:249
uint opacity
Definition: qwidget_p.h:185
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QPixmap * iconPixmap
Definition: qwidget_p.h:165
QWExtra * extra
Definition: qwidget_p.h:700
short basew
Definition: qwidget_p.h:178
uint posFromMove
Definition: qwidget_p.h:186
void createTLSysExtra()
QIcon * icon
Definition: qwidget_p.h:164
uint sizeAdjusted
Definition: qwidget_p.h:187

◆ createTLSysExtra()

void QWidgetPrivate::createTLSysExtra ( )

Definition at line 4973 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), and qt_grab_cursor().

4974 {
4975  extra->topextra->resizer = 0;
4976  extra->topextra->isSetGeometry = 0;
4977  extra->topextra->isMove = 0;
4978  extra->topextra->wattr = 0;
4979  extra->topextra->wclass = 0;
4980  extra->topextra->group = 0;
4981  extra->topextra->windowIcon = 0;
4982  extra->topextra->savedWindowAttributesFromMaximized = 0;
4983 }
QTLWExtra * topextra
Definition: qwidget_p.h:249
QWExtra * extra
Definition: qwidget_p.h:700

◆ createWinId()

void QWidgetPrivate::createWinId ( WId  id = 0)

Definition at line 2574 of file qwidget.cpp.

Referenced by createWinId(), effectiveState(), isServerProcess(), qt_grab_cursor(), qt_tablet_cleanup_wce(), and setParent_sys().

2575 {
2576  Q_Q(QWidget);
2577 
2578 #ifdef ALIEN_DEBUG
2579  qDebug() << "QWidgetPrivate::createWinId for" << q << winid;
2580 #endif
2581  const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);
2582  if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {
2583 #ifndef Q_WS_QPA
2584  if (!q->isWindow()) {
2585  QWidget *parent = q->parentWidget();
2586  QWidgetPrivate *pd = parent->d_func();
2587  if (forceNativeWindow && !q->testAttribute(Qt::WA_DontCreateNativeAncestors))
2589  if (!parent->internalWinId()) {
2590  pd->createWinId();
2591  }
2592 
2593  for (int i = 0; i < pd->children.size(); ++i) {
2594  QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));
2595  if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)
2596  || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {
2597  if (w!=q) {
2598  w->create();
2599  } else {
2600  w->create(winid);
2601  // if the window has already been created, we
2602  // need to raise it to its proper stacking position
2603  if (winid)
2604  w->raise();
2605  }
2606  }
2607  }
2608  } else {
2609  q->create();
2610  }
2611 #else
2612  Q_UNUSED(winid);
2613  q->create();
2614 #endif //Q_WS_QPA
2615 
2616  }
2617 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qDebug(const char *,...)
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void create(WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
Creates a new widget window if window is 0, otherwise sets the widget&#39;s window to window...
Definition: qwidget.cpp:1454
void createWinId(WId id=0)
Definition: qwidget.cpp:2574
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QObject * parent
Definition: qobject.h:92
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ deactivateWidgetCleanup()

void QWidgetPrivate::deactivateWidgetCleanup ( )

Definition at line 2496 of file qwidget.cpp.

Referenced by hide_sys(), isServerProcess(), and qt_grab_cursor().

2497 {
2498  Q_Q(QWidget);
2499  // If this was the active application window, reset it
2500  if (QApplication::activeWindow() == q)
2502  // If the is the active mouse press widget, reset it
2503  if (q == qt_button_down)
2504  qt_button_down = 0;
2505 }
QPointer< QWidget > qt_button_down
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
static void setActiveWindow(QWidget *act)
Sets the active window to the active widget in response to a system event.

◆ deleteExtra()

void QWidgetPrivate::deleteExtra ( )

Deletes the widget extra data.

Warning
This function is not part of the public interface.

Definition at line 1843 of file qwidget.cpp.

Referenced by ~QWidgetPrivate().

1844 {
1845  if (extra) { // if exists
1846 #ifndef QT_NO_CURSOR
1847  delete extra->curs;
1848 #endif
1849  deleteSysExtra();
1850 #ifndef QT_NO_STYLE_STYLESHEET
1851  // dereference the stylesheet style
1852  if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style))
1853  proxy->deref();
1854 #endif
1855  if (extra->topextra) {
1856  deleteTLSysExtra();
1858  delete extra->topextra->icon;
1859  delete extra->topextra->iconPixmap;
1860 #if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER)
1861  delete extra->topextra->qwsManager;
1862 #endif
1863  delete extra->topextra->windowSurface;
1864  delete extra->topextra;
1865  }
1866  delete extra;
1867  // extra->xic destroyed in QWidget::destroy()
1868  extra = 0;
1869  }
1870 }
QWindowSurface * windowSurface
Definition: qwidget_p.h:167
QCursor * curs
Definition: qwidget_p.h:254
void destroy()
Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backi...
Definition: qwidget.cpp:232
void deleteTLSysExtra()
QPointer< QStyle > style
Definition: qwidget_p.h:256
void deleteSysExtra()
QTLWExtra * topextra
Definition: qwidget_p.h:249
QPixmap * iconPixmap
Definition: qwidget_p.h:165
QWExtra * extra
Definition: qwidget_p.h:700
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166
QIcon * icon
Definition: qwidget_p.h:164

◆ deleteSysExtra()

void QWidgetPrivate::deleteSysExtra ( )

Definition at line 4965 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), qt_grab_cursor(), and qt_tablet_cleanup_wce().

4966 {
4967 #ifdef QT_MAC_USE_COCOA
4968  if (extra->imageMask)
4969  CFRelease(extra->imageMask);
4970 #endif
4971 }
QWExtra * extra
Definition: qwidget_p.h:700

◆ deleteTLSysExtra()

void QWidgetPrivate::deleteTLSysExtra ( )

Definition at line 4985 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), and qt_grab_cursor().

4986 {
4987 #ifndef QT_MAC_USE_COCOA
4988  if (extra->topextra->group) {
4990  extra->topextra->group = 0;
4991  }
4992  if (extra->topextra->windowIcon) {
4993  ReleaseIconRef(extra->topextra->windowIcon);
4994  extra->topextra->windowIcon = 0;
4995  }
4996 #endif
4997 }
static void qt_mac_release_window_group(WindowGroupRef group)
Definition: qwidget_mac.mm:530
QTLWExtra * topextra
Definition: qwidget_p.h:249
QWExtra * extra
Definition: qwidget_p.h:700

◆ drawWidget()

void QWidgetPrivate::drawWidget ( QPaintDevice pdev,
const QRegion rgn,
const QPoint offset,
int  flags,
QPainter sharedPainter = 0,
QWidgetBackingStore backingStore = 0 
)

Definition at line 5679 of file qwidget.cpp.

Referenced by QWidgetEffectSourcePrivate::draw(), paintSiblingsRecursive(), and QWidgetBackingStore::sync().

5681 {
5682  if (rgn.isEmpty())
5683  return;
5684 
5685 #if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
5686  if (qt_mac_clearDirtyOnWidgetInsideDrawWidget)
5687  dirtyOnWidget = QRegion();
5688 
5689  // We disable the rendering of QToolBar in the backingStore if
5690  // it's supposed to be in the unified toolbar on Mac OS X.
5691  if (backingStore && isInUnifiedToolbar)
5692  return;
5693 #endif // Q_WS_MAC && QT_MAC_USE_COCOA
5694 
5695 
5696  Q_Q(QWidget);
5697 #if !defined(QT_NO_GRAPHICSEFFECT) && !defined(Q_WS_MAC)
5699  QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
5700  QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
5701  (source->d_func());
5702  if (!sourced->context) {
5703  QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore);
5704  sourced->context = &context;
5705  if (!sharedPainter) {
5706  QPaintEngine *paintEngine = pdev->paintEngine();
5707  paintEngine->d_func()->systemClip = rgn.translated(offset);
5708  QPainter p(pdev);
5709  p.translate(offset);
5710  context.painter = &p;
5711  graphicsEffect->draw(&p);
5712  paintEngine->d_func()->systemClip = QRegion();
5713  } else {
5714  context.painter = sharedPainter;
5715  if (sharedPainter->worldTransform() != sourced->lastEffectTransform) {
5716  sourced->invalidateCache();
5717  sourced->lastEffectTransform = sharedPainter->worldTransform();
5718  }
5719  sharedPainter->save();
5720  sharedPainter->translate(offset);
5721  graphicsEffect->draw(sharedPainter);
5722  sharedPainter->restore();
5723  }
5724  sourced->context = 0;
5725  return;
5726  }
5727  }
5728 #endif //QT_NO_GRAFFICSEFFECT
5729 
5730  const bool asRoot = flags & DrawAsRoot;
5731  const bool alsoOnScreen = flags & DrawPaintOnScreen;
5732  const bool recursive = flags & DrawRecursive;
5733  const bool alsoInvisible = flags & DrawInvisible;
5734 
5735  Q_ASSERT(sharedPainter ? sharedPainter->isActive() : true);
5736 
5737  QRegion toBePainted(rgn);
5738  if (asRoot && !alsoInvisible)
5739  toBePainted &= clipRect(); //(rgn & visibleRegion());
5740  if (!(flags & DontSubtractOpaqueChildren))
5741  subtractOpaqueChildren(toBePainted, q->rect());
5742 
5743  if (!toBePainted.isEmpty()) {
5744  bool onScreen = paintOnScreen();
5745  if (!onScreen || alsoOnScreen) {
5746  //update the "in paint event" flag
5747  if (q->testAttribute(Qt::WA_WState_InPaintEvent))
5748  qWarning("QWidget::repaint: Recursive repaint detected");
5749  q->setAttribute(Qt::WA_WState_InPaintEvent);
5750 
5751  //clip away the new area
5752 #ifndef QT_NO_PAINT_DEBUG
5753  bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted);
5754 #endif
5755  QPaintEngine *paintEngine = pdev->paintEngine();
5756  if (paintEngine) {
5757  setRedirected(pdev, -offset);
5758 
5759 #ifdef Q_WS_MAC
5760  // (Alien support) Special case for Mac when redirecting: If the paint device
5761  // is of the Widget type we need to set WA_WState_InPaintEvent since painting
5762  // outside the paint event is not supported on QWidgets. The attributeis
5763  // restored further down.
5764  if (pdev->devType() == QInternal::Widget)
5765  static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent);
5766 
5767 #endif
5768  if (sharedPainter)
5769  paintEngine->d_func()->systemClip = toBePainted;
5770  else
5771  paintEngine->d_func()->systemRect = q->data->crect;
5772 
5773  //paint the background
5774  if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground))
5775  && !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) {
5776  QPainter p(q);
5777  paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
5778  }
5779 
5780  if (!sharedPainter)
5781  paintEngine->d_func()->systemClip = toBePainted.translated(offset);
5782 
5783  if (!onScreen && !asRoot && !isOpaque && q->testAttribute(Qt::WA_TintedBackground)) {
5784  QPainter p(q);
5785  QColor tint = q->palette().window().color();
5786  tint.setAlphaF(qreal(.6));
5787  p.fillRect(toBePainted.boundingRect(), tint);
5788  }
5789  }
5790 
5791 #if 0
5792  qDebug() << "painting" << q << "opaque ==" << isOpaque();
5793  qDebug() << "clipping to" << toBePainted << "location == " << offset
5794  << "geometry ==" << QRect(q->mapTo(q->window(), QPoint(0, 0)), q->size());
5795 #endif
5796 
5797  //actually send the paint event
5798  QPaintEvent e(toBePainted);
5800 #if !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
5801  if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow()))
5802  backingStore->markDirtyOnScreen(toBePainted, q, offset);
5803 #endif
5804 
5805  //restore
5806  if (paintEngine) {
5807 #ifdef Q_WS_MAC
5808  if (pdev->devType() == QInternal::Widget)
5809  static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false);
5810 #endif
5812  if (!sharedPainter)
5813  paintEngine->d_func()->systemRect = QRect();
5814  else
5815  paintEngine->d_func()->currentClipWidget = 0;
5816  paintEngine->d_func()->systemClip = QRegion();
5817  }
5818  q->setAttribute(Qt::WA_WState_InPaintEvent, false);
5819  if (q->paintingActive() && !q->testAttribute(Qt::WA_PaintOutsidePaintEvent))
5820  qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
5821 
5822  if (paintEngine && paintEngine->autoDestruct()) {
5823  delete paintEngine;
5824  }
5825 
5826 #ifndef QT_NO_PAINT_DEBUG
5827  if (flushed)
5828  QWidgetBackingStore::unflushPaint(q, toBePainted);
5829 #endif
5830  } else if (q->isWindow()) {
5831  QPaintEngine *engine = pdev->paintEngine();
5832  if (engine) {
5833  QPainter p(pdev);
5834  p.setClipRegion(toBePainted);
5835  const QBrush bg = q->palette().brush(QPalette::Window);
5836  if (bg.style() == Qt::TexturePattern)
5837  p.drawTiledPixmap(q->rect(), bg.texture());
5838  else
5839  p.fillRect(q->rect(), bg);
5840 
5841  if (engine->autoDestruct())
5842  delete engine;
5843  }
5844  }
5845  }
5846 
5847  if (recursive && !children.isEmpty()) {
5848  paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot
5849 #ifdef Q_BACKINGSTORE_SUBSURFACES
5850  , q->windowSurface()
5851 #endif
5852  , sharedPainter, backingStore);
5853  }
5854 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double qreal
Definition: qglobal.h:1193
void restoreRedirected()
Definition: qwidget_p.h:635
bool isEnabled() const
void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
Definition: qwidget.cpp:5946
bool paintOnScreen() const
Definition: qwidget.cpp:2255
QRect clipRect() const
Definition: qwidget.cpp:1997
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset)
Marks the region of the widget as dirty on screen.
The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on...
void paintBackground(QPainter *, const QRegion &, int flags=DrawAsRoot) const
Definition: qwidget.cpp:2429
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual int devType() const
Definition: qpaintdevice.h:167
QObjectList children
Definition: qobject.h:93
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qDebug(const char *,...)
QRect systemRect() const
Retrieves the rect for drawing within the backing store.
void invalidateCache(InvalidateReason reason=SourceChanged) const
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false...
Definition: qpainter.cpp:1545
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
virtual QPaintEngine * paintEngine() const =0
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
Definition: qcolor.cpp:1117
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPainter * sharedPainter() const
Definition: qwidget_p.h:1015
void subtractOpaqueChildren(QRegion &rgn, const QRect &clipRect) const
Definition: qwidget.cpp:2128
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWidgetPaintContext * context
Definition: qwidget_p.h:993
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QTransform lastEffectTransform
Definition: qwidget_p.h:994
bool autoDestruct() const
Definition: qpaintengine.h:250
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
void setRedirected(QPaintDevice *replacement, const QPoint &offset)
Definition: qwidget_p.h:621
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...
QRegion systemClip() const
Returns the system clip.
static bool flushPaint(QWidget *widget, const QRegion &rgn)
static void unflushPaint(QWidget *widget, const QRegion &rgn)
virtual void draw(QPainter *painter)=0
This pure virtual function draws the effect and is called whenever the source needs to be drawn...
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311

◆ effectiveFocusWidget()

QWidget* QWidgetPrivate::effectiveFocusWidget ( )
inline

Definition at line 587 of file qwidget_p.h.

587  {
588  QWidget *w = q_func();
589  while (w->focusProxy())
590  w = w->focusProxy();
591  return w;
592  }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QWidget * focusProxy() const
Returns the focus proxy, or 0 if there is no focus proxy.
Definition: qwidget.cpp:6561

◆ effectiveRectFor()

QRect QWidgetPrivate::effectiveRectFor ( const QRect rect) const
inline

Definition at line 658 of file qwidget_p.h.

Referenced by QWidgetBackingStore::addDirtyWidget(), effectiveState(), isServerProcess(), paintSiblingsRecursive(), and setParent_sys().

659  {
660 #ifndef QT_NO_GRAPHICSEFFECT
663 #endif //QT_NO_GRAPHICSEFFECT
664  return rect;
665  }
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
bool isEnabled() const
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
virtual QRectF boundingRectFor(const QRectF &sourceRect) const
Returns the effective bounding rectangle for this effect, given the provided rect in the device coord...

◆ endSharedPainter()

bool QWidgetPrivate::endSharedPainter ( )

◆ enforceNativeChildren()

void QWidgetPrivate::enforceNativeChildren ( )
inline

Definition at line 638 of file qwidget_p.h.

639  {
640  if (!extra)
641  createExtra();
642 
644  return;
646 
647  for (int i = 0; i < children.size(); ++i) {
648  if (QWidget *child = qobject_cast<QWidget *>(children.at(i)))
649  child->setAttribute(Qt::WA_NativeWindow);
650  }
651  }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWExtra * extra
Definition: qwidget_p.h:700
uint nativeChildrenForced
Definition: qwidget_p.h:276

◆ extraData()

QWExtra * QWidgetPrivate::extraData ( ) const
inline

◆ frameStrut()

QRect QWidgetPrivate::frameStrut ( ) const

Definition at line 12607 of file qwidget.cpp.

Referenced by QRasterWindowSurface::flush(), isServerProcess(), qt_grab_cursor(), qt_mac_unregister_widget(), and setGeometry_sys().

12608 {
12609  Q_Q(const QWidget);
12610  if (!q->isWindow() || (q->windowType() == Qt::Desktop) || q->testAttribute(Qt::WA_DontShowOnScreen)) {
12611  // x2 = x1 + w - 1, so w/h = 1
12612  return QRect(0, 0, 1, 1);
12613  }
12614 
12615  if (data.fstrut_dirty
12616 #ifndef Q_WS_WIN
12617  // ### Fix properly for 4.3
12618  && q->isVisible()
12619 #endif
12620  && q->testAttribute(Qt::WA_WState_Created))
12621  const_cast<QWidgetPrivate *>(this)->updateFrameStrut();
12622 
12623  return maybeTopData() ? maybeTopData()->frameStrut : QRect();
12624 }
QRect frameStrut
Definition: qwidget_p.h:180
#define Q_WS_WIN
Defined on Windows.
Definition: qglobal.h:921
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QTLWExtra * maybeTopData() const
Definition: qwidget_p.h:1010
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
uint fstrut_dirty
Definition: qwidget.h:126

◆ getLayoutItemMargins()

void QWidgetPrivate::getLayoutItemMargins ( int *  left,
int *  top,
int *  right,
int *  bottom 
) const

Definition at line 12848 of file qwidget.cpp.

Referenced by QDialogButtonBoxPrivate::initLayout().

12849 {
12850  if (left)
12851  *left = (int)leftLayoutItemMargin;
12852  if (top)
12853  *top = (int)topLayoutItemMargin;
12854  if (right)
12855  *right = (int)rightLayoutItemMargin;
12856  if (bottom)
12857  *bottom = (int)bottomLayoutItemMargin;
12858 }
signed char topLayoutItemMargin
Definition: qwidget_p.h:749
signed char bottomLayoutItemMargin
Definition: qwidget_p.h:751
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
signed char rightLayoutItemMargin
Definition: qwidget_p.h:750
signed char leftLayoutItemMargin
Definition: qwidget_p.h:748
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ getOpaqueChildren()

const QRegion & QWidgetPrivate::getOpaqueChildren ( ) const

Definition at line 2098 of file qwidget.cpp.

Referenced by getOpaqueChildren().

2099 {
2100  if (!dirtyOpaqueChildren)
2101  return opaqueChildren;
2102 
2103  QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
2104  that->opaqueChildren = QRegion();
2105 
2106  for (int i = 0; i < children.size(); ++i) {
2107  QWidget *child = qobject_cast<QWidget *>(children.at(i));
2108  if (!child || !child->isVisible() || child->isWindow())
2109  continue;
2110 
2111  const QPoint offset = child->geometry().topLeft();
2112  QWidgetPrivate *childd = child->d_func();
2113  QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren();
2114  if (childd->extra && childd->extra->hasMask)
2115  r &= childd->extra->mask;
2116  if (r.isEmpty())
2117  continue;
2118  r.translate(offset);
2119  that->opaqueChildren += r;
2120  }
2121 
2122  that->opaqueChildren &= q_func()->rect();
2123  that->dirtyOpaqueChildren = false;
2124 
2125  return that->opaqueChildren;
2126 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
const QRegion & getOpaqueChildren() const
Definition: qwidget.cpp:2098
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
uint dirtyOpaqueChildren
Definition: qwidget_p.h:770
QRegion mask
Definition: qwidget_p.h:260
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QRegion opaqueChildren
Definition: qwidget_p.h:725
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ handleSoftwareInputPanel()

void QWidgetPrivate::handleSoftwareInputPanel ( Qt::MouseButton  button,
bool  clickCausedFocus 
)
inline

Definition at line 669 of file qwidget_p.h.

Referenced by QDeclarativeTextInput::mouseReleaseEvent(), QDeclarativeTextEdit::mouseReleaseEvent(), and QGraphicsTextItem::mouseReleaseEvent().

670  {
671  Q_Q(QWidget);
672  if (button == Qt::LeftButton && qApp->autoSipEnabled()) {
674  q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
675  if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
678  }
679  }
680  }
EventRef event
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
RequestSoftwareInputPanel
This enum describes under what circumstances a software input panel will be requested by input capabl...
Definition: qstyle.h:635
#define Q_Q(Class)
Definition: qglobal.h:2483
#define qApp
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ hasHeightForWidth()

bool QWidgetPrivate::hasHeightForWidth ( ) const
virtual
Warning
This function is not part of the public interface.

virtual private*

This is a bit hackish, but ideally we would have created a virtual function in the public API (however, too late...) so that subclasses could reimplement their own function. Instead we add a virtual function to QWidgetPrivate.

Qt5: move to public class and make virtual

Reimplemented in QTabWidgetPrivate.

Definition at line 10260 of file qwidget.cpp.

Referenced by QTabWidgetPrivate::hasHeightForWidth(), QSizeGrip::mouseMoveEvent(), and QSizeGrip::mousePressEvent().

10261 {
10263 }
QLayout * layout
Definition: qwidget_p.h:704
QSizePolicy size_policy
Definition: qwidget_p.h:756
virtual bool hasHeightForWidth() const
Returns true if this layout&#39;s preferred height depends on its width; otherwise returns false...
bool hasHeightForWidth() const
Definition: qsizepolicy.h:136

◆ hide_helper()

void QWidgetPrivate::hide_helper ( )
Warning
This function is not part of the public interface.

Definition at line 7898 of file qwidget.cpp.

7899 {
7900  Q_Q(QWidget);
7901 
7902  bool isEmbedded = false;
7903 #if !defined QT_NO_GRAPHICSVIEW
7904  isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
7905 #else
7906  Q_UNUSED(isEmbedded);
7907 #endif
7908 
7909  if (!isEmbedded && (q->windowType() == Qt::Popup))
7910  qApp->d_func()->closePopup(q);
7911 
7912  // Move test modal here. Otherwise, a modal dialog could get
7913  // destroyed and we lose all access to its parent because we haven't
7914  // left modality. (Eg. modal Progress Dialog)
7915  if (!isEmbedded && q->isModal() && q->isWindow())
7917 
7918 #if defined(Q_WS_WIN)
7919  if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget()
7920  && !q->parentWidget()->isHidden() && q->isActiveWindow())
7921  q->parentWidget()->activateWindow(); // Activate parent
7922 #endif
7923 
7924  q->setAttribute(Qt::WA_Mapped, false);
7925  hide_sys();
7926 
7927  bool wasVisible = q->testAttribute(Qt::WA_WState_Visible);
7928 
7929  if (wasVisible) {
7930  q->setAttribute(Qt::WA_WState_Visible, false);
7931 
7932  }
7933 
7934  QHideEvent hideEvent;
7935  QApplication::sendEvent(q, &hideEvent);
7936  hideChildren(false);
7937 
7938  // next bit tries to move the focus if the focus widget is now
7939  // hidden.
7940  if (wasVisible) {
7941 #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA)
7942  qApp->d_func()->sendSyntheticEnterLeave(q);
7943 #endif
7944 
7946  while (fw && !fw->isWindow()) {
7947  if (fw == q) {
7948  q->focusNextPrevChild(true);
7949  break;
7950  }
7951  fw = fw->parentWidget();
7952  }
7953  }
7954 
7956  bs->removeDirtyWidget(q);
7957 
7958 #ifndef QT_NO_ACCESSIBILITY
7959  if (wasVisible)
7961 #endif
7962 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static bool bypassGraphicsProxyWidget(const QWidget *p)
Returns true if p or any of its parents enable the Qt::BypassGraphicsProxyWidget window flag...
Definition: qwidget_p.h:353
#define Q_Q(Class)
Definition: qglobal.h:2483
#define qApp
void hide_sys()
Platform-specific part of QWidget::hide().
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
void hideChildren(bool spontaneous)
Definition: qwidget.cpp:8167
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin)
Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget an...
Definition: qwidget.cpp:6098
QWidgetBackingStore * maybeBackingStore() const
Definition: qwidget_p.h:1036
static void leaveModal(QWidget *)
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ hide_sys()

void QWidgetPrivate::hide_sys ( )

Platform-specific part of QWidget::hide().

Warning
This function is not part of the public interface.

Definition at line 3589 of file qwidget_mac.mm.

Referenced by isServerProcess(), qt_grab_cursor(), and setNetWmWindowTypes().

3590 {
3591  Q_Q(QWidget);
3592  if((q->windowType() == Qt::Desktop)) //you can't hide the desktop!
3593  return;
3595  if(q->isWindow()) {
3596 #ifdef QT_MAC_USE_COCOA
3597  setSubWindowStacking(false);
3598 #endif
3600  if(qt_mac_is_macsheet(q)) {
3601 #ifndef QT_MAC_USE_COCOA
3602  WindowRef parent = 0;
3603  if(GetSheetWindowParent(window, &parent) != noErr || !parent)
3604  ShowHide(window, false);
3605  else
3606  HideSheetWindow(window);
3607 #else
3608  [NSApp endSheet:window];
3609  [window orderOut:window];
3610 #endif
3611  } else if(qt_mac_is_macdrawer(q)) {
3612 #ifndef QT_MAC_USE_COCOA
3613  CloseDrawer(window, false);
3614 #else
3615  [qt_mac_drawer_for(q) close];
3616 #endif
3617  } else {
3618 #ifndef QT_MAC_USE_COCOA
3619  ShowHide(window, false);
3620 #else
3621  // Only needed if it exists from 10.7 or later
3622  if ((q->windowType() == Qt::Tool) && [window respondsToSelector: @selector(setAnimationBehavior:)])
3623  [window setAnimationBehavior: 2]; // NSWindowAnimationBehaviorNone == 2
3624 
3625  [window orderOut:window];
3626  // Unfortunately it is not as easy as just hiding the window, we need
3627  // to find out if we were in full screen mode. If we were and this is
3628  // the last window in full screen mode then we need to unset the full screen
3629  // mode. If this is not the last visible window in full screen mode then we
3630  // don't change the full screen mode.
3631  if(q->isFullScreen())
3632  {
3633  bool keepFullScreen = false;
3634  QWidgetList windowList = qApp->topLevelWidgets();
3635  int windowCount = windowList.count();
3636  for(int i = 0; i < windowCount; i++)
3637  {
3638  QWidget *w = windowList[i];
3639  // If it is the same window, we don't need to check :-)
3640  if(q == w)
3641  continue;
3642  // If they are not visible or if they are minimized then
3643  // we just ignore them.
3644  if(!w->isVisible() || w->isMinimized())
3645  continue;
3646  // Is it full screen?
3647  // Notice that if there is one window in full screen mode then we
3648  // cannot switch the full screen mode off, therefore we just abort.
3649  if(w->isFullScreen()) {
3650  keepFullScreen = true;
3651  break;
3652  }
3653  }
3654  // No windows in full screen mode, so let just unset that flag.
3655  if(!keepFullScreen)
3657  }
3658 #endif
3659  toggleDrawers(false);
3661 #ifndef QT_MAC_USE_COCOA
3662  // Clear modality (because it seems something that we've always done).
3664  SetWindowModality(window, kWindowModalityNone,
3665  q->parentWidget() ? qt_mac_window_for(q->parentWidget()->window()) : 0);
3666  }
3667 #endif
3668  }
3669 #ifndef QT_MAC_USE_COCOA
3670  // If the window we now hide was the active window, we need
3671  // to find, and activate another window on screen. NB: Cocoa takes care of this
3672  // logic for us (and distinquishes between main windows and key windows)
3673  if (q->isActiveWindow() && !(q->windowType() == Qt::Popup)) {
3674  QWidget *w = 0;
3675  if(q->parentWidget())
3676  w = q->parentWidget()->window();
3677  if(!w || (!w->isVisible() && !w->isMinimized())) {
3678  for (WindowPtr wp = GetFrontWindowOfClass(kMovableModalWindowClass, true);
3679  wp; wp = GetNextWindowOfClass(wp, kMovableModalWindowClass, true)) {
3680  if((w = qt_mac_find_window(wp)))
3681  break;
3682  }
3683  if (!w){
3684  for (WindowPtr wp = GetFrontWindowOfClass(kDocumentWindowClass, true);
3685  wp; wp = GetNextWindowOfClass(wp, kDocumentWindowClass, true)) {
3686  if((w = qt_mac_find_window(wp)))
3687  break;
3688  }
3689  }
3690  if (!w){
3691  for(WindowPtr wp = GetFrontWindowOfClass(kSimpleWindowClass, true);
3692  wp; wp = GetNextWindowOfClass(wp, kSimpleWindowClass, true)) {
3693  if((w = qt_mac_find_window(wp)))
3694  break;
3695  }
3696  }
3697  }
3698  if(w && w->isVisible() && !w->isMinimized()) {
3700  }
3701  }
3702 #endif
3703  } else {
3704  invalidateBuffer(q->rect());
3705 #ifndef QT_MAC_USE_COCOA
3706  HIViewSetVisible(qt_mac_nativeview_for(q), false);
3707 #else
3708  if (NSView *view = qt_mac_nativeview_for(q)) {
3709  // INVARIANT: q is native. Just hide the view:
3710  [view setHidden:YES];
3711  } else {
3712  // INVARIANT: q is alien. Repaint where q is placed instead:
3714  }
3715 #endif
3716  }
3717 
3718 #ifdef QT_MAC_USE_COCOA
3719  if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
3720  // Update enter/leave immidiatly, don't wait for a move event. But only
3721  // if no grab exists (even if the grab points to this widget, it seems, ref X11)
3722  QPoint qlocal, qglobal;
3723  QWidget *widgetUnderMouse = 0;
3724  qt_mac_getTargetForMouseEvent(0, QEvent::Leave, qlocal, qglobal, 0, &widgetUnderMouse);
3725  if (q == widgetUnderMouse) {
3727  qt_last_mouse_receiver = widgetUnderMouse;
3728  qt_last_native_mouse_receiver = widgetUnderMouse ?
3729  (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0;
3730  }
3731  }
3732 #endif
3733 
3734  topLevelAt_cache = 0;
3738 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
static void qt_mac_set_fullscreen_mode(bool b)
Definition: qwidget_mac.mm:406
struct OpaqueWindowPtr * WindowRef
bool isVisible() const
Definition: qwidget.h:1005
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QWidget > qt_button_down
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_Q(Class)
Definition: qglobal.h:2483
uint window_modality
Definition: qwidget.h:128
QWidgetData data
Definition: qwidget_p.h:755
void deactivateWidgetCleanup()
Definition: qwidget.cpp:2496
NSWindow * window
QWidget * nativeParentWidget() const
Returns the native parent for this widget, i.
Definition: qwidget.cpp:4514
WindowRef OSWindowRef
static QWidget * mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
#define qApp
void qt_event_request_activate(QWidget *)
bool qt_mac_is_macsheet(const QWidget *w)
Definition: qwidget_mac.mm:295
void qt_mac_updateParentUnderAlienWidget(QWidget *alienWidget)
bool qt_mac_is_macdrawer(const QWidget *w)
Definition: qwidget_mac.mm:306
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
QPointer< QWidget > qt_last_native_mouse_receiver
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
bool isFullScreen() const
Definition: qwidget.cpp:3153
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool isMinimized() const
Definition: qwidget.cpp:3027
QObject * parent
Definition: qobject.h:92
void qt_event_request_window_change(QWidget *)
QPointer< QWidget > qt_last_mouse_receiver
void qt_mac_update_cursor()
Definition: qcursor_mac.mm:201
QWidget * qt_mac_find_window(OSWindowRef window)
Definition: qwidget_mac.mm:391
void qt_mac_event_release(QWidget *w)
qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ hideChildren()

void QWidgetPrivate::hideChildren ( bool  spontaneous)

Definition at line 8167 of file qwidget.cpp.

Referenced by QApplication::x11ProcessEvent().

8168 {
8169  QList<QObject*> childList = children;
8170  for (int i = 0; i < childList.size(); ++i) {
8171  QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
8172  if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
8173  continue;
8174 #ifdef QT_MAC_USE_COCOA
8175  // Before doing anything we need to make sure that we don't leave anything in a non-consistent state.
8176  // When hiding a widget we need to make sure that no mouse_down events are active, because
8177  // the mouse_up event will never be received by a hidden widget or one of its descendants.
8178  // The solution is simple, before going through with this we check if there are any mouse_down events in
8179  // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and
8180  // then we continue.
8181  // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already
8182  // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the
8183  // mouse release event. There are two ways to interpret this:
8184  // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it
8185  // might be waiting for a release event that will never arrive.
8186  // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not
8187  // supposed to trigger because it is not visible.
8188  if(widget == qt_button_down)
8189  qt_button_down = 0;
8190 #endif // QT_MAC_USE_COCOA
8191  if (spontaneous)
8192  widget->setAttribute(Qt::WA_Mapped, false);
8193  else
8194  widget->setAttribute(Qt::WA_WState_Visible, false);
8195  widget->d_func()->hideChildren(spontaneous);
8196  QHideEvent e;
8197  if (spontaneous) {
8199  } else {
8200  QApplication::sendEvent(widget, &e);
8201  if (widget->internalWinId()
8203  // hide_sys() on an ancestor won't have any affect on this
8204  // widget, so it needs an explicit hide_sys() of its own
8205  widget->d_func()->hide_sys();
8206  }
8207  }
8208 #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA)
8209  qApp->d_func()->sendSyntheticEnterLeave(widget);
8210 #endif
8211 #ifndef QT_NO_ACCESSIBILITY
8212  if (!spontaneous)
8214 #endif
8215  }
8216 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QPointer< QWidget > qt_button_down
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
QPointer< QWidget > widget
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
#define qApp
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ inheritStyle()

void QWidgetPrivate::inheritStyle ( )

Definition at line 2865 of file qwidget.cpp.

2866 {
2867 #ifndef QT_NO_STYLE_STYLESHEET
2868  Q_Q(QWidget);
2869 
2871 
2872  if (!q->styleSheet().isEmpty()) {
2873  Q_ASSERT(proxy);
2874  proxy->repolish(q);
2875  return;
2876  }
2877 
2878  QStyle *origStyle = proxy ? proxy->base : (extra ? (QStyle*)extra->style : 0);
2879  QWidget *parent = q->parentWidget();
2880  QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;
2881  // If we have stylesheet on app or parent has stylesheet style, we need
2882  // to be running a proxy
2883  if (!qApp->styleSheet().isEmpty() || qobject_cast<QStyleSheetStyle *>(parentStyle)) {
2884  QStyle *newStyle = parentStyle;
2885  if (q->testAttribute(Qt::WA_SetStyle))
2886  newStyle = new QStyleSheetStyle(origStyle);
2887  else if (QStyleSheetStyle *newProxy = qobject_cast<QStyleSheetStyle *>(parentStyle))
2888  newProxy->ref();
2889 
2890  setStyle_helper(newStyle, true);
2891  return;
2892  }
2893 
2894  // So, we have no stylesheet on parent/app and we have an empty stylesheet
2895  // we just need our original style back
2896  if (origStyle == (extra ? (QStyle*)extra->style : 0)) // is it any different?
2897  return;
2898 
2899  // We could have inherited the proxy from our parent (which has a custom style)
2900  // In such a case we need to start following the application style (i.e revert
2901  // the propagation behavior of QStyleSheetStyle)
2902  if (!q->testAttribute(Qt::WA_SetStyle))
2903  origStyle = 0;
2904 
2905  setStyle_helper(origStyle, true);
2906 #endif // QT_NO_STYLE_STYLESHEET
2907 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QPointer< QStyle > style
Definition: qwidget_p.h:256
void setStyle_helper(QStyle *newStyle, bool propagate, bool metalHack=false)
Definition: qwidget.cpp:2791
QStyle * style() const
Definition: qwidget.cpp:2742
#define Q_Q(Class)
Definition: qglobal.h:2483
#define qApp
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
QWExtra * extra
Definition: qwidget_p.h:700
QObject * parent
Definition: qobject.h:92
void repolish(QWidget *widget)

◆ init()

void QWidgetPrivate::init ( QWidget desktopWidget,
Qt::WindowFlags  f 
)

Definition at line 1298 of file qwidget.cpp.

1299 {
1300  Q_Q(QWidget);
1302  qFatal("QWidget: Cannot create a QWidget when no GUI is being used");
1303 
1305  if (allWidgets)
1306  allWidgets->insert(q);
1307 
1308  QWidget *desktopWidget = 0;
1310  desktopWidget = parentWidget;
1311  parentWidget = 0;
1312  }
1313 
1314  q->data = &data;
1315 
1316 #ifndef QT_NO_THREAD
1317  if (!parent) {
1318  Q_ASSERT_X(q->thread() == qApp->thread(), "QWidget",
1319  "Widgets must be created in the GUI thread.");
1320  }
1321 #endif
1322 
1323 #if defined(Q_WS_X11)
1324  if (desktopWidget) {
1325  // make sure the widget is created on the same screen as the
1326  // programmer specified desktop widget
1327  xinfo = desktopWidget->d_func()->xinfo;
1328  }
1329 #elif defined(Q_OS_SYMBIAN)
1330  if (desktopWidget) {
1331  symbianScreenNumber = qt_widget_private(desktopWidget)->symbianScreenNumber;
1332  }
1333 #elif defined(Q_WS_QPA)
1334  if (desktopWidget) {
1335  int screen = desktopWidget->d_func()->topData()->screenIndex;
1336  topData()->screenIndex = screen;
1337  QPlatformIntegration *platform = QApplicationPrivate::platformIntegration();
1338  platform->moveToScreen(q, screen);
1339  }
1340 #else
1341  Q_UNUSED(desktopWidget);
1342 #endif
1343 
1344  data.fstrut_dirty = true;
1345 
1346  data.winid = 0;
1347  data.widget_attributes = 0;
1348  data.window_flags = f;
1349  data.window_state = 0;
1350  data.focus_policy = 0;
1353 
1354  data.sizehint_forced = 0;
1355  data.is_closing = 0;
1356  data.in_show = 0;
1358  data.in_destructor = false;
1359 
1360  // Widgets with Qt::MSWindowsOwnDC (typically QGLWidget) must have a window handle.
1361  if (f & Qt::MSWindowsOwnDC)
1362  q->setAttribute(Qt::WA_NativeWindow);
1363 
1364 //#ifdef Q_WS_MAC
1365 // q->setAttribute(Qt::WA_NativeWindow);
1366 //#endif
1367 
1368  q->setAttribute(Qt::WA_QuitOnClose); // might be cleared in adjustQuitOnCloseAttribute()
1370 
1371  q->setAttribute(Qt::WA_WState_Hidden);
1372 
1373  //give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later
1374 #ifdef Q_OS_SYMBIAN
1375  if (isGLWidget) {
1376  // Don't waste GPU mem for unnecessary large egl surface until resized by application
1377  data.crect = QRect(0,0,1,1);
1378  } else {
1379  data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640);
1380  }
1381 #else
1382  data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480);
1383 #endif
1384 
1385  focus_next = focus_prev = q;
1386 
1387  if ((f & Qt::WindowType_Mask) == Qt::Desktop)
1388  q->create();
1389  else if (parentWidget)
1390  q->setParent(parentWidget, data.window_flags);
1391  else {
1394  // opaque system background?
1395  const QBrush &background = q->palette().brush(QPalette::Window);
1396  setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque());
1397  }
1398  data.fnt = QFont(data.fnt, q);
1399 #if defined(Q_WS_X11)
1400  data.fnt.x11SetScreen(xinfo.screen());
1401 #endif // Q_WS_X11
1402 
1403  q->setAttribute(Qt::WA_PendingMoveEvent);
1404  q->setAttribute(Qt::WA_PendingResizeEvent);
1405 
1408 
1411  q->create();
1412 
1413 
1415  QApplication::sendEvent(q, &e);
1417 
1418  extraPaintEngine = 0;
1419 }
void resolveLayoutDirection()
Definition: qwidget.cpp:5171
void adjustQuitOnCloseAttribute()
Definition: qwidget.cpp:12900
QRect crect
Definition: qwidget.h:131
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
QFont fnt
Definition: qwidget.h:133
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w=0)
Definition: qwidget.cpp:1242
uint window_state
Definition: qwidget.h:120
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static bool testAttribute(uint flag)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
uint sizehint_forced
Definition: qwidget.h:122
uint in_set_window_state
Definition: qwidget.h:125
QPaintEngine * extraPaintEngine
Definition: qwidget_p.h:708
#define Q_Q(Class)
Definition: qglobal.h:2483
uint window_modality
Definition: qwidget.h:128
QWidgetData data
Definition: qwidget_p.h:755
uint widget_attributes
Definition: qwidget.h:118
#define qApp
Qt::WindowFlags window_flags
Definition: qwidget.h:119
QWidgetData * data
Definition: qwidget.h:815
const_iterator insert(const T &value)
Definition: qset.h:179
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
void create(WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
Creates a new widget window if window is 0, otherwise sets the widget&#39;s window to window...
Definition: qwidget.cpp:1454
uint is_closing
Definition: qwidget.h:123
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
static QWidgetSet * allWidgets
Definition: qwidget_p.h:715
static QWidget * parentWidget(const QWidget *w)
QWidget * focus_next
Definition: qwidget_p.h:701
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
Q_CORE_EXPORT void qFatal(const char *,...)
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
QWidget * focus_prev
Definition: qwidget_p.h:702
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setOpaque(bool opaque)
Definition: qwidget.cpp:2337
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
uint focus_policy
Definition: qwidget.h:121
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QObject * parent
Definition: qobject.h:92
QX11Info xinfo
Definition: qwidget_p.h:784
uint in_destructor
Definition: qwidget.h:129
virtual void moveToScreen(QWidget *window, int screen)
This function is called when a QWidget is displayed on screen, or the QWidget is to be displayed on a...
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
uint fstrut_dirty
Definition: qwidget.h:126
static int instanceCounter
Definition: qwidget_p.h:752
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
static Type type()
Returns the type of application (Tty , GuiClient, or GuiServer).
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
uint context_menu_policy
Definition: qwidget.h:127
WId winid
Definition: qwidget.h:117
int screen() const
Returns the number of the screen currently in use.
uint in_show
Definition: qwidget.h:124
static int maxInstances
Definition: qwidget_p.h:753

◆ inputContext()

QInputContext * QWidgetPrivate::inputContext ( ) const

Definition at line 457 of file qwidget.cpp.

Referenced by QWidget::resetInputContext().

458 {
459  if (QInputContext *qic = assignedInputContext())
460  return qic;
461  return qApp->inputContext();
462 }
QInputContext * assignedInputContext() const
Definition: qwidget.cpp:446
#define qApp
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83

◆ invalidateBuffer() [1/2]

void QWidgetPrivate::invalidateBuffer ( const QRegion rgn)

Invalidates the rgn (in widget's coordinates) of the backing store, i.e.

all widgets intersecting with the region will be repainted when the backing store is synced.

Qt 4.6: Merge into a template function (after MSVC isn't supported anymore).

Definition at line 1565 of file qbackingstore.cpp.

Referenced by effectiveState(), hide_sys(), isServerProcess(), lower_sys(), moveRect(), qt_grab_cursor(), qt_tablet_cleanup_wce(), QRuntimeGraphicsSystem::setGraphicsSystem(), setParent_sys(), show_sys(), and stackUnder_sys().

1566 {
1567  Q_Q(QWidget);
1568 
1569  QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
1570  if (discardInvalidateBufferRequest(q, tlwExtra) || rgn.isEmpty())
1571  return;
1572 
1573  QRegion wrgn(rgn);
1574  wrgn &= clipRect();
1575  if (!graphicsEffect && extra && extra->hasMask)
1576  wrgn &= extra->mask;
1577  if (wrgn.isEmpty())
1578  return;
1579 
1580  tlwExtra->backingStore->markDirty(wrgn, q, false, true);
1581 }
QRect clipRect() const
Definition: qwidget.cpp:1997
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately=false, bool invalidateBuffer=false)
Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest e...
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra)
QRegion mask
Definition: qwidget_p.h:260
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166

◆ invalidateBuffer() [2/2]

void QWidgetPrivate::invalidateBuffer ( const QRect rect)

This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs.

Qt 4.6: Merge into a template function (after MSVC isn't supported anymore).

Definition at line 1590 of file qbackingstore.cpp.

1591 {
1592  Q_Q(QWidget);
1593 
1594  QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
1595  if (discardInvalidateBufferRequest(q, tlwExtra) || rect.isEmpty())
1596  return;
1597 
1598  QRect wRect(rect);
1599  wRect &= clipRect();
1600  if (wRect.isEmpty())
1601  return;
1602 
1603  if (graphicsEffect || !extra || !extra->hasMask) {
1604  tlwExtra->backingStore->markDirty(wRect, q, false, true);
1605  return;
1606  }
1607 
1608  QRegion wRgn(extra->mask);
1609  wRgn &= wRect;
1610  if (wRgn.isEmpty())
1611  return;
1612 
1613  tlwExtra->backingStore->markDirty(wRgn, q, false, true);
1614 }
QRect clipRect() const
Definition: qwidget.cpp:1997
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately=false, bool invalidateBuffer=false)
Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest e...
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra)
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
QRegion mask
Definition: qwidget_p.h:260
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166

◆ invalidateBuffer_resizeHelper()

void QWidgetPrivate::invalidateBuffer_resizeHelper ( const QPoint oldPos,
const QSize oldSize 
)

Invalidates the buffer when the widget is resized.

Static areas are never invalidated unless absolutely needed.

Definition at line 1470 of file qbackingstore.cpp.

Referenced by effectiveState(), qt_grab_cursor(), and setGeometry_sys().

1471 {
1472  Q_Q(QWidget);
1473  Q_ASSERT(!q->isWindow());
1474  Q_ASSERT(q->parentWidget());
1475 
1476  const bool staticContents = q->testAttribute(Qt::WA_StaticContents);
1477  const bool sizeDecreased = (data.crect.width() < oldSize.width())
1478  || (data.crect.height() < oldSize.height());
1479 
1480  const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y());
1481  const bool parentAreaExposed = !offset.isNull() || sizeDecreased;
1482  const QRect newWidgetRect(q->rect());
1483  const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height());
1484 
1485  if (!staticContents || graphicsEffect) {
1486  QRegion staticChildren;
1487  QWidgetBackingStore *bs = 0;
1488  if (offset.isNull() && (bs = maybeBackingStore()))
1489  staticChildren = bs->staticContents(q, oldWidgetRect);
1490  const bool hasStaticChildren = !staticChildren.isEmpty();
1491 
1492  if (hasStaticChildren) {
1493  QRegion dirty(newWidgetRect);
1494  dirty -= staticChildren;
1496  } else {
1497  // Entire widget needs repaint.
1498  invalidateBuffer(newWidgetRect);
1499  }
1500 
1501  if (!parentAreaExposed)
1502  return;
1503 
1504  // Invalidate newly exposed area of the parent.
1505  if (!graphicsEffect && extra && extra->hasMask) {
1506  QRegion parentExpose(extra->mask.translated(oldPos));
1507  parentExpose &= QRect(oldPos, oldSize);
1508  if (hasStaticChildren)
1509  parentExpose -= data.crect; // Offset is unchanged, safe to do this.
1510  q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
1511  } else {
1512  if (hasStaticChildren && !graphicsEffect) {
1513  QRegion parentExpose(QRect(oldPos, oldSize));
1514  parentExpose -= data.crect; // Offset is unchanged, safe to do this.
1515  q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
1516  } else {
1517  q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize)));
1518  }
1519  }
1520  return;
1521  }
1522 
1523  // Move static content to its new position.
1524  if (!offset.isNull()) {
1525  if (sizeDecreased) {
1526  const QSize minSize(qMin(oldSize.width(), data.crect.width()),
1527  qMin(oldSize.height(), data.crect.height()));
1528  moveRect(QRect(oldPos, minSize), offset.x(), offset.y());
1529  } else {
1530  moveRect(QRect(oldPos, oldSize), offset.x(), offset.y());
1531  }
1532  }
1533 
1534  // Invalidate newly visible area of the widget.
1535  if (!sizeDecreased || !oldWidgetRect.contains(newWidgetRect)) {
1536  QRegion newVisible(newWidgetRect);
1537  newVisible -= oldWidgetRect;
1538  invalidateBuffer(newVisible);
1539  }
1540 
1541  if (!parentAreaExposed)
1542  return;
1543 
1544  // Invalidate newly exposed area of the parent.
1545  const QRect oldRect(oldPos, oldSize);
1546  if (extra && extra->hasMask) {
1547  QRegion parentExpose(oldRect);
1548  parentExpose &= extra->mask.translated(oldPos);
1549  parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect);
1550  q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
1551  } else {
1552  QRegion parentExpose(oldRect);
1553  parentExpose -= data.crect;
1554  q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
1555  }
1556 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QRegion dirty
Definition: qwidget_p.h:726
QRect crect
Definition: qwidget.h:131
void moveRect(const QRect &, int dx, int dy)
QRegion staticContents(QWidget *widget=0, const QRect &withinClipRect=QRect()) const
Returns the static content inside the parent if non-zero; otherwise the static content for the entire...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
int width() const
Returns the width.
Definition: qsize.h:126
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
bool isNull() const
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
Definition: qpoint.h:125
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
QRegion mask
Definition: qwidget_p.h:260
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QWidgetBackingStore * maybeBackingStore() const
Definition: qwidget_p.h:1036
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ invalidateGraphicsEffectsRecursively()

void QWidgetPrivate::invalidateGraphicsEffectsRecursively ( )

Definition at line 2059 of file qwidget.cpp.

2060 {
2061  Q_Q(QWidget);
2062  QWidget *w = q;
2063  do {
2064  if (w->graphicsEffect()) {
2065  QWidgetEffectSourcePrivate *sourced =
2066  static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
2067  if (!sourced->updateDueToGraphicsEffect)
2068  w->graphicsEffect()->source()->d_func()->invalidateCache();
2069  }
2070  w = w->parentWidget();
2071  } while (w);
2072 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QGraphicsEffect * graphicsEffect() const
The graphicsEffect function returns a pointer to the widget&#39;s graphics effect.
Definition: qwidget.cpp:5484
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...

◆ isAboutToShow()

bool QWidgetPrivate::isAboutToShow ( ) const

Definition at line 5542 of file qwidget.cpp.

5543 {
5544  if (data.in_show)
5545  return true;
5546 
5547  Q_Q(const QWidget);
5548  if (q->isHidden())
5549  return false;
5550 
5551  // The widget will be shown if any of its ancestors are about to show.
5552  QWidget *parent = q->parentWidget();
5553  return parent ? parent->d_func()->isAboutToShow() : false;
5554 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
QObject * parent
Definition: qobject.h:92
uint in_show
Definition: qwidget.h:124

◆ isBackgroundInherited()

bool QWidgetPrivate::isBackgroundInherited ( ) const

Definition at line 1022 of file qwidget_x11.cpp.

1023 {
1024  Q_Q(const QWidget);
1025 
1026  // windows do not inherit their background
1027  if (q->isWindow() || q->windowType() == Qt::SubWindow)
1028  return false;
1029 
1030  if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent))
1031  return false;
1032 
1033  const QPalette &pal = q->palette();
1034  QPalette::ColorRole bg = q->backgroundRole();
1035  QBrush brush = pal.brush(bg);
1036 
1037  // non opaque brushes leaves us no choice, we must inherit
1038  if (!q->autoFillBackground() || !brush.isOpaque())
1039  return true;
1040 
1041  if (brush.style() == Qt::SolidPattern) {
1042  // the background is just a solid color. If there is no
1043  // propagated contents, then we claim as performance
1044  // optimization that it was not inheritet. This is the normal
1045  // case in standard Windows or Motif style.
1046  const QWidget *w = q->parentWidget();
1047  if (!w->d_func()->isBackgroundInherited())
1048  return false;
1049  }
1050 
1051  return true;
1052 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
Definition: qpalette.h:93
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ isOverlapped()

bool QWidgetPrivate::isOverlapped ( const QRect rect) const

Definition at line 1877 of file qwidget.cpp.

Referenced by scroll_sys().

1878 {
1879  Q_Q(const QWidget);
1880 
1881  const QWidget *w = q;
1882  QRect r = rect;
1883  while (w) {
1884  if (w->isWindow())
1885  return false;
1886  QWidgetPrivate *pd = w->parentWidget()->d_func();
1887  bool above = false;
1888  for (int i = 0; i < pd->children.size(); ++i) {
1889  QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
1890  if (!sibling || !sibling->isVisible() || sibling->isWindow())
1891  continue;
1892  if (!above) {
1893  above = (sibling == w);
1894  continue;
1895  }
1896 
1897  if (qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)) {
1898  const QWExtra *siblingExtra = sibling->d_func()->extra;
1899  if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
1900  && !siblingExtra->mask.translated(sibling->data->crect.topLeft()).intersects(r)) {
1901  continue;
1902  }
1903  return true;
1904  }
1905  }
1906  w = w->parentWidget();
1907  r.translate(pd->data.crect.topLeft());
1908  }
1909  return false;
1910 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWidgetData * data
Definition: qwidget.h:815
static bool qRectIntersects(const QRect &r1, const QRect &r2)
Definition: qwidget.cpp:163
QGraphicsEffect * graphicsEffect() const
The graphicsEffect function returns a pointer to the widget&#39;s graphics effect.
Definition: qwidget.cpp:5484
QRegion mask
Definition: qwidget_p.h:260
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
uint hasMask
Definition: qwidget_p.h:278
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ lower_sys()

void QWidgetPrivate::lower_sys ( )

Definition at line 4015 of file qwidget_mac.mm.

Referenced by effectiveState(), qt_grab_cursor(), and setNetWmWindowTypes().

4016 {
4017  Q_Q(QWidget);
4018  if((q->windowType() == Qt::Desktop))
4019  return;
4020 #ifdef QT_MAC_USE_COCOA
4021  if (isRealWindow()) {
4023  [window orderBack:window];
4024  } else {
4025  NSView *view = qt_mac_nativeview_for(q);
4026  NSView *parentView = [view superview];
4027  [parentView sortSubviewsUsingFunction:compareViews2Lower context:reinterpret_cast<void *>(view)];
4028  }
4029  topLevelAt_cache = 0;
4030 #else
4031  if(q->isWindow()) {
4032  SendBehind(qt_mac_window_for(q), 0);
4033  } else if(q->parentWidget()) {
4034  invalidateBuffer(q->rect());
4035  HIViewSetZOrder(qt_mac_nativeview_for(q), kHIViewZOrderBelow, 0);
4037  }
4038 #endif
4039 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
NSWindow * window
WindowRef OSWindowRef
NSComparisonResult compareViews2Lower(id view1, id view2, void *context)
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
void qt_event_request_window_change(QWidget *)

◆ mapFromGlobal()

QPoint QWidgetPrivate::mapFromGlobal ( const QPoint pos) const

Definition at line 1330 of file qwidget_x11.cpp.

1331 {
1332  Q_Q(const QWidget);
1333  if (!q->testAttribute(Qt::WA_WState_Created) || !q->internalWinId()) {
1334  //cannot trust that !isWindow() implies parentWidget() before create
1335  QPoint p = (q->isWindow() || !q->parentWidget()) ? pos : q->parentWidget()->d_func()->mapFromGlobal(pos);
1336  return p - q->data->crect.topLeft();
1337  }
1338  int x, y;
1339  Window child;
1340  XTranslateCoordinates(X11->display,
1341  QApplication::desktop()->screen(xinfo.screen())->internalWinId(),
1342  q->internalWinId(), pos.x(), pos.y(), &x, &y, &child);
1343  return mapFromWS(QPoint(x, y));
1344 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidget * screen(int screen=-1)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QX11Info xinfo
Definition: qwidget_p.h:784
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
int screen() const
Returns the number of the screen currently in use.

◆ mapToGlobal()

QPoint QWidgetPrivate::mapToGlobal ( const QPoint pos) const

Definition at line 1313 of file qwidget_x11.cpp.

Referenced by isServerProcess().

1314 {
1315  Q_Q(const QWidget);
1316  if (!q->testAttribute(Qt::WA_WState_Created) || !q->internalWinId()) {
1317  QPoint p = pos + q->data->crect.topLeft();
1318  //cannot trust that !isWindow() implies parentWidget() before create
1319  return (q->isWindow() || !q->parentWidget()) ? p : q->parentWidget()->d_func()->mapToGlobal(p);
1320  }
1321  int x, y;
1322  Window child;
1323  QPoint p = mapToWS(pos);
1324  XTranslateCoordinates(X11->display, q->internalWinId(),
1325  QApplication::desktop()->screen(xinfo.screen())->internalWinId(),
1326  p.x(), p.y(), &x, &y, &child);
1327  return QPoint(x, y);
1328 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidget * screen(int screen=-1)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QX11Info xinfo
Definition: qwidget_p.h:784
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
int screen() const
Returns the number of the screen currently in use.

◆ maybeBackingStore()

QWidgetBackingStore * QWidgetPrivate::maybeBackingStore ( ) const
inline

Definition at line 1036 of file qwidget_p.h.

Referenced by effectiveState(), qt_dirtyRegion(), and qt_grab_cursor().

1037 {
1038  Q_Q(const QWidget);
1039  QTLWExtra *x = q->window()->d_func()->maybeTopData();
1040  return x ? x->backingStore.data() : 0;
1041 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetBackingStore * data()
Definition: qwidget_p.h:132
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166

◆ maybeTopData()

QTLWExtra * QWidgetPrivate::maybeTopData ( ) const
inline

Definition at line 1010 of file qwidget_p.h.

Referenced by effectiveState(), q_createNativeChildrenAndSetParent(), qt_tablet_cleanup_wce(), and setParent_sys().

1011 {
1012  return extra ? extra->topextra : 0;
1013 }
QTLWExtra * topextra
Definition: qwidget_p.h:249
QWExtra * extra
Definition: qwidget_p.h:700

◆ moveRect()

void QWidgetPrivate::moveRect ( const QRect rect,
int  dx,
int  dy 
)

Definition at line 917 of file qbackingstore.cpp.

Referenced by effectiveState(), qt_grab_cursor(), and setGeometry_sys().

918 {
919  Q_Q(QWidget);
920  if (!q->isVisible() || (dx == 0 && dy == 0))
921  return;
922 
923  QWidget *tlw = q->window();
924  QTLWExtra* x = tlw->d_func()->topData();
925  if (x->inTopLevelResize)
926  return;
927 
928  static int accelEnv = -1;
929  if (accelEnv == -1) {
930  accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0;
931  }
932 
933  QWidget *pw = q->parentWidget();
934  QPoint toplevelOffset = pw->mapTo(tlw, QPoint());
935  QWidgetPrivate *pd = pw->d_func();
936  QRect clipR(pd->clipRect());
937 #ifdef Q_WS_QWS
939  QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface);
940  clipR = clipR.intersected(surface->clipRegion().translated(-toplevelOffset).boundingRect());
941 #endif
942  const QRect newRect(rect.translated(dx, dy));
943  QRect destRect = rect.intersected(clipR);
944  if (destRect.isValid())
945  destRect = destRect.translated(dx, dy).intersected(clipR);
946  const QRect sourceRect(destRect.translated(-dx, -dy));
947  const QRect parentRect(rect & clipR);
948 
949  bool accelerateMove = accelEnv && isOpaque
950 #ifndef QT_NO_GRAPHICSVIEW
951  // No accelerate move for proxy widgets.
952  && !tlw->d_func()->extra->proxyWidget
953 #endif
954  && !isOverlapped(sourceRect) && !isOverlapped(destRect);
955 
956  if (!accelerateMove) {
957  QRegion parentR(effectiveRectFor(parentRect));
958  if (!extra || !extra->hasMask) {
959  parentR -= newRect;
960  } else {
961  // invalidateBuffer() excludes anything outside the mask
962  parentR += newRect & clipR;
963  }
964  pd->invalidateBuffer(parentR);
965  invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft()));
966  } else {
967 
969  QRegion childExpose(newRect & clipR);
970 
971  if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw))
972  childExpose -= destRect;
973 
974  if (!pw->updatesEnabled())
975  return;
976 
977  const bool childUpdatesEnabled = q->updatesEnabled();
978  if (childUpdatesEnabled && !childExpose.isEmpty()) {
979  childExpose.translate(-data.crect.topLeft());
980  wbs->markDirty(childExpose, q);
981  isMoved = true;
982  }
983 
984  QRegion parentExpose(parentRect);
985  parentExpose -= newRect;
986  if (extra && extra->hasMask)
987  parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft());
988 
989  if (!parentExpose.isEmpty()) {
990  wbs->markDirty(parentExpose, pw);
991  pd->isMoved = true;
992  }
993 
994  if (childUpdatesEnabled) {
995  QRegion needsFlush(sourceRect);
996  needsFlush += destRect;
997  wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset);
998  }
999  }
1000 }
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
const QRegion clipRegion() const
Returns the region currently visible on the screen.
QRect crect
Definition: qwidget.h:131
QPoint mapTo(QWidget *, const QPoint &) const
Translates the widget coordinate pos to the coordinate system of parent.
Definition: qwidget.cpp:4409
QRect clipRect() const
Definition: qwidget.cpp:1997
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
uint inTopLevelResize
Definition: qwidget_p.h:188
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset)
Marks the region of the widget as dirty on screen.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately=false, bool invalidateBuffer=false)
Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest e...
bool updatesEnabled
whether updates are enabled
Definition: qwidget.h:190
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
QRegion * needsFlush
Definition: qwidget_p.h:705
QRegion mask
Definition: qwidget_p.h:260
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
QWidgetBackingStore * data()
Definition: qwidget_p.h:132
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166
bool isOverlapped(const QRect &) const
Definition: qwidget.cpp:1877
bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget)
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ nativeChildrenForced()

bool QWidgetPrivate::nativeChildrenForced ( ) const
inline

Definition at line 653 of file qwidget_p.h.

654  {
655  return extra ? extra->nativeChildrenForced : false;
656  }
QWExtra * extra
Definition: qwidget_p.h:700
uint nativeChildrenForced
Definition: qwidget_p.h:276

◆ naturalWidgetFont()

QFont QWidgetPrivate::naturalWidgetFont ( uint  inheritedMask) const

Definition at line 5030 of file qwidget.cpp.

5031 {
5032  Q_Q(const QWidget);
5033  QFont naturalFont = QApplication::font(q);
5034  if (!q->testAttribute(Qt::WA_StyleSheet)
5035  && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
5036 #ifndef QT_NO_GRAPHICSVIEW
5037  || (extra && extra->proxyWidget)
5038 #endif //QT_NO_GRAPHICSVIEW
5039  )) {
5040  if (QWidget *p = q->parentWidget()) {
5041  if (!p->testAttribute(Qt::WA_StyleSheet)) {
5042  if (!naturalFont.isCopyOf(QApplication::font())) {
5043  QFont inheritedFont = p->font();
5044  inheritedFont.resolve(inheritedMask);
5045  naturalFont = inheritedFont.resolve(naturalFont);
5046  } else {
5047  naturalFont = p->font();
5048  }
5049  }
5050  }
5051 #ifndef QT_NO_GRAPHICSVIEW
5052  else if (extra && extra->proxyWidget) {
5053  QFont inheritedFont = extra->proxyWidget->font();
5054  inheritedFont.resolve(inheritedMask);
5055  naturalFont = inheritedFont.resolve(naturalFont);
5056  }
5057 #endif //QT_NO_GRAPHICSVIEW
5058  }
5059  naturalFont.resolve(0);
5060  return naturalFont;
5061 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool isCopyOf(const QFont &) const
Returns true if this font and f are copies of each other, i.e.
Definition: qfont.cpp:1963
#define Q_Q(Class)
Definition: qglobal.h:2483
static QFont font()
Returns the default application font.
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
QFont font() const
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QWExtra * extra
Definition: qwidget_p.h:700

◆ naturalWidgetPalette()

QPalette QWidgetPrivate::naturalWidgetPalette ( uint  inheritedMask) const

Returns the palette that the widget w inherits from its ancestors and QApplication::palette.

Warning
This function is not part of the public interface.

inheritedMask is the combination of the widget's ancestors palette request masks (i.e., which attributes from the parent widget's palette are implicitly imposed on this widget by the user). Note that this font does not take into account the palette set on w itself.

Definition at line 4884 of file qwidget.cpp.

4885 {
4886  Q_Q(const QWidget);
4887  QPalette naturalPalette = QApplication::palette(q);
4888  if (!q->testAttribute(Qt::WA_StyleSheet)
4889  && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
4890 #ifndef QT_NO_GRAPHICSVIEW
4891  || (extra && extra->proxyWidget)
4892 #endif //QT_NO_GRAPHICSVIEW
4893  )) {
4894  if (QWidget *p = q->parentWidget()) {
4895  if (!p->testAttribute(Qt::WA_StyleSheet)) {
4896  if (!naturalPalette.isCopyOf(QApplication::palette())) {
4897  QPalette inheritedPalette = p->palette();
4898  inheritedPalette.resolve(inheritedMask);
4899  naturalPalette = inheritedPalette.resolve(naturalPalette);
4900  } else {
4901  naturalPalette = p->palette();
4902  }
4903  }
4904  }
4905 #ifndef QT_NO_GRAPHICSVIEW
4906  else if (extra && extra->proxyWidget) {
4907  QPalette inheritedPalette = extra->proxyWidget->palette();
4908  inheritedPalette.resolve(inheritedMask);
4909  naturalPalette = inheritedPalette.resolve(naturalPalette);
4910  }
4911 #endif //QT_NO_GRAPHICSVIEW
4912  }
4913  naturalPalette.resolve(0);
4914  return naturalPalette;
4915 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static QPalette palette()
Returns the application palette.
#define Q_Q(Class)
Definition: qglobal.h:2483
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
QPalette palette() const
bool isCopyOf(const QPalette &p) const
Returns true if this palette and p are copies of each other, i.e.
Definition: qpalette.cpp:1233
QWExtra * extra
Definition: qwidget_p.h:700
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
Definition: qpalette.cpp:1101
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ nearestGraphicsProxyWidget()

QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget ( const QWidget origin)
static

Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors.

Warning
This function is not part of the public interface.

The search starts at origin (inclusive). If successful, the function returns the proxy that embeds the widget, or 0 if no embedded widget was found.

Definition at line 6098 of file qwidget.cpp.

Referenced by QApplicationPrivate::dispatchEnterLeave(), QWidget::scroll(), and QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent().

6099 {
6100  if (origin) {
6101  QWExtra *extra = origin->d_func()->extra;
6102  if (extra && extra->proxyWidget)
6103  return extra->proxyWidget;
6104  return nearestGraphicsProxyWidget(origin->parentWidget());
6105  }
6106  return 0;
6107 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
QWExtra * extra
Definition: qwidget_p.h:700
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin)
Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget an...
Definition: qwidget.cpp:6098

◆ paintBackground()

void QWidgetPrivate::paintBackground ( QPainter painter,
const QRegion rgn,
int  flags = DrawAsRoot 
) const

Definition at line 2429 of file qwidget.cpp.

2430 {
2431  Q_Q(const QWidget);
2432 
2433 #ifndef QT_NO_SCROLLAREA
2434  bool resetBrushOrigin = false;
2435  QPointF oldBrushOrigin;
2436  //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
2438  if (scrollArea && scrollArea->viewport() == q) {
2439  QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
2440  QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
2441  oldBrushOrigin = painter->brushOrigin();
2442  resetBrushOrigin = true;
2443  painter->setBrushOrigin(-priv->contentsOffset());
2444 
2445  }
2446 #endif // QT_NO_SCROLLAREA
2447 
2448  const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
2449 
2450  if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {
2451  const QBrush bg = q->palette().brush(QPalette::Window);
2452 #if defined(Q_WS_QWS) || defined(Q_WS_QPA)
2453  if (!(flags & DontSetCompositionMode)) {
2454  //copy alpha straight in
2455  QPainter::CompositionMode oldMode = painter->compositionMode();
2457  fillRegion(painter, rgn, bg);
2458  painter->setCompositionMode(oldMode);
2459  } else {
2460  fillRegion(painter, rgn, bg);
2461  }
2462 #else
2463  fillRegion(painter, rgn, bg);
2464 #endif
2465  }
2466 
2467  if (q->autoFillBackground())
2468  fillRegion(painter, rgn, autoFillBrush);
2469 
2470  if (q->testAttribute(Qt::WA_StyledBackground)) {
2471  painter->setClipRegion(rgn);
2472  QStyleOption opt;
2473  opt.initFrom(q);
2474  q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
2475  }
2476 
2477 #ifndef QT_NO_SCROLLAREA
2478  if (resetBrushOrigin)
2479  painter->setBrushOrigin(oldBrushOrigin);
2480 #endif // QT_NO_SCROLLAREA
2481 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
CompositionMode
Defines the modes supported for digital image compositing.
Definition: qpainter.h:138
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
void setBrushOrigin(int x, int y)
Sets the brush&#39;s origin to point (x, y).
Definition: qpainter.h:825
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidget * viewport() const
Returns the viewport widget.
QPoint brushOrigin() const
Returns the currently set brush origin.
Definition: qpainter.cpp:2168
static void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)
Definition: qwidget.cpp:2392
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
QWidgetData * data
Definition: qwidget.h:815
CompositionMode compositionMode() const
Returns the current composition mode.
Definition: qpainter.cpp:2466
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
Definition: qpainter.cpp:2917
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
Definition: qpainter.cpp:2422
static const QMetaObjectPrivate * priv(const uint *data)
QObject * parent
Definition: qobject.h:92
virtual QPoint contentsOffset() const

◆ paintOnScreen()

bool QWidgetPrivate::paintOnScreen ( ) const

Definition at line 2255 of file qwidget.cpp.

Referenced by QGraphicsViewPrivate::dispatchPendingUpdateRequests(), qt_grab_cursor(), qt_tablet_cleanup_wce(), and scroll_sys().

2256 {
2257 #if defined(Q_WS_QWS)
2258  return false;
2259 #elif defined(QT_NO_BACKINGSTORE)
2260  return true;
2261 #else
2262  Q_Q(const QWidget);
2263  if (q->testAttribute(Qt::WA_PaintOnScreen)
2264  || (!q->isWindow() && q->window()->testAttribute(Qt::WA_PaintOnScreen))) {
2265  return true;
2266  }
2267 
2268  return !qt_enable_backingstore;
2269 #endif
2270 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ paintSiblingsRecursive()

void QWidgetPrivate::paintSiblingsRecursive ( QPaintDevice pdev,
const QObjectList children,
int  index,
const QRegion rgn,
const QPoint offset,
int  flags,
QPainter sharedPainter,
QWidgetBackingStore backingStore 
)

Definition at line 5946 of file qwidget.cpp.

5952 {
5953  QWidget *w = 0;
5955  bool dirtyBoundingRect = true;
5956  const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
5957  const bool excludeNativeChildren = (flags & DontDrawNativeChildren);
5958 
5959  do {
5960  QWidget *x = qobject_cast<QWidget*>(siblings.at(index));
5961  if (x && !(exludeOpaqueChildren && x->d_func()->isOpaque) && !x->isHidden() && !x->isWindow()
5962  && !(excludeNativeChildren && x->internalWinId())) {
5963  if (dirtyBoundingRect) {
5964  boundingRect = rgn.boundingRect();
5965  dirtyBoundingRect = false;
5966  }
5967 
5968  if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {
5969 #ifdef Q_BACKINGSTORE_SUBSURFACES
5970  if (x->windowSurface() == currentSurface)
5971 #endif
5972  {
5973  w = x;
5974  break;
5975  }
5976  }
5977  }
5978  --index;
5979  } while (index >= 0);
5980 
5981  if (!w)
5982  return;
5983 
5984  QWidgetPrivate *wd = w->d_func();
5985  const QPoint widgetPos(w->data->crect.topLeft());
5986  const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect;
5987  if (index > 0) {
5988  QRegion wr(rgn);
5989  if (wd->isOpaque)
5990  wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
5991  paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
5992 #ifdef Q_BACKINGSTORE_SUBSURFACES
5993  , currentSurface
5994 #endif
5995  , sharedPainter, backingStore);
5996  }
5997 
5998  if (w->updatesEnabled()
5999 #ifndef QT_NO_GRAPHICSVIEW
6000  && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)
6001 #endif //QT_NO_GRAPHICSVIEW
6002  ) {
6003  QRegion wRegion(rgn);
6004  wRegion &= wd->effectiveRectFor(w->data->crect);
6005  wRegion.translate(-widgetPos);
6006  if (hasMask)
6007  wRegion &= wd->extra->mask;
6008  wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore);
6009  }
6010 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
Definition: qwidget.cpp:5946
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
static const QRectF boundingRect(const QPointF *points, int pointCount)
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
bool updatesEnabled
whether updates are enabled
Definition: qwidget.h:190
void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
Definition: qwidget.cpp:5679
QWidgetData * data
Definition: qwidget.h:815
QWindowSurface * windowSurface() const
Returns the QWindowSurface this widget will be drawn into.
Definition: qwidget.cpp:12819
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool qRectIntersects(const QRect &r1, const QRect &r2)
Definition: qwidget.cpp:163
QRegion mask
Definition: qwidget_p.h:260
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
quint16 index
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ pointInsideRectAndMask()

bool QWidgetPrivate::pointInsideRectAndMask ( const QPoint p) const
inline

Definition at line 1029 of file qwidget_p.h.

1030 {
1031  Q_Q(const QWidget);
1032  return q->rect().contains(p) && (!extra || !extra->hasMask || q->testAttribute(Qt::WA_MouseNoMask)
1033  || extra->mask.contains(p));
1034 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
Definition: qregion.cpp:4104
QRegion mask
Definition: qwidget_p.h:260
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278

◆ pointToRect()

int QWidgetPrivate::pointToRect ( const QPoint p,
const QRect r 
)
static
Warning
This function is not part of the public interface.

Measures the shortest distance from a point to a rect.

This function is called from QDesktopwidget::screen(QPoint) to find the closest screen for a point. In directional KeypadNavigation, it is called to find the closest widget to the current focus widget center.

Definition at line 7128 of file qwidget.cpp.

Referenced by QDesktopWidget::screenNumber().

7129 {
7130  int dx = 0;
7131  int dy = 0;
7132  if (p.x() < r.left())
7133  dx = r.left() - p.x();
7134  else if (p.x() > r.right())
7135  dx = p.x() - r.right();
7136  if (p.y() < r.top())
7137  dy = r.top() - p.y();
7138  else if (p.y() > r.bottom())
7139  dy = p.y() - r.bottom();
7140  return dx + dy;
7141 }
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ prepareToRender()

QRegion QWidgetPrivate::prepareToRender ( const QRegion region,
QWidget::RenderFlags  renderFlags 
)

Definition at line 5556 of file qwidget.cpp.

5557 {
5558  Q_Q(QWidget);
5559  const bool isVisible = q->isVisible();
5560 
5561  // Make sure the widget is laid out correctly.
5562  if (!isVisible && !isAboutToShow()) {
5563  QWidget *topLevel = q->window();
5564  (void)topLevel->d_func()->topData(); // Make sure we at least have top-data.
5565  topLevel->ensurePolished();
5566 
5567  // Invalidate the layout of hidden ancestors (incl. myself) and pretend
5568  // they're not explicitly hidden.
5569  QWidget *widget = q;
5570  QWidgetList hiddenWidgets;
5571  while (widget) {
5572  if (widget->isHidden()) {
5573  widget->setAttribute(Qt::WA_WState_Hidden, false);
5574  hiddenWidgets.append(widget);
5575  if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
5576  widget->d_func()->updateGeometry_helper(true);
5577  }
5578  widget = widget->parentWidget();
5579  }
5580 
5581  // Activate top-level layout.
5582  if (topLevel->d_func()->layout)
5583  topLevel->d_func()->layout->activate();
5584 
5585  // Adjust size if necessary.
5586  QTLWExtra *topLevelExtra = topLevel->d_func()->maybeTopData();
5587  if (topLevelExtra && !topLevelExtra->sizeAdjusted
5588  && !topLevel->testAttribute(Qt::WA_Resized)) {
5589  topLevel->adjustSize();
5590  topLevel->setAttribute(Qt::WA_Resized, false);
5591  }
5592 
5593  // Activate child layouts.
5594  topLevel->d_func()->activateChildLayoutsRecursively();
5595 
5596  // We're not cheating with WA_WState_Hidden anymore.
5597  for (int i = 0; i < hiddenWidgets.size(); ++i) {
5598  QWidget *widget = hiddenWidgets.at(i);
5600  if (!widget->isWindow() && widget->parentWidget()->d_func()->layout)
5601  widget->parentWidget()->d_func()->layout->invalidate();
5602  }
5603  } else if (isVisible) {
5604  q->window()->d_func()->sendPendingMoveAndResizeEvents(true, true);
5605  }
5606 
5607  // Calculate the region to be painted.
5608  QRegion toBePainted = !region.isEmpty() ? region : QRegion(q->rect());
5609  if (!(renderFlags & QWidget::IgnoreMask) && extra && extra->hasMask)
5610  toBePainted &= extra->mask;
5611  return toBePainted;
5612 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QPointer< QWidget > widget
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool activate()
Redoes the layout for parentWidget() if necessary.
Definition: qlayout.cpp:1249
void invalidate()
Reimplemented Function
Definition: qlayout.cpp:673
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
void adjustSize()
Adjusts the size of the widget to fit its contents.
Definition: qwidget.cpp:8488
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QRegion mask
Definition: qwidget_p.h:260
bool isAboutToShow() const
Definition: qwidget.cpp:5542
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWExtra * extra
Definition: qwidget_p.h:700
uint hasMask
Definition: qwidget_p.h:278
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
uint sizeAdjusted
Definition: qwidget_p.h:187
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ propagatePaletteChange()

void QWidgetPrivate::propagatePaletteChange ( )

Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows).

Warning
This function is not part of the public interface.

Definition at line 1963 of file qwidget.cpp.

1964 {
1965  Q_Q(QWidget);
1966  // Propagate a new inherited mask to all children.
1967 #ifndef QT_NO_GRAPHICSVIEW
1968  if (!q->parentWidget() && extra && extra->proxyWidget) {
1970  inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();
1971  } else
1972 #endif //QT_NO_GRAPHICSVIEW
1973  if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
1975  }
1977 
1979  QApplication::sendEvent(q, &pc);
1980  for (int i = 0; i < children.size(); ++i) {
1981  QWidget *w = qobject_cast<QWidget*>(children.at(i));
1982  if (w && !w->testAttribute(Qt::WA_StyleSheet)
1983  && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
1984  QWidgetPrivate *wd = w->d_func();
1985  wd->inheritedPaletteResolveMask = mask;
1986  wd->resolvePalette();
1987  }
1988  }
1989 #if defined(QT3_SUPPORT)
1990  q->paletteChange(q->palette()); // compatibility
1991 #endif
1992 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void resolvePalette()
Determine which palette is inherited from this widget&#39;s ancestors and QApplication::palette, resolve this against this widget&#39;s palette (attributes from the inherited palette are copied over this widget&#39;s palette).
Definition: qwidget.cpp:4927
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
QPalette palette() const
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
uint inheritedPaletteResolveMask
Definition: qwidget_p.h:743
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWExtra * extra
Definition: qwidget_p.h:700
QPalette pal
Definition: qwidget.h:132
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
Definition: qpalette.cpp:1101

◆ raise_sys()

void QWidgetPrivate::raise_sys ( )

Definition at line 3937 of file qwidget_mac.mm.

Referenced by effectiveState(), qt_grab_cursor(), and setNetWmWindowTypes().

3938 {
3939  Q_Q(QWidget);
3940  if((q->windowType() == Qt::Desktop))
3941  return;
3942 
3943 #if QT_MAC_USE_COCOA
3945  if (isRealWindow()) {
3946  // With the introduction of spaces it is not as simple as just raising the window.
3947  // First we need to check if we are in the right space. If we are, then we just continue
3948  // as usual. The problem comes when we are not in the active space. There are two main cases:
3949  // 1. Our parent was moved to a new space. In this case we want the window to be raised
3950  // in the same space as its parent.
3951  // 2. We don't have a parent. For this case we will just raise the window and let Cocoa
3952  // switch to the corresponding space.
3953  // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if
3954  // required we will introduce special handling for some of them.
3955  if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
3957  // isOnActiveSpace is available only from 10.6 onwards, so we need to check if it is
3958  // available before calling it.
3959  if([window respondsToSelector:@selector(isOnActiveSpace)]) {
3960  if(![window performSelector:@selector(isOnActiveSpace)]) {
3962  if(parentWidget) {
3963  OSWindowRef parentWindow = qt_mac_window_for(parentWidget);
3964  if(parentWindow && [parentWindow respondsToSelector:@selector(isOnActiveSpace)]) {
3965  if ([parentWindow performSelector:@selector(isOnActiveSpace)]) {
3966  // The window was created in a different space. Therefore if we want
3967  // to show it in the current space we need to recreate it in the new
3968  // space.
3969  recreateMacWindow();
3970  window = qt_mac_window_for(q);
3971  }
3972  }
3973  }
3974  }
3975  }
3976  [window orderFront:window];
3977  }
3978  if (qt_mac_raise_process) { //we get to be the active process now
3979  ProcessSerialNumber psn;
3980  GetCurrentProcess(&psn);
3981  SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
3982  }
3983  } else {
3984  NSView *view = qt_mac_nativeview_for(q);
3985  NSView *parentView = [view superview];
3986  [parentView sortSubviewsUsingFunction:compareViews2Raise context:reinterpret_cast<void *>(view)];
3987  }
3988  topLevelAt_cache = 0;
3989 #else
3990  if(q->isWindow()) {
3991  //raise this window
3992  BringToFront(qt_mac_window_for(q));
3993  if(qt_mac_raise_process) { //we get to be the active process now
3994  ProcessSerialNumber psn;
3995  GetCurrentProcess(&psn);
3996  SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
3997  }
3998  } else if(q->parentWidget()) {
3999  HIViewSetZOrder(qt_mac_nativeview_for(q), kHIViewZOrderAbove, 0);
4001  }
4002 #endif
4003 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
NSWindow * window
WindowRef OSWindowRef
static QWidget * parentWidget(const QWidget *w)
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
static bool qt_mac_raise_process
Definition: qwidget_mac.mm:154
NSComparisonResult compareViews2Raise(id view1, id view2, void *context)
void qt_event_request_window_change(QWidget *)

◆ redirected()

QPaintDevice* QWidgetPrivate::redirected ( QPoint offset) const
inline

Definition at line 628 of file qwidget_p.h.

Referenced by QPainter::redirected().

629  {
630  if (offset)
631  *offset = redirectDev ? redirectOffset : QPoint();
632  return redirectDev;
633  }
QPaintDevice * redirectDev
Definition: qwidget_p.h:706
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPoint redirectOffset
Definition: qwidget_p.h:758

◆ registerDropSite()

void QWidgetPrivate::registerDropSite ( bool  on)

Definition at line 5025 of file qwidget_mac.mm.

Referenced by create_sys(), do_size_hints(), effectiveState(), qt_grab_cursor(), qt_mac_unregister_widget(), and qt_tablet_cleanup_wce().

5026 {
5027  Q_Q(QWidget);
5028  if (!q->testAttribute(Qt::WA_WState_Created))
5029  return;
5030 #ifndef QT_MAC_USE_COCOA
5031  SetControlDragTrackingEnabled(qt_mac_nativeview_for(q), on);
5032 #else
5033  NSWindow *win = qt_mac_window_for(q);
5034  if (on) {
5035  if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaWindow) class]])
5036  [static_cast<QT_MANGLE_NAMESPACE(QCocoaWindow) *>(win) registerDragTypes];
5037  else if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaPanel) class]])
5038  [static_cast<QT_MANGLE_NAMESPACE(QCocoaPanel) *>(win) registerDragTypes];
5039  }
5040 #endif
5041 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ render()

void QWidgetPrivate::render ( QPaintDevice target,
const QPoint targetOffset,
const QRegion sourceRegion,
QWidget::RenderFlags  renderFlags,
bool  readyToRender 
)

Definition at line 5856 of file qwidget.cpp.

5859 {
5860  if (!target) {
5861  qWarning("QWidget::render: null pointer to paint device");
5862  return;
5863  }
5864 
5865  const bool inRenderWithPainter = extra && extra->inRenderWithPainter;
5866  QRegion paintRegion = !inRenderWithPainter && !readyToRender
5867  ? prepareToRender(sourceRegion, renderFlags)
5868  : sourceRegion;
5869  if (paintRegion.isEmpty())
5870  return;
5871 
5872 #ifndef Q_WS_MAC
5873  QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
5874 
5875  // Use the target's shared painter if set (typically set when doing
5876  // "other->render(widget);" in the widget's paintEvent.
5877  if (target->devType() == QInternal::Widget) {
5878  QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();
5879  if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
5880  QPainter *targetPainter = targetPrivate->sharedPainter();
5881  if (targetPainter && targetPainter->isActive())
5882  setSharedPainter(targetPainter);
5883  }
5884  }
5885 #endif
5886 
5887  // Use the target's redirected device if set and adjust offset and paint
5888  // region accordingly. This is typically the case when people call render
5889  // from the paintEvent.
5890  QPoint offset = targetOffset;
5891  offset -= paintRegion.boundingRect().topLeft();
5892  QPoint redirectionOffset;
5893  QPaintDevice *redirected = 0;
5894 
5895  if (target->devType() == QInternal::Widget)
5896  redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
5897  if (!redirected)
5898  redirected = QPainter::redirected(target, &redirectionOffset);
5899 
5900  if (redirected) {
5901  target = redirected;
5902  offset -= redirectionOffset;
5903  }
5904 
5905  if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
5906  if (QPaintEngine *targetEngine = target->paintEngine()) {
5907  const QRegion targetSystemClip = targetEngine->systemClip();
5908  if (!targetSystemClip.isEmpty())
5909  paintRegion &= targetSystemClip.translated(-offset);
5910  }
5911  }
5912 
5913  // Set backingstore flags.
5914  int flags = DrawPaintOnScreen | DrawInvisible;
5915  if (renderFlags & QWidget::DrawWindowBackground)
5916  flags |= DrawAsRoot;
5917 
5918  if (renderFlags & QWidget::DrawChildren)
5919  flags |= DrawRecursive;
5920  else
5921  flags |= DontSubtractOpaqueChildren;
5922 
5923 #if defined(Q_WS_QWS) || defined(Q_WS_QPA)
5924  flags |= DontSetCompositionMode;
5925 #endif
5926 
5927  if (target->devType() == QInternal::Printer) {
5928  QPainter p(target);
5929  render_helper(&p, targetOffset, paintRegion, renderFlags);
5930  return;
5931  }
5932 
5933 #ifndef Q_WS_MAC
5934  // Render via backingstore.
5935  drawWidget(target, paintRegion, offset, flags, sharedPainter());
5936 
5937  // Restore shared painter.
5938  if (oldSharedPainter)
5939  setSharedPainter(oldSharedPainter);
5940 #else
5941  // Render via backingstore (no shared painter).
5942  drawWidget(target, paintRegion, offset, flags, 0);
5943 #endif
5944 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void setSharedPainter(QPainter *painter)
Definition: qwidget_p.h:1022
QPaintDevice * redirected(QPoint *offset) const
Definition: qwidget_p.h:628
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
virtual int devType() const
Definition: qpaintdevice.h:167
void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
Definition: qwidget.cpp:5614
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
Definition: qwidget.cpp:5679
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false...
Definition: qpainter.cpp:1545
Q_CORE_EXPORT void qWarning(const char *,...)
uint inRenderWithPainter
Definition: qwidget_p.h:277
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
virtual QPaintEngine * paintEngine() const =0
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPainter * sharedPainter() const
Definition: qwidget_p.h:1015
QWExtra * extra
Definition: qwidget_p.h:700
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
static QPaintDevice * redirected(const QPaintDevice *device, QPoint *offset=0)
Using QWidget::render() obsoletes the use of this function.
Definition: qpainter.cpp:8391
QRegion prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags)
Definition: qwidget.cpp:5556
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ render_helper()

void QWidgetPrivate::render_helper ( QPainter painter,
const QPoint targetOffset,
const QRegion sourceRegion,
QWidget::RenderFlags  renderFlags 
)

Definition at line 5614 of file qwidget.cpp.

5616 {
5617  Q_ASSERT(painter);
5618  Q_ASSERT(!toBePainted.isEmpty());
5619 
5620  Q_Q(QWidget);
5621 #ifndef Q_WS_MAC
5622  const QTransform originalTransform = painter->worldTransform();
5623  const bool useDeviceCoordinates = originalTransform.isScaling();
5624  if (!useDeviceCoordinates) {
5625 #endif
5626  // Render via a pixmap.
5627  const QRect rect = toBePainted.boundingRect();
5628  const QSize size = rect.size();
5629  if (size.isNull())
5630  return;
5631 
5632  QPixmap pixmap(size);
5633  if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque)
5634  pixmap.fill(Qt::transparent);
5635  q->render(&pixmap, QPoint(), toBePainted, renderFlags);
5636 
5637  const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform);
5639 
5640  painter->drawPixmap(targetOffset, pixmap);
5641 
5642  if (restore)
5644 
5645 #ifndef Q_WS_MAC
5646  } else {
5647  // Render via a pixmap in device coordinates (to avoid pixmap scaling).
5648  QTransform transform = originalTransform;
5649  transform.translate(targetOffset.x(), targetOffset.y());
5650 
5651  QPaintDevice *device = painter->device();
5652  Q_ASSERT(device);
5653 
5654  // Calculate device rect.
5655  const QRectF rect(toBePainted.boundingRect());
5656  QRect deviceRect = transform.mapRect(QRectF(0, 0, rect.width(), rect.height())).toAlignedRect();
5657  deviceRect &= QRect(0, 0, device->width(), device->height());
5658 
5659  QPixmap pixmap(deviceRect.size());
5660  pixmap.fill(Qt::transparent);
5661 
5662  // Create a pixmap device coordinate painter.
5663  QPainter pixmapPainter(&pixmap);
5664  pixmapPainter.setRenderHints(painter->renderHints());
5665  transform *= QTransform::fromTranslate(-deviceRect.x(), -deviceRect.y());
5666  pixmapPainter.setTransform(transform);
5667 
5668  q->render(&pixmapPainter, QPoint(), toBePainted, renderFlags);
5669  pixmapPainter.end();
5670 
5671  // And then draw the pixmap.
5672  painter->setTransform(QTransform());
5673  painter->drawPixmap(deviceRect.topLeft(), pixmap);
5674  painter->setTransform(originalTransform);
5675  }
5676 #endif
5677 }
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Definition: qpainter.cpp:9547
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
int height() const
Definition: qpaintdevice.h:92
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
int width() const
Definition: qpaintdevice.h:91
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
void setRenderHints(RenderHints hints, bool on=true)
Sets the given render hints on the painter if on is true; otherwise clears the render hints...
Definition: qpainter.cpp:7649
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
bool isScaling() const
Returns true if the matrix represents a scaling transformation, otherwise returns false...
Definition: qtransform.h:214
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
Definition: qsize.h:117
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...
Definition: qpainter.cpp:5619
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QTransform fromTranslate(qreal dx, qreal dy)
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis...
Definition: qtransform.cpp:462
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
Definition: qpainter.cpp:7675
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ repaint_sys()

void QWidgetPrivate::repaint_sys ( const QRegion rgn)

Definition at line 1616 of file qbackingstore.cpp.

1617 {
1618  if (data.in_destructor)
1619  return;
1620 
1621  Q_Q(QWidget);
1622  if (q->testAttribute(Qt::WA_StaticContents)) {
1623  if (!extra)
1624  createExtra();
1626  }
1627 
1628 #ifdef Q_WS_QPA //Don't even call q->p
1629  QPaintEngine *engine = 0;
1630 #else
1631  QPaintEngine *engine = q->paintEngine();
1632 #endif
1633  // QGLWidget does not support partial updates if:
1634  // 1) The context is double buffered
1635  // 2) The context is single buffered and auto-fill background is enabled.
1636  const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL
1637  || engine->type() == QPaintEngine::OpenGL2))
1638  && (usesDoubleBufferedGLContext || q->autoFillBackground());
1639  QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn);
1640 
1641 #ifdef Q_WS_MAC
1642  // No difference between update() and repaint() on the Mac.
1643  update_sys(toBePainted);
1644  return;
1645 #endif
1646 
1647  toBePainted &= clipRect();
1648  clipToEffectiveMask(toBePainted);
1649  if (toBePainted.isEmpty())
1650  return; // Nothing to repaint.
1651 
1652 #ifndef QT_NO_PAINT_DEBUG
1653  bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted);
1654 #endif
1655 
1657 
1658 #ifndef QT_NO_PAINT_DEBUG
1659  if (flushed)
1660  QWidgetBackingStore::unflushPaint(q, toBePainted);
1661 #endif
1662 
1663  if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive())
1664  qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
1665 }
QRect crect
Definition: qwidget.h:131
QRect clipRect() const
Definition: qwidget.cpp:1997
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
QSize staticContentsSize
Definition: qwidget_p.h:270
void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
Definition: qwidget.cpp:5679
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWExtra * extra
Definition: qwidget_p.h:700
uint usesDoubleBufferedGLContext
Definition: qwidget_p.h:776
uint in_destructor
Definition: qwidget.h:129
void clipToEffectiveMask(QRegion &region) const
Definition: qwidget.cpp:2230
static bool flushPaint(QWidget *widget, const QRegion &rgn)
static void unflushPaint(QWidget *widget, const QRegion &rgn)

◆ reparentFocusWidgets()

void QWidgetPrivate::reparentFocusWidgets ( QWidget oldtlw)
Warning
This function is not part of the public interface.

Moves the relevant subwidgets of this widget from the oldtlw's tab chain to that of the new parent, if there's anything to move and we're really moving

This function is called from QWidget::reparent() after the widget has been reparented.

See also
reparent()

Definition at line 7047 of file qwidget.cpp.

7048 {
7049  Q_Q(QWidget);
7050  if (oldtlw == q->window())
7051  return; // nothing to do
7052 
7053  if(focus_child)
7055 
7056  // separate the focus chain into new (children of myself) and old (the rest)
7057  QWidget *firstOld = 0;
7058  //QWidget *firstNew = q; //invariant
7059  QWidget *o = 0; // last in the old list
7060  QWidget *n = q; // last in the new list
7061 
7062  bool prevWasNew = true;
7063  QWidget *w = focus_next;
7064 
7065  //Note: for efficiency, we do not maintain the list invariant inside the loop
7066  //we append items to the relevant list, and we optimize by not changing pointers
7067  //when subsequent items are going into the same list.
7068  while (w != q) {
7069  bool currentIsNew = q->isAncestorOf(w);
7070  if (currentIsNew) {
7071  if (!prevWasNew) {
7072  //prev was old -- append to new list
7073  n->d_func()->focus_next = w;
7074  w->d_func()->focus_prev = n;
7075  }
7076  n = w;
7077  } else {
7078  if (prevWasNew) {
7079  //prev was new -- append to old list, if there is one
7080  if (o) {
7081  o->d_func()->focus_next = w;
7082  w->d_func()->focus_prev = o;
7083  } else {
7084  // "create" the old list
7085  firstOld = w;
7086  }
7087  }
7088  o = w;
7089  }
7090  w = w->d_func()->focus_next;
7091  prevWasNew = currentIsNew;
7092  }
7093 
7094  //repair the old list:
7095  if (firstOld) {
7096  o->d_func()->focus_next = firstOld;
7097  firstOld->d_func()->focus_prev = o;
7098  }
7099 
7100  if (!q->isWindow()) {
7101  QWidget *topLevel = q->window();
7102  //insert new chain into toplevel's chain
7103 
7104  QWidget *prev = topLevel->d_func()->focus_prev;
7105 
7106  topLevel->d_func()->focus_prev = n;
7107  prev->d_func()->focus_next = q;
7108 
7109  focus_prev = prev;
7110  n->d_func()->focus_next = topLevel;
7111  } else {
7112  //repair the new list
7113  n->d_func()->focus_next = q;
7114  focus_prev = n;
7115  }
7116 
7117 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
void clearFocus()
Takes keyboard input focus from the widget.
Definition: qwidget.cpp:6757
QWidget * focus_child
Definition: qwidget_p.h:703
QWidget * focus_next
Definition: qwidget_p.h:701
QWidget * focus_prev
Definition: qwidget_p.h:702
bool isAncestorOf(const QWidget *child) const
Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child...
Definition: qwidget.cpp:8573
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492

◆ resolveFont()

void QWidgetPrivate::resolveFont ( )

Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over).

Warning
This function is not part of the public interface.

Then propagate this font to this widget's children.

Definition at line 5074 of file qwidget.cpp.

Referenced by QGraphicsProxyWidget::event(), setModal_sys(), and updateFont().

5075 {
5077  QFont resolvedFont = data.fnt.resolve(naturalFont);
5078  setFont_helper(resolvedFont);
5079 }
QFont fnt
Definition: qwidget.h:133
QWidgetData data
Definition: qwidget_p.h:755
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
QFont naturalWidgetFont(uint inheritedMask) const
Definition: qwidget.cpp:5030
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
uint inheritedFontResolveMask
Definition: qwidget_p.h:742
void setFont_helper(const QFont &font)
Definition: qwidget_p.h:436

◆ resolveLayoutDirection()

void QWidgetPrivate::resolveLayoutDirection ( )

Definition at line 5171 of file qwidget.cpp.

5172 {
5173  Q_Q(const QWidget);
5174  if (!q->testAttribute(Qt::WA_SetLayoutDirection))
5175  setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
5176 }
static Qt::LayoutDirection layoutDirection()
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setLayoutDirection_helper(Qt::LayoutDirection)
Definition: qwidget.cpp:5153
#define Q_Q(Class)
Definition: qglobal.h:2483
static QWidget * parentWidget(const QWidget *w)

◆ resolveLocale()

void QWidgetPrivate::resolveLocale ( )

Definition at line 6167 of file qwidget.cpp.

6168 {
6169  Q_Q(const QWidget);
6170 
6171  if (!q->testAttribute(Qt::WA_SetLocale)) {
6172  setLocale_helper(q->isWindow()
6173  ? QLocale()
6174  : q->parentWidget()->locale());
6175  }
6176 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setLocale_helper(const QLocale &l, bool forceUpdate=false)
Definition: qwidget.cpp:6128
QLocale locale
Definition: qwidget_p.h:757
#define Q_Q(Class)
Definition: qglobal.h:2483
static QWidget * parentWidget(const QWidget *w)

◆ resolvePalette()

void QWidgetPrivate::resolvePalette ( )

Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette).

Warning
This function is not part of the public interface.

Then propagate this palette to this widget's children.

Definition at line 4927 of file qwidget.cpp.

Referenced by QGraphicsProxyWidget::event(), and propagatePaletteChange().

4928 {
4930  QPalette resolvedPalette = data.pal.resolve(naturalPalette);
4931  setPalette_helper(resolvedPalette);
4932 }
void setPalette_helper(const QPalette &)
Definition: qwidget.cpp:4934
QPalette naturalWidgetPalette(uint inheritedMask) const
Returns the palette that the widget w inherits from its ancestors and QApplication::palette.
Definition: qwidget.cpp:4884
QWidgetData data
Definition: qwidget_p.h:755
uint inheritedPaletteResolveMask
Definition: qwidget_p.h:743
QPalette pal
Definition: qwidget.h:132
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
Definition: qpalette.cpp:1101
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ restoreRedirected()

void QWidgetPrivate::restoreRedirected ( )
inline

Definition at line 635 of file qwidget_p.h.

636  { redirectDev = 0; }
QPaintDevice * redirectDev
Definition: qwidget_p.h:706

◆ screenGeometry()

static QRect QWidgetPrivate::screenGeometry ( const QWidget widget)
inlinestatic

Definition at line 600 of file qwidget_p.h.

Referenced by QDesktopWidget::availableGeometry(), QDesktopWidgetPrivate::init(), QDesktopWidget::screenGeometry(), and QDesktopWidgetPrivate::updateScreenList().

601  {
602  QRect screen;
603 #ifndef QT_NO_GRAPHICSVIEW
604  QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget);
605  //It's embedded if it has an ancestor
606  if (ancestorProxy) {
607  if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) {
608  // One view, let be smart and return the viewport rect then the popup is aligned
609  if (ancestorProxy->scene()->views().size() == 1) {
610  QGraphicsView *view = ancestorProxy->scene()->views().at(0);
611  screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect();
612  } else {
613  screen = ancestorProxy->scene()->sceneRect().toRect();
614  }
615  }
616  }
617 #endif
618  return screen;
619  }
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
static bool bypassGraphicsProxyWidget(const QWidget *p)
Returns true if p or any of its parents enable the Qt::BypassGraphicsProxyWidget window flag...
Definition: qwidget_p.h:353
static const QRectF boundingRect(const QPointF *points, int pointCount)
QWidget * viewport() const
Returns the viewport widget.
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.

◆ scroll_sys() [1/2]

void QWidgetPrivate::scroll_sys ( int  dx,
int  dy 
)

Definition at line 4700 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), QMacScrollOptimization::performDelayedScroll(), and qt_grab_cursor().

4701 {
4703  // INVARIANT: Alien paint engine
4704  scrollChildren(dx, dy);
4705  scrollRect(q_func()->rect(), dx, dy);
4706  } else {
4707  scroll_sys(dx, dy, QRect());
4708  }
4709 }
bool paintOnScreen() const
Definition: qwidget.cpp:2255
void scrollChildren(int dx, int dy)
Definition: qwidget.cpp:421
void scroll_sys(int dx, int dy)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void scrollRect(const QRect &, int dx, int dy)
static QGraphicsSystem * graphicsSystem()

◆ scroll_sys() [2/2]

void QWidgetPrivate::scroll_sys ( int  dx,
int  dy,
const QRect r 
)

Definition at line 4711 of file qwidget_mac.mm.

4712 {
4713  if (QMacScrollOptimization::delayScroll(this, dx, dy, qscrollRect))
4714  return;
4715 
4716  Q_Q(QWidget);
4718  // INVARIANT: Alien paint engine
4719  scrollRect(qscrollRect, dx, dy);
4720  return;
4721  }
4722 
4723  static int accelEnv = -1;
4724  if (accelEnv == -1) {
4725  accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
4726  }
4727 
4728  // Scroll the whole widget if qscrollRect is not valid:
4729  QRect validScrollRect = qscrollRect.isValid() ? qscrollRect : q->rect();
4730 
4731  // If q is overlapped by other widgets, we cannot just blit pixels since
4732  // this will move overlapping widgets as well. In case we just update:
4733  const bool overlapped = isOverlapped(validScrollRect.translated(data.crect.topLeft()));
4734  const bool accelerateScroll = accelEnv && isOpaque && !overlapped;
4735  const bool isAlien = (q->internalWinId() == 0);
4736 
4737  // If qscrollRect is valid, we are _not_ supposed to scroll q's children (as documented).
4738  // But we do scroll children (and the whole of q) if qscrollRect is invalid. This case is
4739  // documented as undefined, but we exploit it to help factor our code into one function.
4740  const bool scrollChildren = !qscrollRect.isValid();
4741 
4742  if (!q->updatesEnabled()) {
4743  // We are told not to update anything on q at this point. So unless
4744  // we are supposed to scroll children, we bail out early:
4745  if (!scrollChildren || q->children().isEmpty())
4746  return;
4747  }
4748 
4749  if (!accelerateScroll) {
4750  if (overlapped) {
4751  QRegion region(validScrollRect);
4752  subtractOpaqueSiblings(region);
4753  update_sys(region);
4754  }else {
4755  update_sys(qscrollRect);
4756  }
4757  }
4758 
4759 #ifdef QT_MAC_USE_COCOA
4761 #else
4762  Q_UNUSED(isAlien);
4763  // We're not sure what the following call is supposed to achive
4764  // but until we see what it breaks, we don't bring it into the
4765  // Cocoa port:
4767 #endif
4768 
4769  // First move all native children. Alien children will indirectly be
4770  // moved when the parent is scrolled. All directly or indirectly moved
4771  // children will receive a move event before the function call returns.
4772  QWidgetList movedChildren;
4773  const QPoint scrollDelta(dx, dy);
4774  if (scrollChildren) {
4775  QObjectList children = q->children();
4776 
4777  for (int i=0; i<children.size(); i++) {
4778  QObject *obj = children.at(i);
4779  if (QWidget *w = qobject_cast<QWidget*>(obj)) {
4780  if (!w->isWindow()) {
4781  w->data->crect = QRect(w->pos() + scrollDelta, w->size());
4782 #ifndef QT_MAC_USE_COCOA
4783  if (w->testAttribute(Qt::WA_WState_Created)) {
4784  HIRect bounds = CGRectMake(w->data->crect.x(), w->data->crect.y(),
4785  w->data->crect.width(), w->data->crect.height());
4786  HIViewRef hiview = qt_mac_nativeview_for(w);
4787  const bool opaque = q->testAttribute(Qt::WA_OpaquePaintEvent);
4788 
4789  if (opaque)
4790  HIViewSetDrawingEnabled(hiview, false);
4791  HIViewSetFrame(hiview, &bounds);
4792  if (opaque)
4793  HIViewSetDrawingEnabled(hiview, true);
4794  }
4795 #else
4796  if (NSView *view = qt_mac_nativeview_for(w)) {
4797  // INVARIANT: w is not alien
4798  [view setFrame:NSMakeRect(
4799  w->data->crect.x(), w->data->crect.y(),
4800  w->data->crect.width(), w->data->crect.height())];
4801  }
4802 #endif
4803  movedChildren.append(w);
4804  }
4805  }
4806  }
4807  }
4808 
4809  if (q->testAttribute(Qt::WA_WState_Created) && q->isVisible()) {
4810  // Scroll q itself according to the qscrollRect, and
4811  // call update on any exposed areas so that they get redrawn:
4812 
4813 #ifndef QT_MAC_USE_COCOA
4814  OSViewRef view = qt_mac_nativeview_for(q);
4815  HIRect scrollrect = CGRectMake(qscrollRect.x(), qscrollRect.y(), qscrollRect.width(), qscrollRect.height());
4816  OSStatus err = _HIViewScrollRectWithOptions(view, qscrollRect.isValid() ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
4817  if (err) {
4818  // The only parameter that can go wrong, is the rect.
4819  qWarning("QWidget::scroll: Your rectangle was too big for the widget, clipping rect");
4820  scrollrect = CGRectMake(qMax(qscrollRect.x(), 0), qMax(qscrollRect.y(), 0),
4821  qMin(qscrollRect.width(), q->width()), qMin(qscrollRect.height(), q->height()));
4822  _HIViewScrollRectWithOptions(view, qscrollRect.isValid() ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
4823  }
4824 #else
4825 
4826  QWidget *nativeWidget = isAlien ? q->nativeParentWidget() : q;
4827  if (!nativeWidget)
4828  return;
4829  OSViewRef view = qt_mac_nativeview_for(nativeWidget);
4830  if (!view)
4831  return;
4832 
4833  // Calculate the rectangles that needs to be redrawn
4834  // after the scroll. This will be source rect minus destination rect:
4835  QRect deltaXRect;
4836  if (dx != 0) {
4837  deltaXRect.setY(validScrollRect.y());
4838  deltaXRect.setHeight(validScrollRect.height());
4839  if (dx > 0) {
4840  deltaXRect.setX(validScrollRect.x());
4841  deltaXRect.setWidth(dx);
4842  } else {
4843  deltaXRect.setX(validScrollRect.x() + validScrollRect.width() + dx);
4844  deltaXRect.setWidth(-dx);
4845  }
4846  }
4847 
4848  QRect deltaYRect;
4849  if (dy != 0) {
4850  deltaYRect.setX(validScrollRect.x());
4851  deltaYRect.setWidth(validScrollRect.width());
4852  if (dy > 0) {
4853  deltaYRect.setY(validScrollRect.y());
4854  deltaYRect.setHeight(dy);
4855  } else {
4856  deltaYRect.setY(validScrollRect.y() + validScrollRect.height() + dy);
4857  deltaYRect.setHeight(-dy);
4858  }
4859  }
4860 
4861  if (isAlien) {
4862  // Adjust the scroll rect to the location as seen from the native parent:
4863  QPoint scrollTopLeftInsideNative = nativeWidget->mapFromGlobal(q->mapToGlobal(validScrollRect.topLeft()));
4864  validScrollRect.moveTo(scrollTopLeftInsideNative);
4865  }
4866 
4867  // Make the pixel copy rect within the validScrollRect bounds:
4868  NSRect nsscrollRect = NSMakeRect(
4869  validScrollRect.x() + (dx < 0 ? -dx : 0),
4870  validScrollRect.y() + (dy < 0 ? -dy : 0),
4871  validScrollRect.width() + (dx > 0 ? -dx : 0),
4872  validScrollRect.height() + (dy > 0 ? -dy : 0));
4873 
4874  NSSize deltaSize = NSMakeSize(dx, dy);
4875  [view scrollRect:nsscrollRect by:deltaSize];
4876 
4877  // Some areas inside the scroll rect might have been marked as dirty from before, which
4878  // means that they are scheduled to be redrawn. But as we now scroll, those dirty rects
4879  // should also move along to ensure that q receives repaints on the correct places.
4880  // Since some of the dirty rects might lay outside, or only intersect with, the scroll
4881  // rect, the old calls to setNeedsDisplay still makes sense.
4882  // NB: Using [view translateRectsNeedingDisplayInRect:nsscrollRect by:deltaSize] have
4883  // so far not been proven fruitful to solve this problem.
4884  const QVector<QRect> &dirtyRectsToScroll = dirtyOnWidget.rects();
4885  for (int i=0; i<dirtyRectsToScroll.size(); ++i) {
4886  QRect qdirtyRect = dirtyRectsToScroll[i];
4887  qdirtyRect.translate(dx, dy);
4888  update_sys(qdirtyRect);
4889  }
4890 
4891  // Update newly exposed areas. This will generate new dirty areas on
4892  // q, and therefore, we do it after updating the old dirty rects above:
4893  if (dx != 0)
4894  update_sys(deltaXRect);
4895  if (dy != 0)
4896  update_sys(deltaYRect);
4897 
4898 #endif // QT_MAC_USE_COCOA
4899  }
4900 
4901  for (int i=0; i<movedChildren.size(); i++) {
4902  QWidget *w = movedChildren.at(i);
4903  QMoveEvent e(w->pos(), w->pos() - scrollDelta);
4904  QApplication::sendEvent(w, &e);
4905  }
4906 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QRect crect
Definition: qwidget.h:131
bool paintOnScreen() const
Definition: qwidget.cpp:2255
static bool delayScroll(QWidgetPrivate *target, int dx, int dy, const QRect &scrollRect)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
void moveTo(int x, int t)
Moves the rectangle, leaving the top-left corner at the given position (x, y).
Definition: qrect.h:334
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setY(int y)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:285
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void scrollChildren(int dx, int dy)
Definition: qwidget.cpp:421
QObjectList children
Definition: qobject.h:93
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
OSStatus _HIViewScrollRectWithOptions(HIViewRef, const HIRect *, CGFloat, CGFloat, OptionBits) __attribute__((weak))
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QWidget * nativeParentWidget() const
Returns the native parent for this widget, i.
Definition: qwidget.cpp:4514
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
struct OpaqueControlRef * HIViewRef
Q_CORE_EXPORT void qWarning(const char *,...)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
signed long OSStatus
void setX(int x)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:282
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
QPoint pos
the position of the widget within its parent widget
Definition: qwidget.h:163
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void scrollRect(const QRect &, int dx, int dy)
void qt_event_request_window_change(QWidget *)
void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
Definition: qwidget.cpp:2139
HIViewRef OSViewRef
static QGraphicsSystem * graphicsSystem()
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
bool isOverlapped(const QRect &) const
Definition: qwidget.cpp:1877
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
#define kHIViewScrollRectAdjustInvalid
Definition: qwidget_mac.mm:129
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ scrollChildren()

void QWidgetPrivate::scrollChildren ( int  dx,
int  dy 
)
Warning
This function is not part of the public interface.

Definition at line 421 of file qwidget.cpp.

Referenced by effectiveState(), qt_grab_cursor(), and scroll_sys().

422 {
423  Q_Q(QWidget);
424  if (q->children().size() > 0) { // scroll children
425  QPoint pd(dx, dy);
426  QObjectList childObjects = q->children();
427  for (int i = 0; i < childObjects.size(); ++i) { // move all children
428  QWidget *w = qobject_cast<QWidget*>(childObjects.at(i));
429  if (w && !w->isWindow()) {
430  QPoint oldp = w->pos();
431  QRect r(w->pos() + pd, w->size());
432  w->data->crect = r;
433 #ifndef Q_WS_QWS
435  w->d_func()->setWSGeometry();
436 #endif
437  w->d_func()->setDirtyOpaqueRegion();
438  QMoveEvent e(r.topLeft(), oldp);
440  }
441  }
442  }
443 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWidgetData * data
Definition: qwidget.h:815
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
QPoint pos
the position of the widget within its parent widget
Definition: qwidget.h:163
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ scrollRect()

void QWidgetPrivate::scrollRect ( const QRect rect,
int  dx,
int  dy 
)

Definition at line 1003 of file qbackingstore.cpp.

Referenced by effectiveState(), qt_grab_cursor(), qt_mac_update_widget_position(), and scroll_sys().

1004 {
1005  Q_Q(QWidget);
1006  QWidget *tlw = q->window();
1007  QTLWExtra* x = tlw->d_func()->topData();
1008  if (x->inTopLevelResize)
1009  return;
1010 
1012  if (!wbs)
1013  return;
1014 
1015  static int accelEnv = -1;
1016  if (accelEnv == -1) {
1017  accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
1018  }
1019 
1020  QRect scrollRect = rect & clipRect();
1021  bool overlapped = false;
1022  bool accelerateScroll = accelEnv && isOpaque
1023  && !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft())));
1024 
1025 #if defined(Q_WS_QWS)
1026  QWSWindowSurface *surface;
1027  surface = static_cast<QWSWindowSurface*>(wbs->windowSurface);
1028 
1029  if (accelerateScroll && !surface->isBuffered()) {
1030  const QRegion surfaceClip = surface->clipRegion();
1031  const QRegion outsideClip = QRegion(rect) - surfaceClip;
1032  if (!outsideClip.isEmpty()) {
1033  const QVector<QRect> clipped = (surfaceClip & rect).rects();
1034  if (clipped.size() < 8) {
1035  for (int i = 0; i < clipped.size(); ++i)
1036  this->scrollRect(clipped.at(i), dx, dy);
1037  return;
1038  } else {
1039  accelerateScroll = false;
1040  }
1041  }
1042  }
1043 #endif // Q_WS_QWS
1044 
1045  if (!accelerateScroll) {
1046  if (overlapped) {
1047  QRegion region(scrollRect);
1048  subtractOpaqueSiblings(region);
1049  invalidateBuffer(region);
1050  }else {
1051  invalidateBuffer(scrollRect);
1052  }
1053  } else {
1054  const QPoint toplevelOffset = q->mapTo(tlw, QPoint());
1055 #ifdef Q_WS_QWS
1056  QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface);
1057  const QRegion clip = surface->clipRegion().translated(-toplevelOffset) & scrollRect;
1058  const QRect clipBoundingRect = clip.boundingRect();
1059  scrollRect &= clipBoundingRect;
1060 #endif
1061  const QRect destRect = scrollRect.translated(dx, dy) & scrollRect;
1062  const QRect sourceRect = destRect.translated(-dx, -dy);
1063 
1064  QRegion childExpose(scrollRect);
1065  if (sourceRect.isValid()) {
1066  if (wbs->bltRect(sourceRect, dx, dy, q))
1067  childExpose -= destRect;
1068  }
1069 
1070  if (inDirtyList) {
1071  if (rect == q->rect()) {
1072  dirty.translate(dx, dy);
1073  } else {
1074  QRegion dirtyScrollRegion = dirty.intersected(scrollRect);
1075  if (!dirtyScrollRegion.isEmpty()) {
1076  dirty -= dirtyScrollRegion;
1077  dirtyScrollRegion.translate(dx, dy);
1078  dirty += dirtyScrollRegion;
1079  }
1080  }
1081  }
1082 
1083  if (!q->updatesEnabled())
1084  return;
1085 
1086  if (!childExpose.isEmpty()) {
1087  wbs->markDirty(childExpose, q);
1088  isScrolled = true;
1089  }
1090 
1091  // Instead of using native scroll-on-screen, we copy from
1092  // backingstore, giving only one screen update for each
1093  // scroll, and a solid appearance
1094  wbs->markDirtyOnScreen(destRect, q, toplevelOffset);
1095  }
1096 }
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QRegion intersected(const QRegion &r) const
Returns a region which is the intersection of this region and r.
Definition: qregion.h:112
const QRegion clipRegion() const
Returns the region currently visible on the screen.
QRegion dirty
Definition: qwidget_p.h:726
QRect crect
Definition: qwidget.h:131
QWindowSurface * windowSurface
QRect clipRect() const
Definition: qwidget.cpp:1997
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
uint inTopLevelResize
Definition: qwidget_p.h:188
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset)
Marks the region of the widget as dirty on screen.
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately=false, bool invalidateBuffer=false)
Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest e...
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
uint inDirtyList
Definition: qwidget_p.h:772
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
QWidgetBackingStore * data()
Definition: qwidget_p.h:132
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void scrollRect(const QRect &, int dx, int dy)
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
Definition: qwidget.cpp:2139
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
bool isOverlapped(const QRect &) const
Definition: qwidget.cpp:1877
bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget)
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ sendPendingMoveAndResizeEvents()

void QWidgetPrivate::sendPendingMoveAndResizeEvents ( bool  recursive = false,
bool  disableUpdates = false 
)

Definition at line 7720 of file qwidget.cpp.

7721 {
7722  Q_Q(QWidget);
7723 
7724  disableUpdates = disableUpdates && q->updatesEnabled();
7725  if (disableUpdates)
7726  q->setAttribute(Qt::WA_UpdatesDisabled);
7727 
7728  if (q->testAttribute(Qt::WA_PendingMoveEvent)) {
7730  QApplication::sendEvent(q, &e);
7731  q->setAttribute(Qt::WA_PendingMoveEvent, false);
7732  }
7733 
7734  if (q->testAttribute(Qt::WA_PendingResizeEvent)) {
7735  QResizeEvent e(data.crect.size(), QSize());
7736  QApplication::sendEvent(q, &e);
7737  q->setAttribute(Qt::WA_PendingResizeEvent, false);
7738  }
7739 
7740  if (disableUpdates)
7741  q->setAttribute(Qt::WA_UpdatesDisabled, false);
7742 
7743  if (!recursive)
7744  return;
7745 
7746  for (int i = 0; i < children.size(); ++i) {
7747  if (QWidget *child = qobject_cast<QWidget *>(children.at(i)))
7748  child->d_func()->sendPendingMoveAndResizeEvents(recursive, disableUpdates);
7749  }
7750 }
QRect crect
Definition: qwidget.h:131
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ sendStartupMessage()

void QWidgetPrivate::sendStartupMessage ( const char *  message) const

Platform-specific part of QWidget::show().

Warning
This function is not part of the public interface.

Definition at line 2126 of file qwidget_x11.cpp.

2127 {
2128  Q_Q(const QWidget);
2129 
2130  if (!message)
2131  return;
2132 
2133  XEvent xevent;
2134  xevent.xclient.type = ClientMessage;
2135  xevent.xclient.message_type = ATOM(_NET_STARTUP_INFO_BEGIN);
2136  xevent.xclient.display = X11->display;
2137  xevent.xclient.window = q->internalWinId();
2138  xevent.xclient.format = 8;
2139 
2140  Window rootWindow = RootWindow(X11->display, DefaultScreen(X11->display));
2141  uint sent = 0;
2142  uint length = strlen(message) + 1;
2143  do {
2144  if (sent == 20)
2145  xevent.xclient.message_type = ATOM(_NET_STARTUP_INFO);
2146 
2147  for (uint i = 0; i < 20 && i + sent <= length; i++)
2148  xevent.xclient.data.b[i] = message[i + sent++];
2149 
2150  XSendEvent(X11->display, rootWindow, false, PropertyChangeMask, &xevent);
2151  } while (sent <= length);
2152 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
union _XEvent XEvent
Definition: qwindowdefs.h:116
#define ATOM(x)
Definition: qt_x11_p.h:723
unsigned int uint
Definition: qglobal.h:996

◆ setConstraints_sys()

void QWidgetPrivate::setConstraints_sys ( )

Definition at line 4646 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), and qt_grab_cursor().

4647 {
4648  updateMaximizeButton_sys();
4649  applyMaxAndMinSizeOnWindow();
4650 }

◆ setCursor_sys()

void QWidgetPrivate::setCursor_sys ( const QCursor cursor)

Definition at line 3163 of file qwidget_mac.mm.

Referenced by isServerProcess(), mapFromGlobal(), and q_createNativeChildrenAndSetParent().

3164 {
3166 }
void qt_mac_update_cursor()
Definition: qcursor_mac.mm:201

◆ setDirtyOpaqueRegion()

void QWidgetPrivate::setDirtyOpaqueRegion ( )

Definition at line 2075 of file qwidget.cpp.

Referenced by effectiveState(), and setDirtyOpaqueRegion().

2076 {
2077  Q_Q(QWidget);
2078 
2079  dirtyOpaqueChildren = true;
2080 
2081 #ifndef QT_NO_GRAPHICSEFFECT
2083 #endif //QT_NO_GRAPHICSEFFECT
2084 
2085  if (q->isWindow())
2086  return;
2087 
2088  QWidget *parent = q->parentWidget();
2089  if (!parent)
2090  return;
2091 
2092  // TODO: instead of setting dirtyflag, manipulate the dirtyregion directly?
2093  QWidgetPrivate *pd = parent->d_func();
2094  if (!pd->dirtyOpaqueChildren)
2095  pd->setDirtyOpaqueRegion();
2096 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void invalidateGraphicsEffectsRecursively()
Definition: qwidget.cpp:2059
#define Q_Q(Class)
Definition: qglobal.h:2483
void setDirtyOpaqueRegion()
Definition: qwidget.cpp:2075
uint dirtyOpaqueChildren
Definition: qwidget_p.h:770
QObject * parent
Definition: qobject.h:92

◆ setEnabled_helper()

void QWidgetPrivate::setEnabled_helper ( bool  enable)

Definition at line 3454 of file qwidget.cpp.

3455 {
3456  Q_Q(QWidget);
3457 
3458  if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->isEnabled())
3459  return; // nothing we can do
3460 
3461  if (enable != q->testAttribute(Qt::WA_Disabled))
3462  return; // nothing to do
3463 
3464  q->setAttribute(Qt::WA_Disabled, !enable);
3466 
3467  if (!enable && q->window()->focusWidget() == q) {
3468  bool parentIsEnabled = (!q->parentWidget() || q->parentWidget()->isEnabled());
3469  if (!parentIsEnabled || !q->focusNextChild())
3470  q->clearFocus();
3471  }
3472 
3474  for (int i = 0; i < children.size(); ++i) {
3475  QWidget *w = qobject_cast<QWidget *>(children.at(i));
3476  if (w && !w->testAttribute(attribute))
3477  w->d_func()->setEnabled_helper(enable);
3478  }
3479 #if defined(Q_WS_X11)
3480  if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
3481  // enforce the windows behavior of clearing the cursor on
3482  // disabled widgets
3484  }
3485 #endif
3486 #if defined(Q_WS_MAC)
3487  setEnabled_helper_sys(enable);
3488 #endif
3489 #ifndef QT_NO_IM
3490  if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {
3491  QWidget *focusWidget = effectiveFocusWidget();
3492  QInputContext *qic = focusWidget->d_func()->inputContext();
3493  if (enable) {
3494  if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
3495  qic->setFocusWidget(focusWidget);
3496  } else {
3497  qic->reset();
3498  qic->setFocusWidget(0);
3499  }
3500  }
3501 #endif //QT_NO_IM
3503  QApplication::sendEvent(q, &e);
3504 #ifdef QT3_SUPPORT
3505  q->enabledChange(!enable); // compatibility
3506 #endif
3507 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * effectiveFocusWidget()
Definition: qwidget_p.h:587
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void qt_x11_enforce_cursor(QWidget *w, bool force)
Update the X11 cursor of the widget w.
WidgetAttribute
Definition: qnamespace.h:376
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QInputContext * inputContext()
This function returns the QInputContext for this widget.
Definition: qwidget.cpp:474
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
virtual void reset()=0
This function can be reimplemented in a subclass to reset the state of the input method.
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
void updateSystemBackground()
virtual void setFocusWidget(QWidget *w)
Sets the widget that has an input focus for this input context.
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ setFocus_sys()

void QWidgetPrivate::setFocus_sys ( )

Definition at line 3913 of file qwidget_mac.mm.

Referenced by create_sys(), effectiveState(), qt_grab_cursor(), setNetWmWindowTypes(), and show_sys().

3914 {
3915  Q_Q(QWidget);
3916  if (q->testAttribute(Qt::WA_WState_Created)) {
3917 #ifdef QT_MAC_USE_COCOA
3919  NSView *view = qt_mac_effectiveview_for(q);
3920  [[view window] makeFirstResponder:view];
3921 #else
3922  SetKeyboardFocus(qt_mac_window_for(q), qt_mac_nativeview_for(q), 1);
3923 #endif
3924  }
3925 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
NSWindow * window
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
Q_GUI_EXPORT OSViewRef qt_mac_effectiveview_for(const QWidget *w)
Definition: qwidget_mac.mm:424

◆ setFont_helper()

void QWidgetPrivate::setFont_helper ( const QFont font)
inline

Definition at line 436 of file qwidget_p.h.

436  {
437  if (data.fnt == font && data.fnt.resolve() == font.resolve())
438  return;
439  updateFont(font);
440  }
QFont fnt
Definition: qwidget.h:133
QWidgetData data
Definition: qwidget_p.h:755
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
void updateFont(const QFont &)
Assign font to this widget, and propagate it to all children, except style sheet widgets (handled dif...
Definition: qwidget.cpp:5093

◆ setGeometry_sys()

void QWidgetPrivate::setGeometry_sys ( int  x,
int  y,
int  w,
int  h,
bool  isMove 
)

Definition at line 4495 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), and qt_grab_cursor().

4496 {
4497  Q_Q(QWidget);
4498  Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
4499 
4500  if(q->windowType() == Qt::Desktop)
4501  return;
4502 
4504  bool realWindow = isRealWindow();
4505 
4506  if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)){
4507  adjustWithinMaxAndMinSize(w, h);
4508 #ifndef QT_MAC_USE_COCOA
4509  if (w != 0 && h != 0) {
4510  topData()->isSetGeometry = 1;
4511  topData()->isMove = isMove;
4512  Rect r; SetRect(&r, x, y, x + w, y + h);
4513  SetWindowBounds(qt_mac_window_for(q), kWindowContentRgn, &r);
4514  topData()->isSetGeometry = 0;
4515  } else {
4516  setGeometry_sys_helper(x, y, w, h, isMove);
4517  }
4518 #else
4519  if (!isMove && !q->testAttribute(Qt::WA_Moved) && !q->isVisible()) {
4520  // INVARIANT: The location of the window has not yet been set. The default will
4521  // instead be to center it on the desktop, or over the parent, if any. Since we now
4522  // resize the window, we need to adjust the top left position to keep the window
4523  // centeralized. And we need to to this now (and before show) in case the positioning
4524  // of other windows (e.g. sub-windows) depend on this position:
4525  if (QWidget *p = q->parentWidget()) {
4526  x = p->geometry().center().x() - (w / 2);
4527  y = p->geometry().center().y() - (h / 2);
4528  } else {
4530  x = availGeo.center().x() - (w / 2);
4531  y = availGeo.center().y() - (h / 2);
4532  }
4533  }
4534 
4535  QSize olds = q->size();
4536  const bool isResize = (olds != QSize(w, h));
4537  NSWindow *window = qt_mac_window_for(q);
4538  const QRect &fStrut = frameStrut();
4539  const QRect frameRect(QPoint(x - fStrut.left(), y - fStrut.top()),
4540  QSize(fStrut.left() + fStrut.right() + w,
4541  fStrut.top() + fStrut.bottom() + h));
4542  NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1),
4543  frameRect.width(), frameRect.height());
4544  // The setFrame call will trigger a 'windowDidResize' notification for the corresponding
4545  // NSWindow. The pending flag is set, so that the resize event can be send as non-spontaneous.
4546  if (isResize)
4547  q->setAttribute(Qt::WA_PendingResizeEvent);
4548  QPoint currTopLeft = data.crect.topLeft();
4549  if (currTopLeft.x() == x && currTopLeft.y() == y
4550  && cocoaFrameRect.size.width != 0
4551  && cocoaFrameRect.size.height != 0) {
4552  [window setFrame:cocoaFrameRect display:realWindow];
4553  } else {
4554  // The window is moved and resized (or resized to zero).
4555  // Since Cocoa usually only sends us a resize callback after
4556  // setting a window frame, we issue an explicit move as
4557  // well. To stop Cocoa from optimize away the move (since the move
4558  // would have the same origin as the setFrame call) we shift the
4559  // window back and forth inbetween.
4560  cocoaFrameRect.origin.y += 1;
4561  [window setFrame:cocoaFrameRect display:realWindow];
4562  cocoaFrameRect.origin.y -= 1;
4563  [window setFrameOrigin:cocoaFrameRect.origin];
4564  }
4565 #endif
4566  } else {
4567  setGeometry_sys_helper(x, y, w, h, isMove);
4568  }
4569 
4570  topLevelAt_cache = 0;
4571 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QRect crect
Definition: qwidget.h:131
int flipYCoordinate(int y)
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
NSWindow * window
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QRect frameStrut() const
Definition: qwidget.cpp:12607
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
const QRect availableGeometry(int screen=-1) const
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ setLayoutDirection_helper()

void QWidgetPrivate::setLayoutDirection_helper ( Qt::LayoutDirection  direction)

Definition at line 5153 of file qwidget.cpp.

Referenced by QMenuPrivate::updateLayoutDirection().

5154 {
5155  Q_Q(QWidget);
5156 
5157  if ( (direction == Qt::RightToLeft) == q->testAttribute(Qt::WA_RightToLeft))
5158  return;
5159  q->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft));
5160  if (!children.isEmpty()) {
5161  for (int i = 0; i < children.size(); ++i) {
5162  QWidget *w = qobject_cast<QWidget*>(children.at(i));
5163  if (w && !w->isWindow() && !w->testAttribute(Qt::WA_SetLayoutDirection))
5164  w->d_func()->setLayoutDirection_helper(direction);
5165  }
5166  }
5168  QApplication::sendEvent(q, &e);
5169 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Qt::LayoutDirection direction

◆ setLayoutItemMargins() [1/2]

void QWidgetPrivate::setLayoutItemMargins ( int  left,
int  top,
int  right,
int  bottom 
)

Definition at line 12860 of file qwidget.cpp.

Referenced by QRadioButtonPrivate::init(), QCheckBoxPrivate::init(), QSpinBoxPrivate::init(), QFramePrivate::init(), QDateTimeEditPrivate::init(), QDialogButtonBoxPrivate::initLayout(), QProgressBarPrivate::resetLayoutItemMargins(), and QSliderPrivate::resetLayoutItemMargins().

12861 {
12862  if (leftLayoutItemMargin == left
12863  && topLayoutItemMargin == top
12865  && bottomLayoutItemMargin == bottom)
12866  return;
12867 
12868  Q_Q(QWidget);
12869  leftLayoutItemMargin = (signed char)left;
12870  topLayoutItemMargin = (signed char)top;
12871  rightLayoutItemMargin = (signed char)right;
12872  bottomLayoutItemMargin = (signed char)bottom;
12873  q->updateGeometry();
12874 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
signed char topLayoutItemMargin
Definition: qwidget_p.h:749
signed char bottomLayoutItemMargin
Definition: qwidget_p.h:751
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
#define Q_Q(Class)
Definition: qglobal.h:2483
signed char rightLayoutItemMargin
Definition: qwidget_p.h:750
signed char leftLayoutItemMargin
Definition: qwidget_p.h:748
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ setLayoutItemMargins() [2/2]

void QWidgetPrivate::setLayoutItemMargins ( QStyle::SubElement  element,
const QStyleOption opt = 0 
)

Definition at line 12876 of file qwidget.cpp.

12877 {
12878  Q_Q(QWidget);
12879  QStyleOption myOpt;
12880  if (!opt) {
12881  myOpt.initFrom(q);
12882  myOpt.rect.setRect(0, 0, 32768, 32768); // arbitrary
12883  opt = &myOpt;
12884  }
12885 
12886  QRect liRect = q->style()->subElementRect(element, opt, q);
12887  if (liRect.isValid()) {
12888  leftLayoutItemMargin = (signed char)(opt->rect.left() - liRect.left());
12889  topLayoutItemMargin = (signed char)(opt->rect.top() - liRect.top());
12890  rightLayoutItemMargin = (signed char)(liRect.right() - opt->rect.right());
12891  bottomLayoutItemMargin = (signed char)(liRect.bottom() - opt->rect.bottom());
12892  } else {
12894  topLayoutItemMargin = 0;
12897  }
12898 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
signed char topLayoutItemMargin
Definition: qwidget_p.h:749
signed char bottomLayoutItemMargin
Definition: qwidget_p.h:751
#define Q_Q(Class)
Definition: qglobal.h:2483
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
signed char rightLayoutItemMargin
Definition: qwidget_p.h:750
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
signed char leftLayoutItemMargin
Definition: qwidget_p.h:748
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ setLocale_helper()

void QWidgetPrivate::setLocale_helper ( const QLocale l,
bool  forceUpdate = false 
)

Definition at line 6128 of file qwidget.cpp.

Referenced by QtWndProc().

6129 {
6130  Q_Q(QWidget);
6131  if (locale == loc && !forceUpdate)
6132  return;
6133 
6134  locale = loc;
6135 
6136  if (!children.isEmpty()) {
6137  for (int i = 0; i < children.size(); ++i) {
6138  QWidget *w = qobject_cast<QWidget*>(children.at(i));
6139  if (!w)
6140  continue;
6142  continue;
6144  continue;
6145  w->d_func()->setLocale_helper(loc, forceUpdate);
6146  }
6147  }
6149  QApplication::sendEvent(q, &e);
6150 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QLocale locale
Definition: qwidget_p.h:757
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ setMask_sys()

void QWidgetPrivate::setMask_sys ( const QRegion region)

Definition at line 5076 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), qt_grab_cursor(), and qt_tablet_cleanup_wce().

5077 {
5078  Q_UNUSED(region);
5079  Q_Q(QWidget);
5080 
5081 #ifndef QT_MAC_USE_COCOA
5082  if (q->isWindow())
5083  ReshapeCustomWindow(qt_mac_window_for(q));
5084  else
5085  HIViewReshapeStructure(qt_mac_nativeview_for(q));
5086 #else
5087  if (!q->internalWinId())
5088  return;
5089 
5090  if (extra->mask.isEmpty()) {
5091  extra->maskBits = QImage();
5092  finishCocoaMaskSetup();
5093  } else {
5094  syncCocoaMask();
5095  }
5096 
5097  topLevelAt_cache = 0;
5098 #endif
5099 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
QRegion mask
Definition: qwidget_p.h:260
QWExtra * extra
Definition: qwidget_p.h:700
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setMaximumSize_helper()

bool QWidgetPrivate::setMaximumSize_helper ( int &  maxw,
int &  maxh 
)

Definition at line 4163 of file qwidget.cpp.

4164 {
4165  Q_Q(QWidget);
4166  if (maxw > QWIDGETSIZE_MAX || maxh > QWIDGETSIZE_MAX) {
4167  qWarning("QWidget::setMaximumSize: (%s/%s) "
4168  "The largest allowed size is (%d,%d)",
4169  q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX,
4170  QWIDGETSIZE_MAX);
4171  maxw = qMin<int>(maxw, QWIDGETSIZE_MAX);
4172  maxh = qMin<int>(maxh, QWIDGETSIZE_MAX);
4173  }
4174  if (maxw < 0 || maxh < 0) {
4175  qWarning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
4176  "are not possible",
4177  q->objectName().toLocal8Bit().data(), q->metaObject()->className(), maxw, maxh);
4178  maxw = qMax(maxw, 0);
4179  maxh = qMax(maxh, 0);
4180  }
4181  createExtra();
4182  if (extra->maxw == maxw && extra->maxh == maxh)
4183  return false;
4184  extra->maxw = maxw;
4185  extra->maxh = maxh;
4187  (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
4188  return true;
4189 }
#define QWIDGETSIZE_MAX
Defines the maximum size for a QWidget object.
Definition: qwidget.h:1087
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
qint32 maxw
Definition: qwidget_p.h:266
qint32 maxh
Definition: qwidget_p.h:267
Q_CORE_EXPORT void qWarning(const char *,...)
uint explicitMaxSize
Definition: qwidget_p.h:274
QWExtra * extra
Definition: qwidget_p.h:700

◆ setMinimumSize_helper()

bool QWidgetPrivate::setMinimumSize_helper ( int &  minw,
int &  minh 
)

Definition at line 4081 of file qwidget.cpp.

4082 {
4083  Q_Q(QWidget);
4084 
4085 #ifdef Q_WS_QWS
4086  if (q->isWindow()) {
4087  const QRect maxWindowRect = QApplication::desktop()->availableGeometry(QApplication::desktop()->screenNumber(q));
4088  if (!maxWindowRect.isEmpty()) {
4089  // ### This is really just a work-around. Layout shouldn't be
4090  // asking for minimum sizes bigger than the screen.
4091  if (minw > maxWindowRect.width())
4092  minw = maxWindowRect.width();
4093  if (minh > maxWindowRect.height())
4094  minh = maxWindowRect.height();
4095  }
4096  }
4097 #endif
4098  int mw = minw, mh = minh;
4099  if (mw == QWIDGETSIZE_MAX)
4100  mw = 0;
4101  if (mh == QWIDGETSIZE_MAX)
4102  mh = 0;
4103  if (minw > QWIDGETSIZE_MAX || minh > QWIDGETSIZE_MAX) {
4104  qWarning("QWidget::setMinimumSize: (%s/%s) "
4105  "The largest allowed size is (%d,%d)",
4106  q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX,
4107  QWIDGETSIZE_MAX);
4108  minw = mw = qMin<int>(minw, QWIDGETSIZE_MAX);
4109  minh = mh = qMin<int>(minh, QWIDGETSIZE_MAX);
4110  }
4111  if (minw < 0 || minh < 0) {
4112  qWarning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
4113  "are not possible",
4114  q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh);
4115  minw = mw = qMax(minw, 0);
4116  minh = mh = qMax(minh, 0);
4117  }
4118  createExtra();
4119  if (extra->minw == mw && extra->minh == mh)
4120  return false;
4121  extra->minw = mw;
4122  extra->minh = mh;
4123  extra->explicitMinSize = (mw ? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
4124  return true;
4125 }
#define QWIDGETSIZE_MAX
Defines the maximum size for a QWidget object.
Definition: qwidget.h:1087
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
qint32 minw
Definition: qwidget_p.h:264
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
Q_CORE_EXPORT void qWarning(const char *,...)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
qint32 minh
Definition: qwidget_p.h:265
const QRect availableGeometry(int screen=-1) const
uint explicitMinSize
Definition: qwidget_p.h:273

◆ setModal_sys()

void QWidgetPrivate::setModal_sys ( )

Definition at line 5201 of file qwidget_mac.mm.

Referenced by effectiveState(), QX11Data::getSolidFill(), and show_sys().

5202 {
5203  Q_Q(QWidget);
5204  if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow())
5205  return;
5206  const QWidget * const windowParent = q->window()->parentWidget();
5207  const QWidget * const primaryWindow = windowParent ? windowParent->window() : 0;
5208  OSWindowRef windowRef = qt_mac_window_for(q);
5209 
5210 #ifdef QT_MAC_USE_COCOA
5212  bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask;
5213 
5214  if (windowParent && q->windowModality() == Qt::WindowModal){
5215  // INVARIANT: Window should be window-modal (which implies a sheet).
5216  if (!alreadySheet) {
5217  // NB: the following call will call setModal_sys recursivly:
5218  recreateMacWindow();
5219  windowRef = qt_mac_window_for(q);
5220  }
5221  if ([windowRef isKindOfClass:[NSPanel class]]){
5222  // If the primary window of the sheet parent is a child of a modal dialog,
5223  // the sheet parent should not be modally shaddowed.
5224  // This goes for the sheet as well:
5225  OSWindowRef ref = primaryWindow ? qt_mac_window_for(primaryWindow) : 0;
5226  bool isDialog = ref ? [ref isKindOfClass:[NSPanel class]] : false;
5227  bool worksWhenModal = isDialog ? [static_cast<NSPanel *>(ref) worksWhenModal] : false;
5228  if (worksWhenModal)
5229  [static_cast<NSPanel *>(windowRef) setWorksWhenModal:YES];
5230  }
5231  } else {
5232  // INVARIANT: Window shold _not_ be window-modal (and as such, not a sheet).
5233  if (alreadySheet){
5234  // NB: the following call will call setModal_sys recursivly:
5235  recreateMacWindow();
5236  windowRef = qt_mac_window_for(q);
5237  }
5238  if (q->windowModality() == Qt::NonModal
5239  && primaryWindow && primaryWindow->windowModality() == Qt::ApplicationModal) {
5240  // INVARIANT: Our window has a parent that is application modal.
5241  // This means that q is supposed to be on top of this window and
5242  // not be modally shaddowed:
5243  if ([windowRef isKindOfClass:[NSPanel class]])
5244  [static_cast<NSPanel *>(windowRef) setWorksWhenModal:YES];
5245  }
5246  }
5247 
5248 #else
5249  const bool primaryWindowModal = primaryWindow ? primaryWindow->testAttribute(Qt::WA_ShowModal) : false;
5250  const bool modal = q->testAttribute(Qt::WA_ShowModal);
5251 
5252  WindowClass old_wclass;
5253  GetWindowClass(windowRef, &old_wclass);
5254 
5255  if (modal || primaryWindowModal) {
5256  if (q->windowModality() == Qt::WindowModal
5257  || (primaryWindow && primaryWindow->windowModality() == Qt::WindowModal)){
5258  // Window should be window-modal (which implies a sheet).
5259  if (old_wclass != kSheetWindowClass){
5260  // We cannot convert a created window to a sheet.
5261  // So we recreate the window:
5262  recreateMacWindow();
5263  return;
5264  }
5265  } else {
5266  // Window should be application-modal (which implies NOT using a sheet).
5267  if (old_wclass == kSheetWindowClass){
5268  // We cannot convert a sheet to a window.
5269  // So we recreate the window:
5270  recreateMacWindow();
5271  return;
5272  } else if (!(q->data->window_flags & Qt::CustomizeWindowHint)) {
5273  if (old_wclass == kDocumentWindowClass || old_wclass == kFloatingWindowClass || old_wclass == kUtilityWindowClass){
5274  // Only change the class to kMovableModalWindowClass if the no explicit jewels
5275  // are set (kMovableModalWindowClass can't contain them), and the current window class
5276  // can be converted to modal (according to carbon doc). Mind the order of
5277  // HIWindowChangeClass and ChangeWindowAttributes.
5278  WindowGroupRef group = GetWindowGroup(windowRef);
5279  HIWindowChangeClass(windowRef, kMovableModalWindowClass);
5280  quint32 tmpWattr = kWindowCloseBoxAttribute | kWindowHorizontalZoomAttribute;
5281  ChangeWindowAttributes(windowRef, tmpWattr, kWindowNoAttributes);
5282  ChangeWindowAttributes(windowRef, kWindowNoAttributes, tmpWattr);
5283  // If the window belongs to a qt-created group, set that group once more:
5285  || q->windowType() == Qt::Popup
5286  || q->windowType() == Qt::ToolTip)
5287  SetWindowGroup(windowRef, group);
5288  }
5289  // Popups are usually handled "special" and are never modal.
5290  Qt::WindowType winType = q->windowType();
5291  if (winType != Qt::Popup && winType != Qt::ToolTip)
5292  SetWindowModality(windowRef, kWindowModalityAppModal, 0);
5293  }
5294  }
5295  } else if (windowRef) {
5296  if (old_wclass == kSheetWindowClass){
5297  // Converting a sheet to a window is complex. It's easier to recreate:
5298  recreateMacWindow();
5299  return;
5300  }
5301 
5302  SetWindowModality(windowRef, kWindowModalityNone, 0);
5303  if (!(q->data->window_flags & Qt::CustomizeWindowHint)) {
5304  if (q->window()->d_func()->topData()->wattr |= kWindowCloseBoxAttribute)
5305  ChangeWindowAttributes(windowRef, kWindowCloseBoxAttribute, kWindowNoAttributes);
5306  if (q->window()->d_func()->topData()->wattr |= kWindowHorizontalZoomAttribute)
5307  ChangeWindowAttributes(windowRef, kWindowHorizontalZoomAttribute, kWindowNoAttributes);
5308  if (q->window()->d_func()->topData()->wattr |= kWindowCollapseBoxAttribute)
5309  ChangeWindowAttributes(windowRef, kWindowCollapseBoxAttribute, kWindowNoAttributes);
5310  }
5311 
5312  WindowClass newClass = q->window()->d_func()->topData()->wclass;
5313  if (old_wclass != newClass && newClass != 0){
5314  WindowGroupRef group = GetWindowGroup(windowRef);
5315  HIWindowChangeClass(windowRef, newClass);
5316  // If the window belongs to a qt-created group, set that group once more:
5318  || q->windowType() == Qt::Popup
5319  || q->windowType() == Qt::ToolTip)
5320  SetWindowGroup(windowRef, group);
5321  }
5322  }
5323 
5324  // Make sure that HIWindowChangeClass didn't remove drag support
5325  // or reset the opaque size grip setting:
5326  SetAutomaticControlDragTrackingEnabledForWindow(windowRef, true);
5327  macUpdateOpaqueSizeGrip();
5328 #endif
5329 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
WindowType
Definition: qnamespace.h:270
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
WindowRef OSWindowRef
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
Qt::WindowFlags window_flags
Definition: qwidget.h:119
Qt::WindowModality windowModality
which windows are blocked by the modal widget
Definition: qwidget.h:156
unsigned int quint32
Definition: qglobal.h:938
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool modal
Definition: qmenu_mac.mm:99

◆ setNetWmWindowTypes()

void QWidgetPrivate::setNetWmWindowTypes ( )

Definition at line 2154 of file qwidget_x11.cpp.

2155 {
2156  Q_Q(QWidget);
2157  Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
2158 
2159  if (!q->isWindow()) {
2160  if (q->internalWinId())
2161  XDeleteProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_WINDOW_TYPE));
2162  return;
2163  }
2164 
2165  QVector<long> windowTypes;
2166 
2167  // manual selection 1 (these are never set by Qt and take precedence)
2168  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDesktop))
2169  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_DESKTOP));
2170  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDock))
2171  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_DOCK));
2172  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeNotification))
2174 
2175  // manual selection 2 (Qt uses these during auto selection);
2176  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeUtility))
2177  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_UTILITY));
2178  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeSplash))
2179  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_SPLASH));
2180  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDialog))
2181  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_DIALOG));
2182  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolTip))
2183  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_TOOLTIP));
2184 
2185  // manual selection 3 (these can be set by Qt, but don't have a
2186  // corresponding Qt::WindowType). note that order of the *MENU
2187  // atoms is important
2188  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeMenu))
2189  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_MENU));
2190  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu))
2192  if (q->testAttribute(Qt::WA_X11NetWmWindowTypePopupMenu))
2194  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolBar))
2195  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_TOOLBAR));
2196  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeCombo))
2197  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_COMBO));
2198  if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDND))
2199  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_DND));
2200 
2201  // automatic selection
2202  switch (q->windowType()) {
2203  case Qt::Dialog:
2204  case Qt::Sheet:
2205  // dialog netwm type
2206  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_DIALOG));
2207  break;
2208 
2209  case Qt::Tool:
2210  case Qt::Drawer:
2211  // utility netwm type
2212  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_UTILITY));
2213  break;
2214 
2215  case Qt::ToolTip:
2216  // tooltip netwm type
2217  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_TOOLTIP));
2218  break;
2219 
2220  case Qt::SplashScreen:
2221  // splash netwm type
2222  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_SPLASH));
2223  break;
2224 
2225  default:
2226  break;
2227  }
2228 
2229  if (q->windowFlags() & Qt::FramelessWindowHint) {
2230  // override netwm type - quick and easy for KDE noborder
2232  }
2233 
2234  // normal netwm type - default
2235  windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_NORMAL));
2236 
2237  if (!windowTypes.isEmpty()) {
2238  XChangeProperty(X11->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE), XA_ATOM, 32,
2239  PropModeReplace, (unsigned char *) windowTypes.constData(),
2240  windowTypes.count());
2241  } else {
2242  XDeleteProperty(X11->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE));
2243  }
2244 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
#define ATOM(x)
Definition: qt_x11_p.h:723
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154

◆ setOpaque()

void QWidgetPrivate::setOpaque ( bool  opaque)

Definition at line 2337 of file qwidget.cpp.

Referenced by setWindowOpacity_sys(), and updateRedirectedToGraphicsProxyWidget().

2338 {
2339  if (isOpaque == opaque)
2340  return;
2341  isOpaque = opaque;
2342 #ifdef Q_WS_MAC
2343  macUpdateIsOpaque();
2344 #endif
2345 #ifdef Q_WS_X11
2347 #endif
2348 #ifdef Q_WS_WIN
2349  winUpdateIsOpaque();
2350 #endif
2351 #ifdef Q_OS_SYMBIAN
2352  s60UpdateIsOpaque();
2353 #endif
2354 }
void x11UpdateIsOpaque()

◆ setPalette_helper()

void QWidgetPrivate::setPalette_helper ( const QPalette palette)

Definition at line 4934 of file qwidget.cpp.

4935 {
4936  Q_Q(QWidget);
4937  if (data.pal == palette && data.pal.resolve() == palette.resolve())
4938  return;
4939  data.pal = palette;
4942  updateIsOpaque();
4943  q->update();
4944  updateIsOpaque();
4945 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void updateIsOpaque()
Definition: qwidget.cpp:2272
QPalette pal
Definition: qwidget.h:132
void updateSystemBackground()
void propagatePaletteChange()
Propagate this widget&#39;s palette to all children, except style sheet widgets, and windows that don&#39;t e...
Definition: qwidget.cpp:1963
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
Definition: qpalette.cpp:1101

◆ setParent_sys()

void QWidgetPrivate::setParent_sys ( QWidget parent,
Qt::WindowFlags  f 
)

Definition at line 2934 of file qwidget_mac.mm.

Referenced by isBackgroundInherited(), isServerProcess(), and q_createNativeChildrenAndSetParent().

2935 {
2936  Q_Q(QWidget);
2939  bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
2940 #ifdef QT_MAC_USE_COCOA
2941  bool wasWindow = q->isWindow();
2942 #endif
2943  OSViewRef old_id = 0;
2944 
2945  if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
2946  q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
2947 
2948  // Maintain the glWidgets list on parent change: remove "our" gl widgets
2949  // from the list on the old parent and grandparents.
2950  if (glWidgets.isEmpty() == false) {
2951  QWidget *current = q->parentWidget();
2952  while (current) {
2953  for (QList<QWidgetPrivate::GlWidgetInfo>::const_iterator it = glWidgets.constBegin();
2954  it != glWidgets.constEnd(); ++it)
2955  current->d_func()->glWidgets.removeAll(*it);
2956 
2957  if (current->isWindow())
2958  break;
2959  current = current->parentWidget();
2960  }
2961  }
2962 
2963 #ifndef QT_MAC_USE_COCOA
2964  EventHandlerRef old_window_event = 0;
2965 #else
2966  bool oldToolbarVisible = false;
2967  NSDrawer *oldDrawer = nil;
2968  NSToolbar *oldToolbar = 0;
2969 #endif
2970  if (wasCreated && !(q->windowType() == Qt::Desktop)) {
2971  old_id = qt_mac_nativeview_for(q);
2972 #ifndef QT_MAC_USE_COCOA
2973  old_window_event = window_event;
2974 #else
2975  if (qt_mac_is_macdrawer(q)) {
2976  oldDrawer = qt_mac_drawer_for(q);
2977  }
2978  if (wasWindow) {
2979  OSWindowRef oldWindow = qt_mac_window_for(old_id);
2980  oldToolbar = [oldWindow toolbar];
2981  if (oldToolbar) {
2982  [oldToolbar retain];
2983  oldToolbarVisible = [oldToolbar isVisible];
2984  [oldWindow setToolbar:nil];
2985  }
2986  }
2987 #endif
2988  }
2989  QWidget* oldtlw = q->window();
2990 
2991  if (q->testAttribute(Qt::WA_DropSiteRegistered))
2993 
2994  //recreate and setup flags
2996  bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
2997  if (wasCreated && !qt_isGenuineQWidget(q))
2998  return;
2999 
3000  if (!q->testAttribute(Qt::WA_WState_WindowOpacitySet)) {
3001  q->setWindowOpacity(1.0f);
3002  q->setAttribute(Qt::WA_WState_WindowOpacitySet, false);
3003  }
3004 
3005  setWinId(0); //do after the above because they may want the id
3006 
3007  data.window_flags = f;
3008  q->setAttribute(Qt::WA_WState_Created, false);
3009  q->setAttribute(Qt::WA_WState_Visible, false);
3010  q->setAttribute(Qt::WA_WState_Hidden, false);
3012  // keep compatibility with previous versions, we need to preserve the created state.
3013  // (but we recreate the winId for the widget being reparented, again for compatibility,
3014  // unless this is an alien widget. )
3015  const bool nonWindowWithCreatedParent = !q->isWindow() && parent->testAttribute(Qt::WA_WState_Created);
3016  const bool nativeWidget = q->internalWinId() != 0;
3017  if (wasCreated || (nativeWidget && nonWindowWithCreatedParent)) {
3018  createWinId();
3019  if (q->isWindow()) {
3020 #ifndef QT_MAC_USE_COCOA
3021  // We do this down below for wasCreated, so avoid doing this twice
3022  // (only for performance, it gets called a lot anyway).
3023  if (!wasCreated) {
3024  if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) {
3025  mwl->updateHIToolBarStatus();
3026  }
3027  }
3028 #else
3029  // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon.
3030  if (oldToolbar && !(f & Qt::FramelessWindowHint)) {
3031  OSWindowRef newWindow = qt_mac_window_for(q);
3032  [newWindow setToolbar:oldToolbar];
3033  [oldToolbar release];
3034  [oldToolbar setVisible:oldToolbarVisible];
3035  }
3036 #endif
3037  }
3038  }
3039  if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden)
3040  q->setAttribute(Qt::WA_WState_Hidden);
3041  q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
3042 
3043 #ifdef QT_MAC_USE_COCOA
3044  // If we add a child to the unified toolbar, we have to redirect the painting.
3045  if (parent && parent->d_func() && parent->d_func()->isInUnifiedToolbar) {
3046  if (parent->d_func()->unifiedSurface) {
3047  QWidget *toolbar = parent->d_func()->toolbar_ancestor;
3048  parent->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset);
3049  }
3050  }
3051 #endif // QT_MAC_USE_COCOA
3052 
3053  if (wasCreated) {
3054  transferChildren();
3055 #ifndef QT_MAC_USE_COCOA
3056  // If we were a unified window, We just transfered our toolbars out of the unified toolbar.
3057  // So redo the status one more time. It apparently is not an issue with Cocoa.
3058  if (q->isWindow()) {
3059  if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) {
3060  mwl->updateHIToolBarStatus();
3061  }
3062  }
3063 #endif
3064 
3065  if (topData &&
3066  (!topData->caption.isEmpty() || !topData->filePath.isEmpty()))
3067  setWindowTitle_helper(q->windowTitle());
3068  }
3069 
3070  if (q->testAttribute(Qt::WA_AcceptDrops)
3071  || (!q->isWindow() && q->parentWidget()
3072  && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
3073  q->setAttribute(Qt::WA_DropSiteRegistered, true);
3074 
3075  //cleanup
3076 #ifndef QT_MAC_USE_COCOA
3077  if (old_window_event)
3078  RemoveEventHandler(old_window_event);
3079 #endif
3080  if (old_id) { //don't need old window anymore
3081  OSWindowRef window = (oldtlw == q) ? qt_mac_window_for(old_id) : 0;
3082  qt_mac_destructView(old_id);
3083 
3084 #ifdef QT_MAC_USE_COCOA
3085  if (oldDrawer) {
3086  qt_mac_destructDrawer(oldDrawer);
3087  } else
3088 #endif
3089  if (window)
3090  qt_mac_destructWindow(window);
3091  }
3092 
3093  // Maintain the glWidgets list on parent change: add "our" gl widgets
3094  // to the list on the new parent and grandparents.
3095  if (glWidgets.isEmpty() == false) {
3096  QWidget *current = q->parentWidget();
3097  while (current) {
3098  current->d_func()->glWidgets += glWidgets;
3099  if (current->isWindow())
3100  break;
3101  current = current->parentWidget();
3102  }
3103  }
3104  invalidateBuffer(q->rect());
3106 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
static void qt_mac_destructWindow(OSWindowRef window)
Definition: qwidget_mac.mm:253
#define it(className, varName)
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w=0)
Definition: qwidget.cpp:1242
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
QMainWindowLayout * qt_mainwindow_layout(const QMainWindow *window)
QTLWExtra * maybeTopData() const
Definition: qwidget_p.h:1010
NSToolbar * toolbar
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void setParent_helper(QObject *)
Definition: qobject.cpp:1974
NSWindow * window
static bool qt_isGenuineQWidget(OSViewRef ref)
Definition: qwidget_mac.mm:464
WindowRef OSWindowRef
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
Qt::WindowFlags window_flags
Definition: qwidget.h:119
static void qt_mac_destructDrawer(NSDrawer *drawer)
Definition: qwidget_mac.mm:270
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
void setWindowTitle_helper(const QString &cap)
Definition: qwidget.cpp:6285
bool qt_mac_is_macdrawer(const QWidget *w)
Definition: qwidget_mac.mm:306
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
QString filePath
Definition: qwidget_p.h:174
void createWinId(WId id=0)
Definition: qwidget.cpp:2574
QString caption
Definition: qwidget_p.h:171
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
static void qt_mac_destructView(OSViewRef view)
Definition: qwidget_mac.mm:235
void qt_event_request_window_change(QWidget *)
void setWinId(WId)
Definition: qwidget.cpp:1726
HIViewRef OSViewRef
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658

◆ setRedirected()

void QWidgetPrivate::setRedirected ( QPaintDevice replacement,
const QPoint offset 
)
inline

Definition at line 621 of file qwidget_p.h.

622  {
623  Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent));
624  redirectDev = replacement;
625  redirectOffset = offset;
626  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QPaintDevice * redirectDev
Definition: qwidget_p.h:706
QPoint redirectOffset
Definition: qwidget_p.h:758

◆ setSharedPainter()

void QWidgetPrivate::setSharedPainter ( QPainter painter)
inline

Definition at line 1022 of file qwidget_p.h.

1023 {
1024  Q_Q(QWidget);
1025  QTLWExtra *x = q->window()->d_func()->topData();
1026  x->sharedPainter = painter;
1027 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QPainter * sharedPainter
Definition: qwidget_p.h:168

◆ setStyle_helper()

void QWidgetPrivate::setStyle_helper ( QStyle newStyle,
bool  propagate,
bool  metalHack = false 
)

Definition at line 2791 of file qwidget.cpp.

2796 {
2797  Q_Q(QWidget);
2798  QStyle *oldStyle = q->style();
2799 #ifndef QT_NO_STYLE_STYLESHEET
2800  QWeakPointer<QStyle> origStyle;
2801 #endif
2802 
2803 #ifdef Q_WS_MAC
2804  // the metalhack boolean allows Qt/Mac to do a proper re-polish depending
2805  // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever
2806  // set when changing that attribute and passes the widget's CURRENT style.
2807  // therefore no need to do a reassignment.
2808  if (!metalHack)
2809 #endif
2810  {
2811  createExtra();
2812 
2813 #ifndef QT_NO_STYLE_STYLESHEET
2814  origStyle = extra->style.data();
2815 #endif
2816  extra->style = newStyle;
2817  }
2818 
2819  // repolish
2820  if (q->windowType() != Qt::Desktop) {
2821  if (polished) {
2822  oldStyle->unpolish(q);
2823 #ifdef Q_WS_MAC
2824  if (metalHack)
2825  macUpdateMetalAttribute();
2826 #endif
2827  q->style()->polish(q);
2828 #ifdef Q_WS_MAC
2829  } else if (metalHack) {
2830  macUpdateMetalAttribute();
2831 #endif
2832  }
2833  }
2834 
2835  if (propagate) {
2836  for (int i = 0; i < children.size(); ++i) {
2838  if (c)
2839  c->d_func()->inheritStyle();
2840  }
2841  }
2842 
2843 #ifndef QT_NO_STYLE_STYLESHEET
2844  if (!qobject_cast<QStyleSheetStyle*>(newStyle)) {
2845  if (const QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(origStyle.data())) {
2846  cssStyle->clearWidgetFont(q);
2847  }
2848  }
2849 #endif
2850 
2852  QApplication::sendEvent(q, &e);
2853 #ifdef QT3_SUPPORT
2854  q->styleChange(*oldStyle);
2855 #endif
2856 
2857 #ifndef QT_NO_STYLE_STYLESHEET
2858  // dereference the old stylesheet style
2859  if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(origStyle.data()))
2860  proxy->deref();
2861 #endif
2862 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
virtual void unpolish(QWidget *)
Uninitialize the given {widget}&#39;s appearance.
Definition: qstyle.cpp:409
unsigned char c[8]
Definition: qnumeric_p.h:62
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
const QMetaObject * polished
Definition: qwidget_p.h:709
QPointer< QStyle > style
Definition: qwidget_p.h:256
T * data() const
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
void createExtra()
Creates the widget extra data.
Definition: qwidget.cpp:1802
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
QWExtra * extra
Definition: qwidget_p.h:700
T * data() const
Definition: qpointer.h:79
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
The QWeakPointer class holds a weak reference to a shared pointer.

◆ setUpdatesEnabled_helper()

void QWidgetPrivate::setUpdatesEnabled_helper ( bool  enable)

Definition at line 1931 of file qwidget.cpp.

1932 {
1933  Q_Q(QWidget);
1934 
1935  if (enable && !q->isWindow() && q->parentWidget() && !q->parentWidget()->updatesEnabled())
1936  return; // nothing we can do
1937 
1938  if (enable != q->testAttribute(Qt::WA_UpdatesDisabled))
1939  return; // nothing to do
1940 
1941  q->setAttribute(Qt::WA_UpdatesDisabled, !enable);
1942  if (enable)
1943  q->update();
1944 
1946  for (int i = 0; i < children.size(); ++i) {
1947  QWidget *w = qobject_cast<QWidget *>(children.at(i));
1948  if (w && !w->isWindow() && !w->testAttribute(attribute))
1949  w->d_func()->setUpdatesEnabled_helper(enable);
1950  }
1951 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
WidgetAttribute
Definition: qnamespace.h:376
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ setWindowFilePath_helper()

void QWidgetPrivate::setWindowFilePath_helper ( const QString filePath)

Definition at line 6461 of file qwidget.cpp.

Referenced by qt_mac_unregister_widget().

6462 {
6463  if (extra->topextra && extra->topextra->caption.isEmpty()) {
6464 #ifdef Q_WS_MAC
6466 #else
6467  Q_Q(QWidget);
6468  Q_UNUSED(filePath);
6469  setWindowTitle_helper(q->windowTitle());
6470 #endif
6471  }
6472 #ifdef Q_WS_MAC
6473  setWindowFilePath_sys(filePath);
6474 #endif
6475 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setWindowTitle_helper(const QString &cap)
Definition: qwidget.cpp:6285
QTLWExtra * topextra
Definition: qwidget_p.h:249
QWExtra * extra
Definition: qwidget_p.h:700
QString caption
Definition: qwidget_p.h:171
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static QString fileName(const QString &fileUrl)

◆ setWindowIcon_helper()

void QWidgetPrivate::setWindowIcon_helper ( )

Definition at line 6351 of file qwidget.cpp.

6352 {
6354  QApplication::sendEvent(q_func(), &e);
6355  for (int i = 0; i < children.size(); ++i) {
6356  QWidget *w = qobject_cast<QWidget *>(children.at(i));
6357  if (w && !w->isWindow())
6358  QApplication::sendEvent(w, &e);
6359  }
6360 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ setWindowIcon_sys()

void QWidgetPrivate::setWindowIcon_sys ( bool  forceReset = false)

Definition at line 3228 of file qwidget_mac.mm.

Referenced by isServerProcess(), q_createNativeChildrenAndSetParent(), qstring_to_xtp(), and qt_createIcon().

3229 {
3230  Q_Q(QWidget);
3231 
3232  if (!q->testAttribute(Qt::WA_WState_Created))
3233  return;
3234 
3235  QTLWExtra *topData = this->topData();
3236  if (topData->iconPixmap && !forceReset) // already set
3237  return;
3238 
3239  QIcon icon = q->windowIcon();
3240  QPixmap *pm = 0;
3241  if (!icon.isNull()) {
3242  // now create the extra
3243  if (!topData->iconPixmap) {
3244  pm = new QPixmap(icon.pixmap(QSize(22, 22)));
3245  topData->iconPixmap = pm;
3246  } else {
3247  pm = topData->iconPixmap;
3248  }
3249  }
3250  if (q->isWindow()) {
3251 #ifndef QT_MAC_USE_COCOA
3252  IconRef previousIcon = 0;
3253  if (icon.isNull()) {
3254  RemoveWindowProxy(qt_mac_window_for(q));
3255  previousIcon = topData->windowIcon;
3256  topData->windowIcon = 0;
3257  } else {
3258  WindowClass wclass;
3259  GetWindowClass(qt_mac_window_for(q), &wclass);
3260 
3261  if (wclass == kDocumentWindowClass) {
3262  IconRef newIcon = qt_mac_create_iconref(*pm);
3263  previousIcon = topData->windowIcon;
3264  topData->windowIcon = newIcon;
3265  SetWindowProxyIcon(qt_mac_window_for(q), newIcon);
3266  }
3267  }
3268 
3269  // Release the previous icon if it was set by this function.
3270  if (previousIcon != 0)
3271  ReleaseIconRef(previousIcon);
3272 #else
3274  if (icon.isNull())
3275  return;
3276  NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
3277  if (iconButton == nil) {
3278  QCFString string(q->windowTitle());
3279  const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
3280  [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast<NSString *>(tmpString)]];
3281  iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
3282  }
3283  if (icon.isNull()) {
3284  [iconButton setImage:nil];
3285  } else {
3287  NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(scaled));
3288  [iconButton setImage:image];
3289  [image release];
3290  }
3291 #endif
3292  }
3293 }
const struct __CFString * CFStringRef
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
IconRef qt_mac_create_iconref(const QPixmap &)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qpixmap.h:132
void * qt_mac_create_nsimage(const QPixmap &pm)
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
QPixmap * iconPixmap
Definition: qwidget_p.h:165
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
struct OpaqueIconRef * IconRef
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ setWindowIconText_helper()

void QWidgetPrivate::setWindowIconText_helper ( const QString cap)

Definition at line 6292 of file qwidget.cpp.

Referenced by qt_mac_unregister_widget().

6293 {
6294  Q_Q(QWidget);
6295  if (q->testAttribute(Qt::WA_WState_Created))
6297 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
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 i...
Definition: qwidget.cpp:6240
void setWindowIconText_sys(const QString &cap)

◆ setWindowIconText_sys()

void QWidgetPrivate::setWindowIconText_sys ( const QString cap)

Definition at line 3295 of file qwidget_mac.mm.

Referenced by isServerProcess(), q_createNativeChildrenAndSetParent(), qstring_to_xtp(), and qt_createIcon().

3296 {
3297  Q_Q(QWidget);
3298  if(q->isWindow() && !iconText.isEmpty()) {
3299 #ifndef QT_MAC_USE_COCOA
3300  SetWindowAlternateTitle(qt_mac_window_for(q), QCFString(iconText));
3301 #else
3303  [qt_mac_window_for(q) setMiniwindowTitle:qt_mac_QStringToNSString(iconText)];
3304 #endif
3305  }
3306 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ setWindowOpacity_sys()

void QWidgetPrivate::setWindowOpacity_sys ( qreal  opacity)

Definition at line 5101 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), qt_grab_cursor(), and qt_tablet_cleanup_wce().

5102 {
5103  Q_Q(QWidget);
5104 
5105  if (!q->isWindow())
5106  return;
5107 
5108  level = qBound(0.0, level, 1.0);
5109  topData()->opacity = (uchar)(level * 255);
5110  if (!q->testAttribute(Qt::WA_WState_Created))
5111  return;
5112 
5113  OSWindowRef oswindow = qt_mac_window_for(q);
5114 #if QT_MAC_USE_COCOA
5115  [oswindow setAlphaValue:level];
5116 #else
5117  SetWindowAlpha(oswindow, level);
5118 #endif
5119 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
unsigned char uchar
Definition: qglobal.h:994
WindowRef OSWindowRef
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
Definition: qglobal.h:1219
uint opacity
Definition: qwidget_p.h:185

◆ setWindowRole()

void QWidgetPrivate::setWindowRole ( )

Definition at line 3015 of file qwidget_x11.cpp.

3016 {
3017  Q_Q(QWidget);
3018  if (!q->internalWinId())
3019  return;
3020  QByteArray windowRole = topData()->role.toUtf8();
3021  XChangeProperty(X11->display, q->internalWinId(),
3022  ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
3023  (unsigned char *)windowRole.constData(), windowRole.length());
3024 }
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QString role
Definition: qwidget_p.h:173
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
#define ATOM(x)
Definition: qt_x11_p.h:723
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
int length() const
Same as size().
Definition: qbytearray.h:356
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ setWindowTitle_helper()

void QWidgetPrivate::setWindowTitle_helper ( const QString cap)

Definition at line 6285 of file qwidget.cpp.

Referenced by QWidget::destroy(), isServerProcess(), qt_mac_unregister_widget(), and setParent_sys().

6286 {
6287  Q_Q(QWidget);
6288  if (q->testAttribute(Qt::WA_WState_Created))
6290 }
void setWindowTitle_sys(const QString &cap)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
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 i...
Definition: qwidget.cpp:6240

◆ setWindowTitle_sys()

void QWidgetPrivate::setWindowTitle_sys ( const QString cap)

Definition at line 3173 of file qwidget_mac.mm.

Referenced by isServerProcess(), q_createNativeChildrenAndSetParent(), and qstring_to_xtp().

3174 {
3175  Q_Q(QWidget);
3176  if (q->isWindow()) {
3177 #ifndef QT_MAC_USE_COCOA
3178  SetWindowTitleWithCFString(qt_mac_window_for(q), QCFString(caption));
3179 #else
3181  [qt_mac_window_for(q) setTitle:qt_mac_QStringToNSString(caption)];
3182 #endif
3183  }
3184 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ setWinId()

void QWidgetPrivate::setWinId ( WId  id)

Definition at line 1726 of file qwidget.cpp.

Referenced by create_sys(), effectiveState(), isServerProcess(), q_createNativeChildrenAndSetParent(), qt_mac_unregister_widget(), qt_tablet_cleanup_wce(), and setParent_sys().

1727 {
1728  Q_Q(QWidget);
1729  // the user might create a widget with Qt::Desktop window
1730  // attribute (or create another QDesktopWidget instance), which
1731  // will have the same windowid (the root window id) as the
1732  // qt_desktopWidget. We should not add the second desktop widget
1733  // to the mapper.
1734  bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
1735  if (mapper && data.winid && !userDesktopWidget) {
1736  mapper->remove(data.winid);
1737  }
1738 
1739  const WId oldWinId = data.winid;
1740 
1741  data.winid = id;
1742 #if defined(Q_WS_X11)
1743  hd = id; // X11: hd == ident
1744 #endif
1745  if (mapper && id && !userDesktopWidget) {
1746  mapper->insert(data.winid, q);
1747  }
1748 
1749  if(oldWinId != id) {
1752  }
1753 }
unsigned long WId
Definition: qwindowdefs.h:119
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
Qt::HANDLE hd
Definition: qwidget_p.h:754
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QWidgetMapper * mapper
Definition: qwidget_p.h:714
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QDesktopWidget * qt_desktopWidget
WId winid
Definition: qwidget.h:117

◆ sharedPainter()

QPainter * QWidgetPrivate::sharedPainter ( ) const
inline

Definition at line 1015 of file qwidget_p.h.

Referenced by render().

1016 {
1017  Q_Q(const QWidget);
1018  QTLWExtra *x = q->window()->d_func()->maybeTopData();
1019  return x ? x->sharedPainter : 0;
1020 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QPainter * sharedPainter
Definition: qwidget_p.h:168

◆ show_helper()

void QWidgetPrivate::show_helper ( )

Definition at line 7782 of file qwidget.cpp.

7783 {
7784  Q_Q(QWidget);
7785  data.in_show = true; // qws optimization
7786  // make sure we receive pending move and resize events
7788 
7789  // become visible before showing all children
7790  q->setAttribute(Qt::WA_WState_Visible);
7791 
7792  // finally show all children recursively
7793  showChildren(false);
7794 
7795 #ifdef QT3_SUPPORT
7796  if (q->parentWidget() && sendChildEvents)
7797  QApplication::sendPostedEvents(q->parentWidget(),
7798  QEvent::ChildInserted);
7799 #endif
7800 
7801 
7802  // popup handling: new popups and tools need to be raised, and
7803  // existing popups must be closed. Also propagate the current
7804  // windows's KeyboardFocusChange status.
7805  if (q->isWindow()) {
7806  if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) {
7807  q->raise();
7808  if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange))
7809  q->setAttribute(Qt::WA_KeyboardFocusChange);
7810  } else {
7812  if (!QApplication::activePopupWidget()->close())
7813  break;
7814  }
7815  }
7816  }
7817 
7818  // Automatic embedding of child windows of widgets already embedded into
7819  // QGraphicsProxyWidget when they are shown the first time.
7820  bool isEmbedded = false;
7821 #ifndef QT_NO_GRAPHICSVIEW
7822  if (q->isWindow()) {
7823  isEmbedded = q->graphicsProxyWidget() ? true : false;
7824  if (!isEmbedded && !bypassGraphicsProxyWidget(q)) {
7825  QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
7826  if (ancestorProxy) {
7827  isEmbedded = true;
7828  ancestorProxy->d_func()->embedSubWindow(q);
7829  }
7830  }
7831  }
7832 #else
7833  Q_UNUSED(isEmbedded);
7834 #endif
7835 
7836  // On Windows, show the popup now so that our own focus handling
7837  // stores the correct old focus widget even if it's stolen in the
7838  // showevent
7839 #if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
7840  if (!isEmbedded && q->windowType() == Qt::Popup)
7841  qApp->d_func()->openPopup(q);
7842 #endif
7843 
7844  // send the show event before showing the window
7845  QShowEvent showEvent;
7846  QApplication::sendEvent(q, &showEvent);
7847 
7848  if (!isEmbedded && q->isModal() && q->isWindow())
7849  // QApplicationPrivate::enterModal *before* show, otherwise the initial
7850  // stacking might be wrong
7852 
7853 
7854  show_sys();
7855 
7856 #if !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN)
7857  if (!isEmbedded && q->windowType() == Qt::Popup)
7858  qApp->d_func()->openPopup(q);
7859 #endif
7860 
7861 #ifndef QT_NO_ACCESSIBILITY
7862  if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator.
7864 #endif
7865 
7869  }
7870 
7871  // Process events when showing a Qt::SplashScreen widget before the event loop
7872  // is spinnning; otherwise it might not show up on particular platforms.
7873  // This makes QSplashScreen behave the same on all platforms.
7874  if (!qApp->d_func()->in_exec && q->windowType() == Qt::SplashScreen)
7876 
7877  data.in_show = false; // reset qws optimization
7878 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static bool bypassGraphicsProxyWidget(const QWidget *p)
Returns true if p or any of its parents enable the Qt::BypassGraphicsProxyWidget window flag...
Definition: qwidget_p.h:353
void show_sys()
Platform-specific part of QWidget::show().
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes all pending events for the calling thread according to the specified flags until there are ...
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void showChildren(bool spontaneous)
Definition: qwidget.cpp:8144
#define qApp
static QWidget * hidden_focus_widget
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void sendPostedEvents()
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
static QWidget * activePopupWidget()
Returns the active popup widget.
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin)
Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget an...
Definition: qwidget.cpp:6098
uint sendChildEvents
Definition: qobject.h:100
void sendPendingMoveAndResizeEvents(bool recursive=false, bool disableUpdates=false)
Definition: qwidget.cpp:7720
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static void enterModal(QWidget *)
uint in_show
Definition: qwidget.h:124

◆ show_recursive()

void QWidgetPrivate::show_recursive ( )

Makes the widget visible in the isVisible() meaning of the word.

Warning
This function is not part of the public interface.

It is only called for toplevels or widgets with visible parents.

Definition at line 7698 of file qwidget.cpp.

7699 {
7700  Q_Q(QWidget);
7701  // polish if necessary
7702 
7703  if (!q->testAttribute(Qt::WA_WState_Created))
7705  q->ensurePolished();
7706 
7707 #ifdef QT3_SUPPORT
7708  if(sendChildEvents)
7709  QApplication::sendPostedEvents(q, QEvent::ChildInserted);
7710 #endif
7711  if (!q->isWindow() && q->parentWidget()->d_func()->layout && !q->parentWidget()->data->in_show)
7712  q->parentWidget()->d_func()->layout->activate();
7713  // activate our layout before we and our children become visible
7714  if (layout)
7715  layout->activate();
7716 
7717  show_helper();
7718 }
QLayout * layout
Definition: qwidget_p.h:704
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool activate()
Redoes the layout for parentWidget() if necessary.
Definition: qlayout.cpp:1249
#define Q_Q(Class)
Definition: qglobal.h:2483
static void sendPostedEvents()
void createRecursively()
Definition: qwidget.cpp:1423
void show_helper()
Definition: qwidget.cpp:7782
uint sendChildEvents
Definition: qobject.h:100

◆ show_sys()

void QWidgetPrivate::show_sys ( )

Platform-specific part of QWidget::show().

Warning
This function is not part of the public interface.

Definition at line 3440 of file qwidget_mac.mm.

Referenced by isServerProcess(), qstring_to_xtp(), qt_grab_cursor(), qt_mac_unregister_widget(), and qt_tablet_cleanup_wce().

3441 {
3442  Q_Q(QWidget);
3443  if ((q->windowType() == Qt::Desktop)) //desktop is always visible
3444  return;
3445 
3446  invalidateBuffer(q->rect());
3447  if (q->testAttribute(Qt::WA_OutsideWSRange))
3448  return;
3450  q->setAttribute(Qt::WA_Mapped);
3451  if (q->testAttribute(Qt::WA_DontShowOnScreen))
3452  return;
3453 
3454  bool realWindow = isRealWindow();
3455 #ifndef QT_MAC_USE_COCOA
3456  if (realWindow && !q->testAttribute(Qt::WA_Moved)) {
3457  if (qt_mac_is_macsheet(q))
3458  recreateMacWindow();
3459  q->createWinId();
3460  if (QWidget *p = q->parentWidget()) {
3461  p->createWinId();
3462  RepositionWindow(qt_mac_window_for(q), qt_mac_window_for(p), kWindowCenterOnParentWindow);
3463  } else {
3464  RepositionWindow(qt_mac_window_for(q), 0, kWindowCenterOnMainScreen);
3465  }
3466  }
3467 #endif
3468 
3469  data.fstrut_dirty = true;
3470  if (realWindow) {
3471  bool isCurrentlyMinimized = (q->windowState() & Qt::WindowMinimized);
3472  setModal_sys();
3474 #ifndef QT_MAC_USE_COCOA
3475  SizeWindow(window, q->width(), q->height(), true);
3476 #endif
3477 
3478 #ifdef QT_MAC_USE_COCOA
3479  // Make sure that we end up sending a repaint event to
3480  // the widget if the window has been visible one before:
3481  [qt_mac_get_contentview_for(window) setNeedsDisplay:YES];
3482 #endif
3483  if(qt_mac_is_macsheet(q)) {
3485  } else if(qt_mac_is_macdrawer(q)) {
3486 #ifndef QT_MAC_USE_COCOA
3487  OpenDrawer(window, kWindowEdgeDefault, false);
3488 #else
3489  NSDrawer *drawer = qt_mac_drawer_for(q);
3490  [drawer openOnEdge:[drawer preferredEdge]];
3491 #endif
3492  } else {
3493 #ifndef QT_MAC_USE_COCOA
3494  ShowHide(window, true);
3495 #else
3496  // sync the opacity value back (in case of a fade).
3497  [window setAlphaValue:q->windowOpacity()];
3498 
3499  QWidget *top = 0;
3500  if (QApplicationPrivate::tryModalHelper(q, &top)) {
3501  if (q->testAttribute(Qt::WA_ShowWithoutActivating))
3502  [window orderFront:window];
3503  else
3504  [window makeKeyAndOrderFront:window];
3505  // If this window is app modal, we need to start spinning
3506  // a modal session for it. Interrupting
3507  // the event dispatcher will make this happend:
3510  } else {
3511  // The window is modally shaddowed, so we need to make
3512  // sure that we don't pop in front of the modal window:
3513  [window orderFront:window];
3515  if (NSWindow *modalWin = qt_mac_window_for(top))
3516  [modalWin orderFront:window];
3517  }
3518  }
3519  setSubWindowStacking(true);
3521 #endif
3522  if (q->windowType() == Qt::Popup) {
3523  qt_button_down = 0;
3524  if (q->focusWidget())
3525  q->focusWidget()->d_func()->setFocus_sys();
3526  else
3527  setFocus_sys();
3528  }
3529  toggleDrawers(true);
3530  }
3531  if (isCurrentlyMinimized) { //show in collapsed state
3532 #ifndef QT_MAC_USE_COCOA
3533  CollapseWindow(window, true);
3534 #else
3535  [window miniaturize:window];
3536 #endif
3537  } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) {
3538 #ifndef QT_MAC_USE_COCOA
3540 #endif
3541  }
3542  } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) {
3543 #ifndef QT_MAC_USE_COCOA
3544  HIViewSetVisible(qt_mac_nativeview_for(q), true);
3545 #else
3546  if (NSView *view = qt_mac_nativeview_for(q)) {
3547  // INVARIANT: q is native. Just show the view:
3548  [view setHidden:NO];
3549  } else {
3550  // INVARIANT: q is alien. Update q instead:
3551  q->update();
3552  }
3553 #endif
3554  }
3555 
3556 #ifdef QT_MAC_USE_COCOA
3557  if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
3558  // Update enter/leave immidiatly, don't wait for a move event. But only
3559  // if no grab exists (even if the grab points to this widget, it seems, ref X11)
3560  QPoint qlocal, qglobal;
3561  QWidget *widgetUnderMouse = 0;
3562  qt_mac_getTargetForMouseEvent(0, QEvent::Enter, qlocal, qglobal, 0, &widgetUnderMouse);
3563  if (q == widgetUnderMouse) {
3565  qt_last_mouse_receiver = widgetUnderMouse;
3566  qt_last_native_mouse_receiver = widgetUnderMouse ?
3567  (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0;
3568  }
3569  }
3570 #endif
3571 
3572  topLevelAt_cache = 0;
3574 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition: qwidget.cpp:6863
virtual void interrupt()=0
Interrupts event dispatching; i.
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
QPointer< QWidget > topLevelAt_cache
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QWidget > qt_button_down
#define Q_Q(Class)
Definition: qglobal.h:2483
uint window_modality
Definition: qwidget.h:128
QWidgetData data
Definition: qwidget_p.h:755
NSWindow * window
QWidget * nativeParentWidget() const
Returns the native parent for this widget, i.
Definition: qwidget.cpp:4514
WindowRef OSWindowRef
static QWidget * mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void qt_event_request_activate(QWidget *)
bool qt_mac_is_macsheet(const QWidget *w)
Definition: qwidget_mac.mm:295
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
Q_GUI_EXPORT OSViewRef qt_mac_get_contentview_for(OSWindowRef w)
Definition: qwidget_mac.mm:431
bool qt_mac_is_macdrawer(const QWidget *w)
Definition: qwidget_mac.mm:306
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)
QPointer< QWidget > qt_last_native_mouse_receiver
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
void qt_event_request_window_change(QWidget *)
uint fstrut_dirty
Definition: qwidget.h:126
QPointer< QWidget > qt_last_mouse_receiver
void qt_mac_update_cursor()
Definition: qcursor_mac.mm:201
qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch)
void qt_event_request_showsheet(QWidget *)

◆ showChildren()

void QWidgetPrivate::showChildren ( bool  spontaneous)

Definition at line 8144 of file qwidget.cpp.

Referenced by QApplication::x11ProcessEvent().

8145 {
8146  QList<QObject*> childList = children;
8147  for (int i = 0; i < childList.size(); ++i) {
8148  QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
8149  if (!widget
8150  || widget->isWindow()
8151  || widget->testAttribute(Qt::WA_WState_Hidden))
8152  continue;
8153  if (spontaneous) {
8154  widget->setAttribute(Qt::WA_Mapped);
8155  widget->d_func()->showChildren(true);
8156  QShowEvent e;
8158  } else {
8160  widget->d_func()->show_recursive();
8161  else
8162  widget->show();
8163  }
8164  }
8165 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QPointer< QWidget > widget
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QObjectList children
Definition: qobject.h:93
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
void show()
Shows the widget and its child widgets.
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ stackUnder_sys()

void QWidgetPrivate::stackUnder_sys ( QWidget w)

Definition at line 4051 of file qwidget_mac.mm.

Referenced by effectiveState(), qt_grab_cursor(), and setNetWmWindowTypes().

4052 {
4053  // stackUnder
4054  Q_Q(QWidget);
4055  if(!w || q->isWindow() || (q->windowType() == Qt::Desktop))
4056  return;
4057 #ifdef QT_MAC_USE_COCOA
4058  // Do the same trick as lower_sys() and put this widget before the widget passed in.
4059  NSView *myView = qt_mac_nativeview_for(q);
4060  NSView *wView = qt_mac_nativeview_for(w);
4061 
4062  QHash<NSView *, int> viewOrder;
4063  NSView *parentView = [myView superview];
4064  NSArray *subviews = [parentView subviews];
4065  NSUInteger index = 1;
4066  // make a hash of view->zorderindex and make sure z-value is always odd,
4067  // so that when we modify the order we create a new (even) z-value which
4068  // will not interfere with others.
4069  for (NSView *subview in subviews) {
4070  viewOrder.insert(subview, index * 2);
4071  ++index;
4072  }
4073  viewOrder[myView] = viewOrder[wView] - 1;
4074 
4075  [parentView sortSubviewsUsingFunction:compareViews2StackUnder context:reinterpret_cast<void *>(&viewOrder)];
4076 #else
4077  QWidget *p = q->parentWidget();
4078  if(!p || p != w->parentWidget())
4079  return;
4080  invalidateBuffer(q->rect());
4081  HIViewSetZOrder(qt_mac_nativeview_for(q), kHIViewZOrderBelow, qt_mac_nativeview_for(w));
4083 #endif
4084 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
#define Q_Q(Class)
Definition: qglobal.h:2483
NSComparisonResult compareViews2StackUnder(id view1, id view2, void *context)
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
quint16 index
void qt_event_request_window_change(QWidget *)

◆ subtractOpaqueChildren()

void QWidgetPrivate::subtractOpaqueChildren ( QRegion rgn,
const QRect clipRect 
) const

Definition at line 2128 of file qwidget.cpp.

Referenced by QWidgetBackingStore::sync().

2129 {
2130  if (children.isEmpty() || clipRect.isEmpty())
2131  return;
2132 
2133  const QRegion &r = getOpaqueChildren();
2134  if (!r.isEmpty())
2135  source -= (r & clipRect);
2136 }
const QRegion & getOpaqueChildren() const
Definition: qwidget.cpp:2098
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234

◆ subtractOpaqueSiblings()

void QWidgetPrivate::subtractOpaqueSiblings ( QRegion source,
bool *  hasDirtySiblingsAbove = 0,
bool  alsoNonOpaque = false 
) const

Definition at line 2139 of file qwidget.cpp.

Referenced by QX11PaintEngine::begin(), scroll_sys(), QWidgetBackingStore::staticContents(), and QWidgetBackingStore::sync().

2141 {
2142  Q_Q(const QWidget);
2143  static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt();
2144  if (disableSubtractOpaqueSiblings || q->isWindow())
2145  return;
2146 
2147 #ifdef QT_MAC_USE_COCOA
2148  if (q->d_func()->isInUnifiedToolbar)
2149  return;
2150 #endif // QT_MAC_USE_COCOA
2151 
2152  QRect clipBoundingRect;
2153  bool dirtyClipBoundingRect = true;
2154 
2155  QRegion parentClip;
2156  bool dirtyParentClip = true;
2157 
2158  QPoint parentOffset = data.crect.topLeft();
2159 
2160  const QWidget *w = q;
2161 
2162  while (w) {
2163  if (w->isWindow())
2164  break;
2165  QWidgetPrivate *pd = w->parentWidget()->d_func();
2166  const int myIndex = pd->children.indexOf(const_cast<QWidget *>(w));
2167  const QRect widgetGeometry = w->d_func()->effectiveRectFor(w->data->crect);
2168  for (int i = myIndex + 1; i < pd->children.size(); ++i) {
2169  QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
2170  if (!sibling || !sibling->isVisible() || sibling->isWindow())
2171  continue;
2172 
2173  const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
2174  if (!qRectIntersects(siblingGeometry, widgetGeometry))
2175  continue;
2176 
2177  if (dirtyClipBoundingRect) {
2178  clipBoundingRect = sourceRegion.boundingRect();
2179  dirtyClipBoundingRect = false;
2180  }
2181 
2182  if (!qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset)))
2183  continue;
2184 
2185  if (dirtyParentClip) {
2186  parentClip = sourceRegion.translated(parentOffset);
2187  dirtyParentClip = false;
2188  }
2189 
2190  const QPoint siblingPos(sibling->data->crect.topLeft());
2191  const QRect siblingClipRect(sibling->d_func()->clipRect());
2192  QRegion siblingDirty(parentClip);
2193  siblingDirty &= (siblingClipRect.translated(siblingPos));
2194  const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
2195  && !sibling->d_func()->graphicsEffect;
2196  if (hasMask)
2197  siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
2198  if (siblingDirty.isEmpty())
2199  continue;
2200 
2201  if (sibling->d_func()->isOpaque || alsoNonOpaque) {
2202  if (hasMask) {
2203  siblingDirty.translate(-parentOffset);
2204  sourceRegion -= siblingDirty;
2205  } else {
2206  sourceRegion -= siblingGeometry.translated(-parentOffset);
2207  }
2208  } else {
2209  if (hasDirtySiblingsAbove)
2210  *hasDirtySiblingsAbove = true;
2211  if (sibling->d_func()->children.isEmpty())
2212  continue;
2213  QRegion opaqueSiblingChildren(sibling->d_func()->getOpaqueChildren());
2214  opaqueSiblingChildren.translate(-parentOffset + siblingPos);
2215  sourceRegion -= opaqueSiblingChildren;
2216  }
2217  if (sourceRegion.isEmpty())
2218  return;
2219 
2220  dirtyClipBoundingRect = true;
2221  dirtyParentClip = true;
2222  }
2223 
2224  w = w->parentWidget();
2225  parentOffset += pd->data.crect.topLeft();
2226  dirtyParentClip = true;
2227  }
2228 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
QObjectList children
Definition: qobject.h:93
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWidgetData * data
Definition: qwidget.h:815
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool qRectIntersects(const QRect &r1, const QRect &r2)
Definition: qwidget.cpp:163
QRegion mask() const
Returns the mask currently set on a widget.
Definition: qwidget.cpp:10058
QGraphicsEffect * graphicsEffect() const
The graphicsEffect function returns a pointer to the widget&#39;s graphics effect.
Definition: qwidget.cpp:5484
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ syncBackingStore() [1/2]

void QWidgetPrivate::syncBackingStore ( )

Definition at line 1912 of file qwidget.cpp.

1913 {
1914  if (paintOnScreen()) {
1915  repaint_sys(dirty);
1916  dirty = QRegion();
1917  } else if (QWidgetBackingStore *bs = maybeBackingStore()) {
1918  bs->sync();
1919  }
1920 }
QRegion dirty
Definition: qwidget_p.h:726
bool paintOnScreen() const
Definition: qwidget.cpp:2255
void repaint_sys(const QRegion &rgn)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWidgetBackingStore * maybeBackingStore() const
Definition: qwidget_p.h:1036

◆ syncBackingStore() [2/2]

void QWidgetPrivate::syncBackingStore ( const QRegion region)

Definition at line 1922 of file qwidget.cpp.

1923 {
1924  if (paintOnScreen())
1925  repaint_sys(region);
1926  else if (QWidgetBackingStore *bs = maybeBackingStore()) {
1927  bs->sync(q_func(), region);
1928  }
1929 }
bool paintOnScreen() const
Definition: qwidget.cpp:2255
void repaint_sys(const QRegion &rgn)
QWidgetBackingStore * maybeBackingStore() const
Definition: qwidget_p.h:1036

◆ topData()

QTLWExtra * QWidgetPrivate::topData ( ) const
inline

◆ unsetCursor_sys()

void QWidgetPrivate::unsetCursor_sys ( )

Definition at line 3168 of file qwidget_mac.mm.

Referenced by isServerProcess(), mapFromGlobal(), and q_createNativeChildrenAndSetParent().

3169 {
3171 }
void qt_mac_update_cursor()
Definition: qcursor_mac.mm:201

◆ updateFont()

void QWidgetPrivate::updateFont ( const QFont font)

Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation.

Warning
This function is not part of the public interface.

implicitMask is the union of all ancestor widgets' font request masks, and determines which attributes from this widget's font should propagate.

Definition at line 5093 of file qwidget.cpp.

5094 {
5095  Q_Q(QWidget);
5096 #ifndef QT_NO_STYLE_STYLESHEET
5097  const QStyleSheetStyle* cssStyle;
5098  cssStyle = extra ? qobject_cast<const QStyleSheetStyle*>(extra->style) : 0;
5099 #endif
5100 
5101 #ifdef QT3_SUPPORT
5102  QFont old = data.fnt;
5103 #endif
5104  data.fnt = QFont(font, q);
5105 #if defined(Q_WS_X11)
5106  // make sure the font set on this widget is associated with the correct screen
5107  data.fnt.x11SetScreen(xinfo.screen());
5108 #endif
5109  // Combine new mask with natural mask and propagate to children.
5110 #ifndef QT_NO_GRAPHICSVIEW
5111  if (!q->parentWidget() && extra && extra->proxyWidget) {
5113  inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
5114  } else
5115 #endif //QT_NO_GRAPHICSVIEW
5116  if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
5118  }
5120 
5121  for (int i = 0; i < children.size(); ++i) {
5122  QWidget *w = qobject_cast<QWidget*>(children.at(i));
5123  if (w) {
5124  if (0) {
5125 #ifndef QT_NO_STYLE_STYLESHEET
5126  } else if (w->testAttribute(Qt::WA_StyleSheet)) {
5127  // Style sheets follow a different font propagation scheme.
5128  if (cssStyle)
5129  cssStyle->updateStyleSheetFont(w);
5130 #endif
5131  } else if ((!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))) {
5132  // Propagate font changes.
5133  QWidgetPrivate *wd = w->d_func();
5134  wd->inheritedFontResolveMask = newMask;
5135  wd->resolveFont();
5136  }
5137  }
5138  }
5139 
5140 #ifndef QT_NO_STYLE_STYLESHEET
5141  if (cssStyle) {
5142  cssStyle->updateStyleSheetFont(q);
5143  }
5144 #endif
5145 
5147  QApplication::sendEvent(q, &e);
5148 #ifdef QT3_SUPPORT
5149  q->fontChange(old);
5150 #endif
5151 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
QFont fnt
Definition: qwidget.h:133
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QStyle > style
Definition: qwidget_p.h:256
QObjectList children
Definition: qobject.h:93
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
unsigned int uint
Definition: qglobal.h:996
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QFont font() const
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
uint inheritedFontResolveMask
Definition: qwidget_p.h:742
QWExtra * extra
Definition: qwidget_p.h:700
void resolveFont()
Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over).
Definition: qwidget.cpp:5074
QX11Info xinfo
Definition: qwidget_p.h:784
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
void updateStyleSheetFont(QWidget *w) const
int screen() const
Returns the number of the screen currently in use.

◆ updateFrameStrut()

void QWidgetPrivate::updateFrameStrut ( )

Computes the frame rectangle when needed.

Warning
This function is not part of the public interface.

This is an internal function, you should never call this.

Definition at line 4999 of file qwidget_mac.mm.

Referenced by do_size_hints(), effectiveState(), macWindowToolbarShow(), qt_grab_cursor(), qt_mac_unregister_widget(), and qt_tablet_cleanup_wce().

5000 {
5001  Q_Q(QWidget);
5002 
5003  QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
5004 
5005  that->data.fstrut_dirty = false;
5006  QTLWExtra *top = that->topData();
5007 
5008 #if QT_MAC_USE_COCOA
5009  // 1 Get the window frame
5010  OSWindowRef oswnd = qt_mac_window_for(q);
5011  NSRect frameW = [oswnd frame];
5012  // 2 Get the content frame - so now
5013  NSRect frameC = [oswnd contentRectForFrameRect:frameW];
5014  top->frameStrut.setCoords(frameC.origin.x - frameW.origin.x,
5015  (frameW.origin.y + frameW.size.height) - (frameC.origin.y + frameC.size.height),
5016  (frameW.origin.x + frameW.size.width) - (frameC.origin.x + frameC.size.width),
5017  frameC.origin.y - frameW.origin.y);
5018 #else
5019  Rect window_r;
5020  GetWindowStructureWidths(qt_mac_window_for(q), &window_r);
5021  top->frameStrut.setCoords(window_r.left, window_r.top, window_r.right, window_r.bottom);
5022 #endif
5023 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
QRect frameStrut
Definition: qwidget_p.h:180
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
WindowRef OSWindowRef
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
uint fstrut_dirty
Definition: qwidget.h:126

◆ updateGeometry_helper()

void QWidgetPrivate::updateGeometry_helper ( bool  forceUpdate)

Definition at line 10346 of file qwidget.cpp.

10347 {
10348  Q_Q(QWidget);
10349  if (widgetItem)
10351  QWidget *parent;
10352  if (forceUpdate || !extra || extra->minw != extra->maxw || extra->minh != extra->maxh) {
10353  if (!q->isWindow() && !q->isHidden() && (parent = q->parentWidget())) {
10354  if (parent->d_func()->layout)
10355  parent->d_func()->layout->invalidate();
10356  else if (parent->isVisible())
10358  }
10359  }
10360 }
void invalidateSizeCache()
Definition: qlayoutitem.h:160
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void invalidate()
Reimplemented Function
Definition: qlayout.cpp:673
qint32 minw
Definition: qwidget_p.h:264
#define Q_Q(Class)
Definition: qglobal.h:2483
qint32 maxw
Definition: qwidget_p.h:266
qint32 maxh
Definition: qwidget_p.h:267
QWidgetItemV2 * widgetItem
Definition: qwidget_p.h:707
QWExtra * extra
Definition: qwidget_p.h:700
QObject * parent
Definition: qobject.h:92
qint32 minh
Definition: qwidget_p.h:265
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ updateIsOpaque()

void QWidgetPrivate::updateIsOpaque ( )

Definition at line 2272 of file qwidget.cpp.

Referenced by create_sys().

2273 {
2274  // hw: todo: only needed if opacity actually changed
2276 
2277 #ifndef QT_NO_GRAPHICSEFFECT
2278  if (graphicsEffect) {
2279  // ### We should probably add QGraphicsEffect::isOpaque at some point.
2280  setOpaque(false);
2281  return;
2282  }
2283 #endif //QT_NO_GRAPHICSEFFECT
2284 
2285  Q_Q(QWidget);
2286 #ifdef Q_WS_X11
2287  if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) {
2288  setOpaque(false);
2289  return;
2290  }
2291 #endif
2292 
2293 #ifdef Q_WS_S60
2294  if (q->testAttribute(Qt::WA_TranslucentBackground)) {
2295  if (q->windowType() & Qt::Dialog || q->windowType() & Qt::Popup) {
2296  if (S60->avkonComponentsSupportTransparency) {
2297  setOpaque(false);
2298  return;
2299  }
2300  } else {
2301  setOpaque(false);
2302  return;
2303  }
2304  }
2305 #endif
2306 
2307  if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {
2308  setOpaque(true);
2309  return;
2310  }
2311 
2312  const QPalette &pal = q->palette();
2313 
2314  if (q->autoFillBackground()) {
2315  const QBrush &autoFillBrush = pal.brush(q->backgroundRole());
2316  if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {
2317  setOpaque(true);
2318  return;
2319  }
2320  }
2321 
2322  if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) {
2323 #ifdef Q_WS_S60
2324  setOpaque(true);
2325  return;
2326 #else
2327  const QBrush &windowBrush = q->palette().brush(QPalette::Window);
2328  if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
2329  setOpaque(true);
2330  return;
2331  }
2332 #endif
2333  }
2334  setOpaque(false);
2335 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
QGraphicsEffect * graphicsEffect
Definition: qwidget_p.h:710
void setDirtyOpaqueRegion()
Definition: qwidget.cpp:2075
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
void setOpaque(bool opaque)
Definition: qwidget.cpp:2337
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ updateIsTranslucent()

void QWidgetPrivate::updateIsTranslucent ( )

Definition at line 2356 of file qwidget.cpp.

2357 {
2358 #ifdef Q_WS_MAC
2359  macUpdateIsOpaque();
2360 #endif
2361 #ifdef Q_WS_X11
2363 #endif
2364 #ifdef Q_WS_WIN
2365  winUpdateIsOpaque();
2366 #endif
2367 #ifdef Q_OS_SYMBIAN
2368  s60UpdateIsOpaque();
2369 #endif
2370 }
void x11UpdateIsOpaque()

◆ updateSystemBackground()

void QWidgetPrivate::updateSystemBackground ( )

Definition at line 3159 of file qwidget_mac.mm.

Referenced by isServerProcess(), mapFromGlobal(), and q_createNativeChildrenAndSetParent().

3160 {
3161 }

◆ updateX11AcceptFocus()

void QWidgetPrivate::updateX11AcceptFocus ( )

Definition at line 3138 of file qwidget_x11.cpp.

3139 {
3140  Q_Q(QWidget);
3141  if (!q->isWindow() || !q->internalWinId())
3142  return;
3143 
3144  XWMHints *h = XGetWMHints(X11->display, q->internalWinId());
3145  XWMHints wm_hints;
3146  if (!h) {
3147  memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy
3148  h = &wm_hints;
3149  }
3150  h->flags |= InputHint;
3151  h->input = q->testAttribute(Qt::WA_X11DoNotAcceptFocus) ? False : True;
3152 
3153  XSetWMHints(X11->display, q->internalWinId(), h);
3154  if (h != &wm_hints)
3155  XFree((char *)h);
3156 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ x11UpdateIsOpaque()

void QWidgetPrivate::x11UpdateIsOpaque ( )

Definition at line 999 of file qwidget_x11.cpp.

1000 {
1001 #ifndef QT_NO_XRENDER
1002  Q_Q(QWidget);
1003  if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
1004  return;
1005 
1006  bool topLevel = (data.window_flags & Qt::Window);
1007  int screen = xinfo.screen();
1008  if (topLevel && X11->use_xrender
1009  && X11->argbVisuals[screen] && xinfo.depth() != 32)
1010  {
1012  }
1013 #endif
1014 }
int depth() const
Returns the color depth (bits per pixel) of the X display.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
Qt::WindowFlags window_flags
Definition: qwidget.h:119
QX11Info xinfo
Definition: qwidget_p.h:784
static void qt_x11_recreateNativeWidgetsRecursive(QWidget *widget)
int screen() const
Returns the number of the screen currently in use.

Properties

◆ accessibleDescription

QString QWidgetPrivate::accessibleDescription

Definition at line 738 of file qwidget_p.h.

◆ accessibleName

QString QWidgetPrivate::accessibleName

Definition at line 737 of file qwidget_p.h.

◆ actions

QList<QAction*> QWidgetPrivate::actions

◆ allWidgets

QWidgetSet * QWidgetPrivate::allWidgets = 0
static

◆ bg_role

QPalette::ColorRole QWidgetPrivate::bg_role

Definition at line 769 of file qwidget_p.h.

◆ bottomLayoutItemMargin

signed char QWidgetPrivate::bottomLayoutItemMargin

Definition at line 751 of file qwidget_p.h.

Referenced by fromLayoutItemRect(), and toLayoutItemRect().

◆ bottommargin

short QWidgetPrivate::bottommargin

◆ data

QWidgetData QWidgetPrivate::data

◆ dirty

QRegion QWidgetPrivate::dirty

Definition at line 726 of file qwidget_p.h.

Referenced by QWidgetBackingStore::addDirtyWidget(), and QWidgetBackingStore::sync().

◆ dirtyOpaqueChildren

uint QWidgetPrivate::dirtyOpaqueChildren

Definition at line 770 of file qwidget_p.h.

Referenced by getOpaqueChildren(), and setDirtyOpaqueRegion().

◆ extra

QWExtra* QWidgetPrivate::extra

◆ extraPaintEngine

QPaintEngine* QWidgetPrivate::extraPaintEngine

Definition at line 708 of file qwidget_p.h.

◆ fg_role

QPalette::ColorRole QWidgetPrivate::fg_role

Definition at line 768 of file qwidget_p.h.

◆ focus_child

QWidget* QWidgetPrivate::focus_child

Definition at line 703 of file qwidget_p.h.

◆ focus_next

QWidget* QWidgetPrivate::focus_next

Definition at line 701 of file qwidget_p.h.

Referenced by QWidgetExceptionCleaner::cleanup().

◆ focus_prev

QWidget* QWidgetPrivate::focus_prev

Definition at line 702 of file qwidget_p.h.

Referenced by QWidgetExceptionCleaner::cleanup().

◆ gestureContext

QMap<Qt::GestureType, Qt::GestureFlags> QWidgetPrivate::gestureContext

Definition at line 763 of file qwidget_p.h.

Referenced by QApplication::notify().

◆ graphicsEffect

QGraphicsEffect* QWidgetPrivate::graphicsEffect

◆ hd

Qt::HANDLE QWidgetPrivate::hd

Definition at line 754 of file qwidget_p.h.

Referenced by create_sys(), qt_grab_cursor(), and qt_tablet_cleanup_wce().

◆ high_attributes

uint QWidgetPrivate::high_attributes[4]

Definition at line 767 of file qwidget_p.h.

Referenced by QWidgetPrivate(), and setAttribute_internal().

◆ ic

QPointer<QInputContext> QWidgetPrivate::ic

Definition at line 717 of file qwidget_p.h.

Referenced by QDateTimeEditPrivate::validateAndInterpret().

◆ imHints

Qt::InputMethodHints QWidgetPrivate::imHints

Definition at line 718 of file qwidget_p.h.

Referenced by QWidget::inputMethodQuery().

◆ inDirtyList

uint QWidgetPrivate::inDirtyList

Definition at line 772 of file qwidget_p.h.

Referenced by QWidgetBackingStore::addDirtyWidget().

◆ inheritedFontResolveMask

uint QWidgetPrivate::inheritedFontResolveMask

Definition at line 742 of file qwidget_p.h.

Referenced by QGraphicsProxyWidget::event(), and updateFont().

◆ inheritedPaletteResolveMask

uint QWidgetPrivate::inheritedPaletteResolveMask

Definition at line 743 of file qwidget_p.h.

Referenced by QGraphicsProxyWidget::event(), and propagatePaletteChange().

◆ inheritsInputMethodHints

uint QWidgetPrivate::inheritsInputMethodHints

◆ inSetParent

uint QWidgetPrivate::inSetParent

Definition at line 780 of file qwidget_p.h.

◆ instanceCounter

int QWidgetPrivate::instanceCounter = 0
static

Definition at line 752 of file qwidget_p.h.

Referenced by init(), QApplication::~QApplication(), and QWidget::~QWidget().

◆ isGLWidget

uint QWidgetPrivate::isGLWidget

Definition at line 775 of file qwidget_p.h.

Referenced by qt_reg_winclass().

◆ isMoved

uint QWidgetPrivate::isMoved

Definition at line 774 of file qwidget_p.h.

Referenced by moveRect(), and QWidgetBackingStore::sync().

◆ isOpaque

uint QWidgetPrivate::isOpaque

◆ isScrolled

uint QWidgetPrivate::isScrolled

Definition at line 773 of file qwidget_p.h.

Referenced by QWidgetBackingStore::sync().

◆ keyboardGrabber

QWidget * QWidgetPrivate::keyboardGrabber = 0
static

Definition at line 787 of file qwidget_p.h.

Referenced by qstring_to_xtp().

◆ layout

QLayout* QWidgetPrivate::layout

◆ leftLayoutItemMargin

signed char QWidgetPrivate::leftLayoutItemMargin

Definition at line 748 of file qwidget_p.h.

Referenced by fromLayoutItemRect(), and toLayoutItemRect().

◆ leftmargin

short QWidgetPrivate::leftmargin

◆ locale

QLocale QWidgetPrivate::locale

Definition at line 757 of file qwidget_p.h.

◆ mapper

QWidgetMapper * QWidgetPrivate::mapper = 0
static

◆ maxInstances

int QWidgetPrivate::maxInstances = 0
static

Definition at line 753 of file qwidget_p.h.

Referenced by init(), QApplication::~QApplication(), and QWidget::~QWidget().

◆ mouseGrabber

QWidget * QWidgetPrivate::mouseGrabber = 0
static

Definition at line 786 of file qwidget_p.h.

Referenced by qstring_to_xtp().

◆ needsFlush

QRegion* QWidgetPrivate::needsFlush

◆ opaqueChildren

QRegion QWidgetPrivate::opaqueChildren

Definition at line 725 of file qwidget_p.h.

Referenced by getOpaqueChildren().

◆ picture

Qt::HANDLE QWidgetPrivate::picture

Definition at line 785 of file qwidget_p.h.

◆ polished

const QMetaObject* QWidgetPrivate::polished
mutable

Definition at line 709 of file qwidget_p.h.

◆ redirectDev

QPaintDevice* QWidgetPrivate::redirectDev

Definition at line 706 of file qwidget_p.h.

Referenced by QPainter::redirected().

◆ redirectOffset

QPoint QWidgetPrivate::redirectOffset

Definition at line 758 of file qwidget_p.h.

◆ rightLayoutItemMargin

signed char QWidgetPrivate::rightLayoutItemMargin

Definition at line 750 of file qwidget_p.h.

Referenced by fromLayoutItemRect(), and toLayoutItemRect().

◆ rightmargin

short QWidgetPrivate::rightmargin

◆ size_policy

QSizePolicy QWidgetPrivate::size_policy

Definition at line 756 of file qwidget_p.h.

Referenced by QTabWidgetPrivate::hasHeightForWidth().

◆ statusTip

QString QWidgetPrivate::statusTip

Definition at line 731 of file qwidget_p.h.

◆ toolTip

QString QWidgetPrivate::toolTip

Definition at line 728 of file qwidget_p.h.

◆ topLayoutItemMargin

signed char QWidgetPrivate::topLayoutItemMargin

Definition at line 749 of file qwidget_p.h.

Referenced by fromLayoutItemRect(), and toLayoutItemRect().

◆ topmargin

short QWidgetPrivate::topmargin

◆ usesDoubleBufferedGLContext

uint QWidgetPrivate::usesDoubleBufferedGLContext

Definition at line 776 of file qwidget_p.h.

◆ whatsThis

QString QWidgetPrivate::whatsThis

Definition at line 734 of file qwidget_p.h.

Referenced by QMenuPrivate::activateAction().

◆ widgetItem

QWidgetItemV2* QWidgetPrivate::widgetItem

◆ xinfo

QX11Info QWidgetPrivate::xinfo

Definition at line 784 of file qwidget_p.h.


The documentation for this class was generated from the following files: