![]() |
Qt 6.x
The Qt SDK
|
The QWidget class is the base class of all user interface objects. More...
#include <qwidget.h>
Inherits QObject, and QPaintDevice.
Inherited by BasicOperations, ButtonWidget, CombinedTransformation, DummyWidget, MyButtonWidget, MyClass, MyWidget, QAbstractButton, QAbstractSlider, QAbstractSpinBox, QAlphaWidget, QBalloonTip, QCalendarPopup, QCalendarWidget, QColumnViewGrip, QComboBox, QComboBoxPrivateScroller, QCupsJobWidget, QDialog, QDialogButtonBox, QDockWidget, QFocusFrame, QFrame, QGroupBox, QKeySequenceEdit, QLineEdit, QMainWindow, QMdi::ControlLabel, QMdi::ControllerWidget, QMdiSubWindow, QMenu, QMenuBar, QMenuPrivate::ScrollerTearOffItem, QMovableTabWidget, QOpenGLWidget, QPagePreview, QPageSetupWidget, QPrintPreviewWidget, QProgressBar, QQuickWidget, QRollEffect, QRubberBand, QSizeGrip, QSplashScreen, QSplitterHandle, QStatusBar, QSvgWidget, QSystemTrayIconSys, QTabBar, QTabWidget, QToolBar, QToolBarSeparator, QUnixPrintWidget, QVideoWidget, QWhatsThat, QWindowContainer, QWizardAntiFlickerWidget, QWizardHeader, QWizardPage, QtPrivate::QColorLuminancePicker, QtPrivate::QColorShower, QtPrivate::QWellArray, SimpleTransformation, Widget, Window, doc_src_coordsys::SnippetWrappers, droparea::DropArea, dropevents::Window, droprectangle::Window, plaintextlayout::Window, src_gui_image_qicon::MyWidget, src_gui_itemviews_qstandarditemmodel::MyWidget, src_gui_kernel_qguiapplication::MyMainWidget, src_gui_kernel_qkeysequence::Wrapper, src_gui_painting_qpainter2::MyWidget, src_gui_painting_qpainter::MyWidget, and src_gui_util_qvalidator::Wrapper.
Public Types | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
This enum describes how to render the widget when calling QWidget::render(). More... | |
![]() | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots | |
void | setEnabled (bool) |
void | setDisabled (bool) |
Disables widget input events if disable is true; otherwise enables input events. | |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}. | |
void | update () |
Updates the widget unless updates are disabled or the widget is hidden. | |
void | repaint () |
Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. | |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
Convenience function, equivalent to setVisible(!hidden). | |
void | show () |
Shows the widget and its child widgets. | |
void | hide () |
Hides the widget. | |
void | showMinimized () |
Shows the widget minimized, as an icon. | |
void | showMaximized () |
Shows the widget maximized. | |
void | showFullScreen () |
Shows the widget in full-screen mode. | |
void | showNormal () |
Restores the widget after it has been maximized or minimized. | |
bool | close () |
Closes this widget. | |
void | raise () |
Raises this widget to the top of the parent widget's stack. | |
void | lower () |
Lowers the widget to the bottom of the parent widget's stack. | |
![]() | |
void | deleteLater () |
\threadsafe | |
Signals | |
void | windowTitleChanged (const QString &title) |
This signal is emitted when the window's title has changed, with the new title as an argument. | |
void | windowIconChanged (const QIcon &icon) |
This signal is emitted when the window's icon has changed, with the new icon as an argument. | |
void | windowIconTextChanged (const QString &iconText) |
This signal is emitted when the window's icon text has changed, with the new iconText as an argument. | |
void | customContextMenuRequested (const QPoint &pos) |
This signal is emitted when the widget's \l contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. | |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
Public Member Functions | |
QWidget (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
Constructs a widget which is a child of parent, with widget flags set to f. | |
~QWidget () | |
Destroys the widget. | |
int | devType () const override |
WId | winId () const |
Returns the window system identifier of the widget. | |
void | createWinId () |
WId | internalWinId () const |
WId | effectiveWinId () const |
QStyle * | style () const |
void | setStyle (QStyle *) |
Sets the widget's GUI style to style. | |
bool | isWindow () const |
Returns true if the widget is an independent window, otherwise returns false . | |
bool | isModal () const |
Qt::WindowModality | windowModality () const |
void | setWindowModality (Qt::WindowModality windowModality) |
bool | isEnabled () const |
bool | isEnabledTo (const QWidget *) const |
Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false . | |
QRect | frameGeometry () const |
const QRect & | geometry () const |
QRect | normalGeometry () const |
int | x () const |
int | y () const |
QPoint | pos () const |
QSize | frameSize () const |
QSize | size () const |
int | width () const |
int | height () const |
QRect | rect () const |
QRect | childrenRect () const |
QRegion | childrenRegion () const |
QSize | minimumSize () const |
QSize | maximumSize () const |
int | minimumWidth () const |
int | minimumHeight () const |
int | maximumWidth () const |
int | maximumHeight () const |
void | setMinimumSize (const QSize &) |
void | setMinimumSize (int minw, int minh) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function corresponds to setMinimumSize(QSize(minw, minh)). | |
void | setMaximumSize (const QSize &) |
void | setMaximumSize (int maxw, int maxh) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function corresponds to setMaximumSize(QSize(maxw, maxh)). | |
void | setMinimumWidth (int minw) |
void | setMinimumHeight (int minh) |
void | setMaximumWidth (int maxw) |
void | setMaximumHeight (int maxh) |
QSize | sizeIncrement () const |
void | setSizeIncrement (const QSize &) |
void | setSizeIncrement (int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the x (width) size increment to w and the y (height) size increment to h. | |
QSize | baseSize () const |
void | setBaseSize (const QSize &) |
void | setBaseSize (int basew, int baseh) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setBaseSize(QSize(basew, baseh)). | |
void | setFixedSize (const QSize &) |
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. | |
void | setFixedSize (int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the width of the widget to w and the height to h. | |
void | setFixedWidth (int w) |
Sets both the minimum and maximum width of the widget to w without changing the heights. | |
void | setFixedHeight (int h) |
Sets both the minimum and maximum heights of the widget to h without changing the widths. | |
QPointF | mapToGlobal (const QPointF &) const |
Translates the widget coordinate pos to global screen coordinates. | |
QPoint | mapToGlobal (const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | mapFromGlobal (const QPointF &) const |
Translates the global screen coordinate pos to widget coordinates. | |
QPoint | mapFromGlobal (const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | mapToParent (const QPointF &) const |
Translates the widget coordinate pos to a coordinate in the parent widget. | |
QPoint | mapToParent (const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | mapFromParent (const QPointF &) const |
Translates the parent widget coordinate pos to widget coordinates. | |
QPoint | mapFromParent (const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | mapTo (const QWidget *, const QPointF &) const |
Translates the widget coordinate pos to the coordinate system of parent. | |
QPoint | mapTo (const QWidget *, const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | mapFrom (const QWidget *, const QPointF &) const |
Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. | |
QPoint | mapFrom (const QWidget *, const QPoint &) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QWidget * | window () const |
Returns the window for this widget, i.e. | |
QWidget * | nativeParentWidget () const |
QWidget * | topLevelWidget () const |
const QPalette & | palette () const |
void | setPalette (const QPalette &) |
void | setBackgroundRole (QPalette::ColorRole) |
Sets the background role of the widget to role. | |
QPalette::ColorRole | backgroundRole () const |
Returns the background role of the widget. | |
void | setForegroundRole (QPalette::ColorRole) |
Sets the foreground role of the widget to role. | |
QPalette::ColorRole | foregroundRole () const |
Returns the foreground role. | |
const QFont & | font () const |
void | setFont (const QFont &) |
QFontMetrics | fontMetrics () const |
Returns the font metrics for the widget's current font. | |
QFontInfo | fontInfo () const |
Returns the font info for the widget's current font. | |
QCursor | cursor () const |
void | setCursor (const QCursor &) |
void | unsetCursor () |
void | setMouseTracking (bool enable) |
bool | hasMouseTracking () const |
bool | underMouse () const |
Returns true if the widget is under the mouse cursor; otherwise returns false . | |
void | setTabletTracking (bool enable) |
bool | hasTabletTracking () const |
void | setMask (const QBitmap &) |
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. | |
void | setMask (const QRegion &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Causes only the parts of the widget which overlap region to be visible. | |
QRegion | mask () const |
Returns the mask currently set on a widget. | |
void | clearMask () |
Removes any mask set by setMask(). | |
void | render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren)) |
void | render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren)) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Renders the widget into the painter's QPainter::device(). | |
Q_INVOKABLE QPixmap | grab (const QRect &rectangle=QRect(QPoint(0, 0), QSize(-1, -1))) |
void | grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags()) |
Subscribes the widget to a given gesture with specific flags. | |
void | ungrabGesture (Qt::GestureType type) |
Unsubscribes the widget from a given gesture type. | |
QString | styleSheet () const |
QString | windowTitle () const |
void | setWindowIcon (const QIcon &icon) |
QIcon | windowIcon () const |
void | setWindowIconText (const QString &) |
QString | windowIconText () const |
void | setWindowRole (const QString &) |
Sets the window's role to role. | |
QString | windowRole () const |
Returns the window's role, or an empty string. | |
void | setWindowFilePath (const QString &filePath) |
QString | windowFilePath () const |
void | setWindowOpacity (qreal level) |
qreal | windowOpacity () const |
bool | isWindowModified () const |
void | setLayoutDirection (Qt::LayoutDirection direction) |
Qt::LayoutDirection | layoutDirection () const |
void | unsetLayoutDirection () |
void | setLocale (const QLocale &locale) |
QLocale | locale () const |
void | unsetLocale () |
bool | isRightToLeft () const |
bool | isLeftToRight () const |
bool | isActiveWindow () const |
void | activateWindow () |
Sets the top-level widget containing this widget to be the active window. | |
void | clearFocus () |
Takes keyboard input focus from the widget. | |
void | setFocus (Qt::FocusReason reason) |
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}. | |
Qt::FocusPolicy | focusPolicy () const |
void | setFocusPolicy (Qt::FocusPolicy policy) |
bool | hasFocus () const |
void | setFocusProxy (QWidget *) |
Sets the widget's focus proxy to widget w. | |
QWidget * | focusProxy () const |
Returns the focus proxy, or \nullptr if there is no focus proxy. | |
Qt::ContextMenuPolicy | contextMenuPolicy () const |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | grabMouse () |
Grabs the mouse input. | |
void | grabMouse (const QCursor &) |
void | releaseMouse () |
Releases the mouse grab. | |
void | grabKeyboard () |
Grabs the keyboard input. | |
void | releaseKeyboard () |
Releases the keyboard grab. | |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut) |
Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. | |
void | releaseShortcut (int id) |
Removes the shortcut with the given id from Qt's shortcut system. | |
void | setShortcutEnabled (int id, bool enable=true) |
If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. | |
void | setShortcutAutoRepeat (int id, bool enable=true) |
bool | updatesEnabled () const |
void | setUpdatesEnabled (bool enable) |
void | update (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version updates a rectangle (x, y, w, h) inside the widget. | |
void | update (const QRect &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version updates a rectangle rect inside the widget. | |
void | update (const QRegion &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a region rgn inside the widget. | |
void | repaint (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a rectangle (x, y, w, h) inside the widget. | |
void | repaint (const QRect &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a rectangle rect inside the widget. | |
void | repaint (const QRegion &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a region rgn inside the widget. | |
void | stackUnder (QWidget *) |
Places the widget under w in the parent widget's stack. | |
void | move (int x, int y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to move(QPoint(x, y)). | |
void | move (const QPoint &) |
void | resize (int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to resize(QSize(w, h)). | |
void | resize (const QSize &) |
void | setGeometry (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). | |
void | setGeometry (const QRect &) |
QByteArray | saveGeometry () const |
bool | restoreGeometry (const QByteArray &geometry) |
void | adjustSize () |
Adjusts the size of the widget to fit its contents. | |
bool | isVisible () const |
bool | isVisibleTo (const QWidget *) const |
Returns true if this widget would become visible if ancestor is shown; otherwise returns false . | |
bool | isHidden () const |
Returns true if the widget is hidden, otherwise returns false . | |
bool | isMinimized () const |
bool | isMaximized () const |
bool | isFullScreen () const |
Qt::WindowStates | windowState () const |
Returns the current window state. | |
void | setWindowState (Qt::WindowStates state) |
Sets the window state to windowState. | |
void | overrideWindowState (Qt::WindowStates state) |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
QSizePolicy | sizePolicy () const |
void | setSizePolicy (QSizePolicy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. | |
virtual int | heightForWidth (int) const |
Returns the preferred height for this widget, given the width w. | |
virtual bool | hasHeightForWidth () const |
QRegion | visibleRegion () const |
Returns the unobscured region where paint events can occur. | |
void | setContentsMargins (int left, int top, int right, int bottom) |
Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. | |
void | setContentsMargins (const QMargins &margins) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QMargins | contentsMargins () const |
The contentsMargins function returns the widget's contents margins. | |
QRect | contentsRect () const |
Returns the area inside the widget's margins. | |
QLayout * | layout () const |
Returns the layout manager that is installed on this widget, or \nullptr if no layout manager is installed. | |
void | setLayout (QLayout *) |
Sets the layout manager for this widget to layout. | |
void | updateGeometry () |
Notifies the layout system that this widget has changed and may need to change geometry. | |
void | setParent (QWidget *parent) |
Sets the parent of the widget to parent, and resets the window flags. | |
void | setParent (QWidget *parent, Qt::WindowFlags f) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function also takes widget flags, f as an argument. | |
void | scroll (int dx, int dy) |
Scrolls the widget including its children dx pixels to the right and dy downward. | |
void | scroll (int dx, int dy, const QRect &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version only scrolls r and does not move the children of the widget. | |
QWidget * | focusWidget () const |
Returns the last child of this widget that setFocus had been called on. | |
QWidget * | nextInFocusChain () const |
Returns the next widget in this widget's focus chain. | |
QWidget * | previousInFocusChain () const |
The previousInFocusChain function returns the previous widget in this widget's focus chain. | |
bool | acceptDrops () const |
void | setAcceptDrops (bool on) |
void | addAction (QAction *action) |
Appends the action action to this widget's list of actions. | |
void | addActions (const QList< QAction * > &actions) |
Appends the actions actions to this widget's list of actions. | |
void | insertActions (QAction *before, const QList< QAction * > &actions) |
Inserts the actions actions to this widget's list of actions, before the action before. | |
void | insertAction (QAction *before, QAction *action) |
Inserts the action action to this widget's list of actions, before the action before. | |
void | removeAction (QAction *action) |
Removes the action action from this widget's list of actions. | |
QList< QAction * > | actions () const |
Returns the (possibly empty) list of this widget's actions. | |
QAction * | addAction (const QString &text) |
QAction * | addAction (const QIcon &icon, const QString &text) |
QAction * | addAction (const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection) |
QAction * | addAction (const QIcon &icon, const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename... Args, typename = compatible_action_slot_args<Args...>> | |
QAction * | addAction (const QString &text, Args &&...args) |
template<typename... Args, typename = compatible_action_slot_args<Args...>> | |
QAction * | addAction (const QIcon &icon, const QString &text, Args &&...args) |
QWidget * | parentWidget () const |
Returns the parent of this widget, or \nullptr if it does not have any parent widget. | |
void | setWindowFlags (Qt::WindowFlags type) |
Qt::WindowFlags | windowFlags () const |
Window flags are a combination of a type (e.g. | |
void | setWindowFlag (Qt::WindowType, bool on=true) |
void | overrideWindowFlags (Qt::WindowFlags type) |
Sets the window flags for the widget to flags, without telling the window system. | |
Qt::WindowType | windowType () const |
Returns the window type of this widget. | |
QWidget * | childAt (int x, int y) const |
Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. | |
QWidget * | childAt (const QPoint &p) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the visible child widget at point p in the widget's own coordinate system. | |
void | setAttribute (Qt::WidgetAttribute, bool on=true) |
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. | |
bool | testAttribute (Qt::WidgetAttribute) const |
Returns true if attribute attribute is set on this widget; otherwise returns false . | |
QPaintEngine * | paintEngine () const override |
Returns the widget's paint engine. | |
void | ensurePolished () const |
Ensures that the widget and its children have been polished by QStyle (i.e., have a proper font and palette). | |
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, and both widgets are within the same window; otherwise returns false . | |
bool | autoFillBackground () const |
void | setAutoFillBackground (bool enabled) |
QBackingStore * | backingStore () const |
QWindow * | windowHandle () const |
If this is a native widget, return the associated QWindow. | |
QScreen * | screen () const |
Returns the screen the widget is on. | |
void | setScreen (QScreen *) |
Sets the screen on which the widget should be shown to screen. | |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery) const |
This method is only relevant for input widgets. | |
Qt::InputMethodHints | inputMethodHints () const |
void | setInputMethodHints (Qt::InputMethodHints hints) |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
![]() | |
virtual | ~QPaintDevice () |
virtual int | devType () const |
bool | paintingActive () const |
virtual QPaintEngine * | paintEngine () const =0 |
int | width () const |
int | height () const |
int | widthMM () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
qreal | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | colorCount () const |
int | depth () const |
Static Public Member Functions | |
static void | setTabOrder (QWidget *, QWidget *) |
Puts the second widget after the first widget in the focus order. | |
static void | setTabOrder (std::initializer_list< QWidget * > widgets) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
static QWidget * | mouseGrabber () |
Returns the widget that is currently grabbing the mouse input. | |
static QWidget * | keyboardGrabber () |
Returns the widget that is currently grabbing the keyboard input. | |
static QWidget * | find (WId) |
Returns a pointer to the widget with window identifier/handle id. | |
static QWidget * | createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags()) |
Creates a QWidget that makes it possible to embed window into a QWidget-based application. | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
static qreal | devicePixelRatioFScale () |
Protected Slots | |
void | updateMicroFocus (Qt::InputMethodQuery query=Qt::ImQueryAll) |
Updates the widget's micro focus and informs input methods that the state specified by query has changed. | |
Protected Member Functions | |
bool | event (QEvent *event) override |
This is the main event handler; it handles event event. | |
virtual void | mousePressEvent (QMouseEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget. | |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. | |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget. | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. | |
virtual void | keyPressEvent (QKeyEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget. | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. | |
virtual void | focusInEvent (QFocusEvent *event) |
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. | |
virtual void | focusOutEvent (QFocusEvent *event) |
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. | |
virtual void | enterEvent (QEnterEvent *event) |
This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. | |
virtual void | leaveEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. | |
virtual void | paintEvent (QPaintEvent *event) |
This event handler can be reimplemented in a subclass to receive paint events passed in event. | |
virtual void | moveEvent (QMoveEvent *event) |
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. | |
virtual void | resizeEvent (QResizeEvent *event) |
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. | |
virtual void | closeEvent (QCloseEvent *event) |
This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. | |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. | |
virtual void | actionEvent (QActionEvent *event) |
This event handler is called with the given event whenever the widget's actions are changed. | |
virtual void | showEvent (QShowEvent *event) |
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. | |
virtual void | hideEvent (QHideEvent *event) |
This event handler can be reimplemented in a subclass to receive widget hide events. | |
virtual bool | nativeEvent (const QByteArray &eventType, void *message, qintptr *result) |
This special event handler can be reimplemented in a subclass to receive native platform events identified by eventType which are passed in the message parameter. | |
virtual void | changeEvent (QEvent *) |
This event handler can be reimplemented to handle state changes. | |
int | metric (PaintDeviceMetric) const override |
Internal implementation of the virtual QPaintDevice::metric() function. | |
void | initPainter (QPainter *painter) const override |
Initializes the painter pen, background and font to the same as the given widget's. | |
QPaintDevice * | redirected (QPoint *offset) const override |
QPainter * | sharedPainter () const override |
virtual void | inputMethodEvent (QInputMethodEvent *) |
This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. | |
void | create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true) |
Creates a new widget window. | |
void | destroy (bool destroyWindow=true, bool destroySubWindows=true) |
Frees up window system resources. | |
virtual bool | focusNextPrevChild (bool next) |
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. | |
bool | focusNextChild () |
Finds a new widget to give the keyboard focus to, as appropriate for \uicontrol Tab, and returns true if it can find a new widget, or false if it can't. | |
bool | focusPreviousChild () |
Finds a new widget to give the keyboard focus to, as appropriate for \uicontrol Shift+Tab, and returns true if it can find a new widget, or false if it can't. | |
QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f) | |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
QPaintDevice () noexcept | |
virtual int | metric (PaintDeviceMetric metric) const |
virtual void | initPainter (QPainter *painter) const |
virtual QPaintDevice * | redirected (QPoint *offset) const |
virtual QPainter * | sharedPainter () const |
Properties | |
bool | modal |
whether the widget is a modal widget | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget | |
bool | enabled |
whether the widget is enabled | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget | |
int | x |
the x coordinate of the widget relative to its parent including any window frame | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame | |
QPoint | pos |
the position of the widget within its parent widget | |
QSize | frameSize |
the size of the widget including any window frame | |
QSize | size |
the size of the widget excluding any window frame | |
int | width |
the width of the widget excluding any window frame | |
int | height |
the height of the widget excluding any window frame | |
QRect | rect |
the internal geometry of the widget excluding any window frame | |
QRect | childrenRect |
the bounding rectangle of the widget's children | |
QRegion | childrenRegion |
the combined region occupied by the widget's children | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget | |
QSize | minimumSize |
the widget's minimum size | |
QSize | maximumSize |
the widget's maximum size in pixels | |
int | minimumWidth |
the widget's minimum width in pixels | |
int | minimumHeight |
the widget's minimum height in pixels | |
int | maximumWidth |
the widget's maximum width in pixels | |
int | maximumHeight |
the widget's maximum height in pixels | |
QSize | sizeIncrement |
the size increment of the widget | |
QSize | baseSize |
the base size of the widget | |
QPalette | palette |
the widget's palette | |
QFont | font |
the font currently set for the widget | |
QCursor | cursor |
the cursor shape for this widget | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget | |
bool | isActiveWindow |
whether this widget's window is the active window | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu | |
bool | updatesEnabled |
whether updates are enabled | |
bool | visible |
whether the widget is visible | |
bool | minimized |
whether this widget is minimized (iconified) | |
bool | maximized |
whether this widget is maximized | |
bool | fullScreen |
whether the widget is shown in full screen mode | |
QSize | sizeHint |
the recommended size for the widget | |
QSize | minimumSizeHint |
the recommended minimum size for the widget | |
bool | acceptDrops |
whether drop events are enabled for this widget | |
QString | windowTitle |
the window title (caption) | |
QIcon | windowIcon |
the widget's icon | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window | |
double | windowOpacity |
The level of opacity for the window. | |
bool | windowModified |
whether the document shown in the window has unsaved changes | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. | |
bool | autoFillBackground |
whether the widget background is filled automatically | |
QString | styleSheet |
the widget's style sheet | |
QLocale | locale |
the widget's locale | |
QString | windowFilePath |
the file path associated with a widget | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. | |
![]() | |
QString | objectName |
the name of this object | |
Friends | |
class | QDataWidgetMapperPrivate |
class | QBackingStoreDevice |
class | QWidgetRepaintManager |
class | QApplication |
class | QApplicationPrivate |
class | QGuiApplication |
class | QGuiApplicationPrivate |
class | QBaseApplication |
class | QPainter |
class | QPainterPrivate |
class | QPixmap |
class | QFontMetrics |
class | QFontInfo |
class | QLayout |
class | QWidgetItem |
class | QWidgetItemV2 |
class | QX11PaintEngine |
class | QWin32PaintEngine |
class | QShortcutPrivate |
class | QWindowSurface |
class | QGraphicsProxyWidget |
class | QGraphicsProxyWidgetPrivate |
class | QStyleSheetStyle |
struct | QWidgetExceptionCleaner |
class | QWidgetWindow |
class | QAccessibleWidget |
class | QAccessibleTable |
class | QAccessibleTabButton |
class | QGestureManager |
class | QWinNativePanGestureRecognizer |
class | QWidgetEffectSourcePrivate |
Q_WIDGETS_EXPORT QWidgetData * | qt_qwidget_data (QWidget *widget) |
Q_WIDGETS_EXPORT QWidgetPrivate * | qt_widget_private (QWidget *widget) |
Related Symbols | |
(Note that these are not member symbols.) | |
setupUi (QWidget *widget) | |
\macro QWIDGETSIZE_MAX | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Additional Inherited Members | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
ushort | painters |
The QWidget class is the base class of all user interface objects.
\inmodule QtWidgets
The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a Z-order. A widget is clipped by its parent and by the widgets in front of it.
A widget that is not embedded in a parent widget is called a window. Usually, windows have a frame and a title bar, although it is also possible to create windows without such decoration using suitable \l{Qt::WindowFlags}{window flags}. In Qt, QMainWindow and the various subclasses of QDialog are the most common window types.
Every widget's constructor accepts one or two standard arguments:
\list 1
{QWidget *parent = nullptr} is the parent of the new widget. If it is \nullptr (the default), the new widget will be a window. If not, it will be a child of parent, and be constrained by parent's geometry (unless you specify Qt::Window as window flag).
{Qt::WindowFlags f = { }} (where available) sets the window flags; the default is suitable for almost all widgets, but to get, for example, a window without a window system frame, you must use special flags. \endlistQWidget has many member functions, but some of them have little direct functionality; for example, QWidget has a font property, but never uses this itself. There are many subclasses which provide real functionality, such as QLabel, QPushButton, QListWidget, and QTabWidget.
enum QWidget::RenderFlag |
This enum describes how to render the widget when calling QWidget::render().
\value DrawWindowBackground If you enable this option, the widget's background is rendered into the target even if autoFillBackground is not set. By default, this option is enabled.
\value DrawChildren If you enable this option, the widget's children are rendered recursively into the target. By default, this option is enabled.
\value IgnoreMask If you enable this option, the widget's QWidget::mask() is ignored when rendering into the target. By default, this option is disabled.
Enumerator | |
---|---|
DrawWindowBackground | |
DrawChildren | |
IgnoreMask |
Constructs a widget which is a child of parent, with widget flags set to f.
If parent is \nullptr, the new widget becomes a window. If parent is another widget, this widget becomes a child window inside parent. The new widget is deleted when its parent is deleted.
The widget flags argument, f, is normally 0, but it can be set to customize the frame of a window (i.e. parent must be \nullptr). To customize the frame, use a value composed from the bitwise OR of any of the \l{Qt::WindowFlags}{window flags}.
If you add a child widget to an already visible widget you must explicitly show the child to make it visible.
Note that the X11 version of Qt may not be able to deliver all combinations of style flags on all systems. This is because on X11, Qt can only ask the window manager, and the window manager can override the application's settings. On Windows, Qt can set whatever flags you want.
Definition at line 852 of file qwidget.cpp.
References QWidgetExceptionCleaner::cleanup(), QObject::parent(), QT_CATCH, QT_RETHROW, and QT_TRY.
QWidget::~QWidget | ( | ) |
Destroys the widget.
All this widget's children are deleted first. The application exits if this widget is the main widget.
Definition at line 1414 of file qwidget.cpp.
References QWidgetPrivate::allWidgets, QActionPrivate::associatedObjects, className, clearFocus(), d, QEvent::Destroy, destroy(), QObject::destroyed(), QAbstractDeclarativeData::destroyed, QGestureManager::DontForceCreation, e, emit, hide(), QGuiApplicationPrivate::instance(), QGestureManager::instance(), QWidgetPrivate::instanceCounter, internalWinId(), QCoreApplicationPrivate::is_app_closing, isVisible(), isWindow(), it, manager, nullptr, QPaintDevice::paintingActive(), Q_ASSERT, Q_UNLIKELY, qApp, QT_CATCH, QT_RETHROW, QT_TRY, qWarning, QSet< T >::remove(), QList< T >::removeAll(), QCoreApplication::removePostedEvents(), QCoreApplication::sendEvent(), testAttribute(), Qt::WA_GrabbedShortcut, Qt::WA_StaticContents, and window().
|
protected |
Definition at line 866 of file qwidget.cpp.
References QWidgetExceptionCleaner::cleanup(), d, QObject::parent(), QT_CATCH, QT_RETHROW, and QT_TRY.
bool QWidget::acceptDrops | ( | ) | const |
Definition at line 3438 of file qwidget.cpp.
References testAttribute(), and Qt::WA_AcceptDrops.
|
protectedvirtual |
This event handler is called with the given event whenever the widget's actions are changed.
Reimplemented in QMenu, QMenuBar, QToolButton, QTornOffMenu, and QToolBar.
Definition at line 9881 of file qwidget.cpp.
Referenced by QToolButton::actionEvent(), and event().
Returns the (possibly empty) list of this widget's actions.
Definition at line 3214 of file qwidget.cpp.
References d.
Referenced by QMenuPrivate::actionAt(), QMenuPrivate::actionRect(), addActions(), QMenu::clear(), QMenuBar::clear(), QToolBar::clear(), QMenu::exec(), QMenuPrivate::getLastVisibleAction(), QMenuPrivate::hideMenu(), insertActions(), QMenu::isEmpty(), QMenuBar::minimumSizeHint(), QMenuSloppyState::processMouseEvent(), QToolButton::setDefaultAction(), QMenuPrivate::setFirstActionActive(), QMenuPrivate::syncPlatformMenu(), and QMenuPrivate::updateActionRects().
void QWidget::activateWindow | ( | ) |
Sets the top-level widget containing this widget to be the active window.
An active window is a visible top-level window that has the keyboard input focus.
This function performs the same operation as clicking the mouse on the title bar of a top-level window. On X11, the result depends on the Window Manager. If you want to ensure that the window is stacked on top as well you should also call raise(). Note that the window must be visible, otherwise activateWindow() has no effect.
On Windows, if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft does not allow an application to interrupt what the user is currently doing in another application.
Definition at line 12841 of file qwidget.cpp.
References window(), and windowHandle().
Referenced by EditorWindow::find(), setWindowState(), and showFullScreen().
Definition at line 3243 of file qwidget.cpp.
References addAction(), icon, ret, and text.
|
inline |
Definition at line 581 of file qwidget.h.
References args, QObject::connect(), icon, text, and QAction::triggered().
QAction * QWidget::addAction | ( | const QIcon & | icon, |
const QString & | text, | ||
const QObject * | receiver, | ||
const char * | member, | ||
Qt::ConnectionType | type = Qt::AutoConnection |
||
) |
Definition at line 3292 of file qwidget.cpp.
References addAction(), QObject::connect(), icon, SIGNAL, and text.
Definition at line 3236 of file qwidget.cpp.
References addAction(), ret, and text.
|
inline |
Definition at line 574 of file qwidget.h.
References args, QObject::connect(), text, and QAction::triggered().
QAction * QWidget::addAction | ( | const QString & | text, |
const QObject * | receiver, | ||
const char * | member, | ||
Qt::ConnectionType | type = Qt::AutoConnection |
||
) |
Definition at line 3284 of file qwidget.cpp.
References addAction(), QObject::connect(), SIGNAL, and text.
Appends the action action to this widget's list of actions.
All QWidgets have a list of \l{QAction}s, however they can be represented graphically in many different ways. The default use of the QAction list (as returned by actions()) is to create a context QMenu.
A QWidget should only have one of each action and adding an action it already has will not cause the same action to be in the widget twice.
The ownership of action is not transferred to this QWidget.
Definition at line 3124 of file qwidget.cpp.
References insertAction().
Referenced by addAction(), addAction(), addAction(), addAction(), and QToolButton::setDefaultAction().
Appends the actions actions to this widget's list of actions.
Definition at line 3134 of file qwidget.cpp.
References actions(), QList< T >::at(), i, insertAction(), and QList< T >::size().
Referenced by QMenu::exec(), and QMenuBarPrivate::updateGeometries().
void QWidget::adjustSize | ( | ) |
Adjusts the size of the widget to fit its contents.
This function uses sizeHint() if it is valid, i.e., the size hint's width and height are >= 0. Otherwise, it sets the size to the children rectangle that covers all child widgets (the union of all child widget rectangles).
For windows, the screen size is also taken into account. If the sizeHint() is less than (200, 100) and the size policy is \l{QSizePolicy::Expanding} {expanding}, the window will be at least (200, 100). The maximum size of a window is 2/3 of the screen's width and height.
Definition at line 8789 of file qwidget.cpp.
References d, ensurePolished(), and resize().
Referenced by QWidgetPrivate::prepareToRender(), QComboBox::setEditable(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowState(), and QComboBoxPrivateContainer::timerEvent().
bool QWidget::autoFillBackground | ( | ) | const |
Definition at line 313 of file qwidget.cpp.
References d.
QPalette::ColorRole QWidget::backgroundRole | ( | ) | const |
Returns the background role of the widget.
The background role defines the brush from the widget's \l palette that is used to render the background.
If no explicit background role is set, the widget inherits its parent widget's background role.
Definition at line 4367 of file qwidget.cpp.
References QPalette::NoRole, parentWidget(), Qt::SubWindow, and QPalette::Window.
Referenced by foregroundRole(), initPainter(), and QToolBoxPrivate::updateTabs().
QBackingStore * QWidget::backingStore | ( | ) | const |
Returns the QBackingStore this widget will be drawn into.
Definition at line 12252 of file qwidget.cpp.
References QTLWExtra::backingStore, QWidgetRepaintManager::backingStore(), and d.
Referenced by QWindowsVistaStylePrivate::backingStoreForWidget().
QSize QWidget::baseSize | ( | ) | const |
Definition at line 3881 of file qwidget.cpp.
References d.
This event handler can be reimplemented to handle state changes.
The state being changed in this event can be retrieved through the event supplied.
Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange, QEvent::ReadOnlyChange.
Reimplemented in QFrame, QLabel, QLineEdit, QMenu, QMenuBar, QRubberBand, QSplitter, QTabBar, QTabWidget, QToolBox, QToolButton, QMdiSubWindow, QErrorMessage, QFileDialog, QAbstractButton, QAbstractSlider, QComboBox, QComboBoxPrivateContainer, QColorDialog, QFontDialog, QMessageBox, QProgressDialog, QAbstractSpinBox, QDialogButtonBox, QDockWidget, QGroupBox, and QToolBar.
Definition at line 9428 of file qwidget.cpp.
References QCoreApplication::closingDown(), d, Qt::Desktop, QGuiApplication::desktopSettingsAware(), QEvent::EnabledChange, QEvent::FontChange, isVisible(), QEvent::MacSizeChange, QEvent::PaletteChange, QStyle::polish(), qApp, QCoreApplication::sendEvent(), QApplication::style(), QEvent::StyleChange, testAttribute(), QEvent::ThemeChange, QStyle::unpolish(), update(), updateGeometry(), Qt::WA_WState_Polished, and windowType().
Referenced by QFrame::changeEvent(), QLineEdit::changeEvent(), QMenu::changeEvent(), QMenuBar::changeEvent(), QRubberBand::changeEvent(), QTabBar::changeEvent(), QTabWidget::changeEvent(), QMdiSubWindow::changeEvent(), QErrorMessage::changeEvent(), QFileDialog::changeEvent(), QAbstractButton::changeEvent(), QAbstractSlider::changeEvent(), QComboBox::changeEvent(), QColorDialog::changeEvent(), QFontDialog::changeEvent(), QMessageBox::changeEvent(), QProgressDialog::changeEvent(), QAbstractSpinBox::changeEvent(), QDialogButtonBox::changeEvent(), QDockWidget::changeEvent(), QGroupBox::changeEvent(), QToolBar::changeEvent(), and event().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the visible child widget at point p in the widget's own coordinate system.
Definition at line 10456 of file qwidget.cpp.
|
inline |
Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system.
If there is no visible child widget at the specified position, the function returns \nullptr.
Definition at line 798 of file qwidget.h.
Referenced by QToolBar::actionAt(), QDialog::contextMenuEvent(), QMainWindow::contextMenuEvent(), QWidgetWindow::handleEnterLeaveEvent(), QToolBarPrivate::mousePressEvent(), and QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent().
QRect QWidget::childrenRect | ( | ) | const |
Definition at line 3700 of file qwidget.cpp.
References d, i, and qobject_cast< QWidget * >().
QRegion QWidget::childrenRegion | ( | ) | const |
Definition at line 3724 of file qwidget.cpp.
References d, i, qobject_cast< QWidget * >(), and QRegion::translated().
void QWidget::clearFocus | ( | ) |
Takes keyboard input focus from the widget.
If the widget has active focus, a \l{focusOutEvent()}{focus out event} is sent to this widget to tell it that it has lost the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
Definition at line 6706 of file qwidget.cpp.
References QInputMethod::commit(), emit, QEvent::FocusAboutToChange, QWidgetWindow::focusObject(), QWindow::focusObjectChanged(), focusWidget(), hasFocus(), QGuiApplication::inputMethod(), Qt::OtherFocusReason, parentWidget(), QCoreApplication::sendEvent(), QApplicationPrivate::setFocusWidget(), testAttribute(), Qt::WA_InputMethodEnabled, window(), and QTLWExtra::window.
Referenced by ~QWidget(), QWidgetWindowPrivate::clearFocusObject(), QWidgetPrivate::reparentFocusWidgets(), QMdiSubWindowPrivate::setActive(), QStackedLayout::setCurrentIndex(), and setParent().
void QWidget::clearMask | ( | ) |
Removes any mask set by setMask().
Definition at line 13077 of file qwidget.cpp.
Referenced by QSplitterHandle::resizeEvent(), and QComboBoxPrivateContainer::resizeEvent().
|
slot |
Closes this widget.
Returns true
if the widget was closed; otherwise returns false
.
First it sends the widget a QCloseEvent. The widget is \l{hide()}{hidden} if it \l{QEvent::accept()}{accepts} the close event. If it \l{QEvent::ignore()}{ignores} the event, nothing happens. The default implementation of QWidget::closeEvent() accepts the close event.
If the widget has the Qt::WA_DeleteOnClose flag, the widget is also deleted. A close events is delivered to the widget no matter if the widget is visible or not.
The \l QGuiApplication::lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.
Definition at line 8608 of file qwidget.cpp.
Referenced by QMdiAreaPrivate::_q_closeTab(), QApplicationPrivate::closeAllPopups(), QWidgetPlatformMenu::dismiss(), QMdiSubWindow::eventFilter(), QSplashScreen::finish(), QMenuPrivate::hideMenu(), QTipLabel::hideTipImmediately(), QWhatsThat::keyPressEvent(), QMenu::keyPressEvent(), keyPressEvent(), QMdiSubWindow::mouseDoubleClickEvent(), QWhatsThat::mousePressEvent(), QBalloonTip::mousePressEvent(), mousePressEvent(), QWhatsThat::mouseReleaseEvent(), QProgressDialog::setAutoClose(), QtPrivate::QWellArray::setSelected(), and QBalloonTip::timerEvent().
|
protectedvirtual |
This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system.
By default, the event is accepted and the widget is closed. You can reimplement this function to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling \l{QEvent::}{ignore()} on all events.
Main window applications typically use reimplementations of this function to check whether the user's work has been saved and ask for permission before closing.
Reimplemented in QDialog, QAlphaWidget, QRollEffect, QMdiSubWindow, MainWindow, QMessageBox, QProgressDialog, QAbstractSpinBox, and QDockWidget.
Definition at line 9902 of file qwidget.cpp.
Referenced by QAlphaWidget::closeEvent(), QRollEffect::closeEvent(), QAbstractSpinBox::closeEvent(), QDockWidget::closeEvent(), and event().
QMargins QWidget::contentsMargins | ( | ) | const |
The contentsMargins function returns the widget's contents margins.
Definition at line 7740 of file qwidget.cpp.
References d, testAttribute(), and Qt::WA_ContentsMarginsRespectsSafeArea.
Referenced by contentsRect(), QDockAreaLayoutItem::maximumSize(), QDockAreaLayoutItem::minimumSize(), QCalendarWidget::minimumSizeHint(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QComboBox::showPopup(), and QDockAreaLayoutItem::sizeHint().
QRect QWidget::contentsRect | ( | ) | const |
Returns the area inside the widget's margins.
Definition at line 7753 of file qwidget.cpp.
References contentsMargins(), and rect.
Referenced by QLayoutPrivate::doResize(), QFrame::frameRect(), QLineEdit::initStyleOption(), QtPrivate::QColorPicker::mouseMoveEvent(), QtPrivate::QColorPicker::mousePressEvent(), QSizeGrip::mousePressEvent(), QtPrivate::QColorPicker::paintEvent(), QLabel::paintEvent(), QSplitterHandle::paintEvent(), QSplitterHandle::resizeEvent(), QtPrivate::QColorPicker::setCol(), QSplitter::setRubberBand(), and QLabel::setScaledContents().
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events.
The handler is called when the widget's \l contextMenuPolicy is Qt::DefaultContextMenu.
The default implementation ignores the context event. See the \l QContextMenuEvent documentation for more details.
Reimplemented in QDialog, QLineEdit, QScrollBar, QMdiSubWindow, QComboBox, QLabel, and QMainWindow.
Definition at line 9921 of file qwidget.cpp.
Referenced by QScrollBar::contextMenuEvent(), and event().
Qt::ContextMenuPolicy QWidget::contextMenuPolicy | ( | ) | const |
Definition at line 7867 of file qwidget.cpp.
|
protected |
Creates a new widget window.
The parameters window, initializeWindow, and destroyOldWindow are ignored in Qt 5. Please use QWindow::fromWinId() to create a QWindow wrapping a foreign window and pass it to QWidget::createWindowContainer() instead.
Definition at line 1129 of file qwidget.cpp.
References Qt::AA_NativeWindows, d, Qt::Desktop, internalWinId(), isWindow(), QObject::parent(), parentWidget(), Q_ASSERT, Q_UNLIKELY, Q_UNUSED, qEnvironmentVariableIntValue(), qWarning, QWidgetRepaintManager, setAttribute(), Qt::SubWindow, testAttribute(), QCoreApplicationPrivate::testAttribute(), Qt::WA_DontCreateNativeAncestors, Qt::WA_DropSiteRegistered, Qt::WA_NativeWindow, Qt::WA_PaintOnScreen, Qt::WA_SetWindowIcon, Qt::WA_WState_Created, Qt::Widget, Qt::Window, window(), and windowType().
Referenced by QWidgetPrivate::create(), QQuickLabsPlatformMenuBar::insertMenu(), setParent(), QWidgetPrivate::setVisible(), and QComboBox::showPopup().
|
static |
Creates a QWidget that makes it possible to embed window into a QWidget-based application.
The window container is created as a child of parent and with window flags flags.
Once the window has been embedded into the container, the container will control the window's geometry and visibility. Explicit calls to QWindow::setGeometry(), QWindow::show() or QWindow::hide() on an embedded window is not recommended.
The container takes over ownership of window. The window can be removed from the window container with a call to QWindow::setParent().
The window container is attached as a native child window to the toplevel window it is a child of. When a window container is used as a child of a QAbstractScrollArea or QMdiArea, it will create a \l {Native Widgets vs Alien Widgets} {native window} for every widget in its parent chain to allow for proper stacking and clipping in this use case. Creating a native window for the window container also allows for proper stacking and clipping. This must be done before showing the window container. Applications with many native child windows may suffer from performance issues.
The window container has a number of known limitations:
\list
\endlist
Definition at line 168 of file qwindowcontainer.cpp.
References QObject::parent(), and window().
void QWidget::createWinId | ( | ) |
Ensures that the widget has a window system identifier, i.e. that it is known to the windowing system.
Definition at line 2448 of file qwidget.cpp.
References d.
Referenced by QSplashScreen::finish(), QMenuBarPrivate::handleReparent(), QWidgetPlatformDialog::show(), QWidgetPlatformMenu::showPopup(), and winId().
QCursor QWidget::cursor | ( | ) | const |
Definition at line 4955 of file qwidget.cpp.
References Qt::ArrowCursor, cursor, d, isWindow(), parentWidget(), testAttribute(), and Qt::WA_SetCursor.
This signal is emitted when the widget's \l contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget.
The position pos is the position of the context menu event that the widget receives. Normally this is in widget coordinates. The exception to this rule is QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the \l{QAbstractScrollArea::viewport()}{viewport()}.
Referenced by event().
|
protected |
Frees up window system resources.
Destroys the widget window if destroyWindow is true.
destroy() calls itself recursively for all the child widgets, passing destroySubWindows for the destroyWindow parameter. To have more control over destruction of subwidgets, destroy subwidgets selectively first.
This function is usually called from the QWidget destructor.
Definition at line 12419 of file qwidget.cpp.
References QApplicationPrivate::active_window, QList< T >::at(), QObject::children(), d, Qt::Desktop, destroy(), geometry, i, isWindow(), keyboardGrabber(), mouseGrabber(), parentWidget(), Qt::Popup, qApp, qobject_cast< QWidget * >(), releaseKeyboard(), releaseMouse(), QApplicationPrivate::setActiveWindow(), setAttribute(), QList< T >::size(), testAttribute(), Qt::WA_NativeWindow, Qt::WA_WState_Created, widget, windowHandle(), and windowType().
Referenced by ~QWidget(), destroy(), event(), and setParent().
|
overridevirtual |
Reimplemented from QPaintDevice.
Definition at line 881 of file qwidget.cpp.
References QInternal::Widget.
WId QWidget::effectiveWinId | ( | ) | const |
Returns the effective window system identifier of the widget, i.e. the native parent's window system identifier.
If the widget is native, this function returns the native widget ID. Otherwise, the window ID of the first native parent widget, i.e., the top-level widget that contains this widget, is returned.
Definition at line 2469 of file qwidget.cpp.
References internalWinId(), nativeParentWidget(), testAttribute(), and Qt::WA_WState_Created.
Referenced by QApplicationPrivate::dispatchEnterLeave().
void QWidget::ensurePolished | ( | ) | const |
Ensures that the widget and its children have been polished by QStyle (i.e., have a proper font and palette).
QWidget calls this function after it has been fully constructed but before it is shown the very first time. You can call this function if you want to ensure that the widget is polished before doing an operation, e.g., the correct font size might be needed in the widget's sizeHint() reimplementation. Note that this function is called from the default implementation of sizeHint().
Polishing is useful for final initialization that must happen after all constructors (from base classes as well as from subclasses) have been called.
If you need to change some settings when a widget is polished, reimplement event() and handle the QEvent::Polish event type.
{Note:} The function is declared const so that it can be called from other const functions (e.g., sizeHint()).
Definition at line 10206 of file qwidget.cpp.
References QList< T >::at(), QEvent::ChildPolished, QObject::children(), d, e, i, metaObject(), o, QEvent::Polish, qobject_cast< QWidget * >(), QCoreApplication::sendEvent(), and QList< T >::size().
Referenced by QTipLabel::QTipLabel(), QWhatsThat::QWhatsThat(), adjustSize(), event(), QMdiSubWindow::event(), QAbstractSpinBox::minimumSizeHint(), QCalendarWidget::minimumSizeHint(), QLabel::minimumSizeHint(), QLineEdit::minimumSizeHint(), QMdiSubWindow::minimumSizeHint(), QMenuBar::minimumSizeHint(), QSplitter::minimumSizeHint(), QWidgetPrivate::prepareToRender(), QGraphicsProxyWidgetPrivate::setWidget_helper(), showFullScreen(), showMaximized(), showMinimized(), showNormal(), QtPrivate::QWellArray::sizeHint(), DetailButton::sizeHint(), QAbstractSpinBox::sizeHint(), QCheckBox::sizeHint(), QDateTimeEdit::sizeHint(), QDockWidgetTitleButton::sizeHint(), QLineEdit::sizeHint(), QMdi::ControllerWidget::sizeHint(), QMenuBar::sizeHint(), QProgressBar::sizeHint(), QPushButton::sizeHint(), QRadioButton::sizeHint(), QScrollBar::sizeHint(), QSlider::sizeHint(), QSplitter::sizeHint(), QToolButton::sizeHint(), QSplitter::sizes(), QLayout::totalMaximumSize(), QLayout::totalMinimumSize(), QLayout::totalSizeHint(), and QComboBoxPrivate::updateViewContainerPaletteAndOpacity().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter.
An event is sent to the widget when the mouse cursor enters the widget.
Reimplemented in QComboBoxPrivateScroller, QMenu, QToolButton, and QDockWidgetTitleButton.
Definition at line 9761 of file qwidget.cpp.
Referenced by QToolButton::enterEvent(), QDockWidgetTitleButton::enterEvent(), QQuickWidget::event(), and event().
|
overrideprotectedvirtual |
This is the main event handler; it handles event event.
You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().
Mouse and tablet event handling is also slightly special: only when the widget is \l enabled, event() will call the specialized handlers such as mousePressEvent(); otherwise it will discard the event.
This function returns true
if the event was recognized, otherwise it returns false
. If the recognized event was accepted (see \l QEvent::accepted), any further processing such as event propagation to the parent widget stops.
Reimplemented from QObject.
Reimplemented in QWindowContainer, and QWizard.
Definition at line 8912 of file qwidget.cpp.
References QEvent::accept(), QEvent::ActionAdded, QEvent::ActionChanged, actionEvent(), QEvent::ActionRemoved, Qt::ActionsContextMenu, QEvent::ActivationChange, QPalette::Active, QApplication::activeModalWidget(), Qt::AltModifier, QEvent::ApplicationFontChange, QEvent::ApplicationLayoutDirectionChange, QEvent::ApplicationPaletteChange, QEvent::ApplicationWindowIconChange, QByteArray::at(), QList< T >::at(), changeEvent(), QEvent::Close, closeEvent(), QByteArray::constData(), QEvent::ContentsRectChange, QEvent::ContextMenu, contextMenuEvent(), Qt::ControlModifier, create(), Qt::CustomContextMenu, customContextMenuRequested(), d, Qt::DefaultContextMenu, Qt::Desktop, destroy(), QEvent::DevicePixelRatioChange, QWidgetPrivate::DirectionEast, QWidgetPrivate::DirectionNorth, QWidgetPrivate::DirectionSouth, QWidgetPrivate::DirectionWest, QEvent::DragEnter, QEvent::DragLeave, QEvent::DragMove, QEvent::Drop, QEvent::DynamicPropertyChange, QEvent::EmbeddingControl, emit, QEvent::EnabledChange, ensurePolished(), QEvent::Enter, enterEvent(), QObject::event(), QMenu::exec(), QEvent::FocusIn, focusInEvent(), focusNextPrevChild(), QEvent::FocusOut, focusOutEvent(), QApplication::font(), QEvent::FontChange, QEvent::Gesture, QContextMenuEvent::globalPos(), QHelpEvent::globalPos(), QEvent::Hide, hideEvent(), QEvent::HoverEnter, QEvent::HoverLeave, i, QEvent::IconTextChange, Qt::ImCursorRectangle, Qt::ImEnabled, QPalette::Inactive, QEvent::InputMethod, inputMethodEvent(), QEvent::InputMethodQuery, inputMethodQuery(), QEvent::isAccepted(), isEnabled(), isEqual(), isHidden(), isMinimized(), isVisible(), isWindow(), QKeyEvent::key(), Qt::Key_Backtab, Qt::Key_Down, Qt::Key_F1, Qt::Key_Left, Qt::Key_Right, Qt::Key_Tab, Qt::Key_Up, QEvent::KeyboardLayoutChange, QEvent::KeyPress, keyPressEvent(), QEvent::KeyRelease, keyReleaseEvent(), QEvent::LanguageChange, QEvent::LayoutDirectionChange, QEvent::Leave, leaveEvent(), QEvent::LocaleChange, QPaintDevice::logicalDpiY(), QEvent::MacSizeChange, mapToGlobal(), QEvent::ModifiedChange, QKeyEvent::modifiers(), QEvent::MouseButtonDblClick, QEvent::MouseButtonPress, QEvent::MouseButtonRelease, mouseDoubleClickEvent(), QEvent::MouseMove, mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), QEvent::MouseTrackingChange, QEvent::Move, moveEvent(), Qt::NavigationModeKeypadDirectional, Qt::NavigationModeKeypadTabOrder, Qt::NoButton, o, QEvent::Paint, paintEvent(), QGuiApplication::palette(), QApplication::palette(), palette, QEvent::PaletteChange, QEvent::ParentChange, QEvent::PlatformSurface, QEvent::Polish, QStyle::polish(), QEvent::PolishRequest, pos, Qt::PreventContextMenu, property, Q_FALLTHROUGH, qobject_cast< QWidget * >(), qstrncmp(), QInputMethodQueryEvent::queries(), QEvent::QueryWhatsThis, QEvent::ReadOnlyChange, QEvent::Resize, resizeEvent(), QEvent::ScreenChangeInternal, QCoreApplication::sendEvent(), setAttribute(), QObject::setProperty(), Qt::ShiftModifier, QEvent::ShortcutOverride, QEvent::Show, showEvent(), QWhatsThis::showText(), QToolTip::showText(), QEvent::ShowWindowRequest, QByteArray::size(), QList< T >::size(), style(), QEvent::StyleAnimationUpdate, QEvent::StyleChange, QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed, QPlatformSurfaceEvent::SurfaceCreated, QEvent::TabletMove, QEvent::TabletPress, QEvent::TabletRelease, QEvent::TabletTrackingChange, testAttribute(), QEvent::ThemeChange, QEvent::ToolBarChange, QEvent::ToolTip, QEvent::TouchBegin, QEvent::TouchCancel, QEvent::TouchEnd, QEvent::TouchUpdate, update(), QEvent::UpdateLater, QEvent::UpdateRequest, Qt::WA_InputMethodEnabled, Qt::WA_SetWindowIcon, Qt::WA_TabletTracking, Qt::WA_WState_Created, Qt::WA_WState_Polished, QEvent::WhatsThis, QEvent::Wheel, widget, win, window(), QEvent::WindowActivate, QEvent::WindowBlocked, QEvent::WindowDeactivate, windowHandle(), Qt::WindowMinimized, QEvent::WindowStateChange, QEvent::WindowTitleChange, windowType(), QEvent::WindowUnblocked, and winId().
Referenced by QSystemTrayIconSys::event(), QKeySequenceEdit::event(), QLineEdit::event(), QMenu::event(), QMenuBar::event(), QSizeGrip::event(), QSplitterHandle::event(), QStatusBar::event(), QTabBar::event(), QTabWidget::event(), QQuickWidget::event(), QOpenGLWidget::event(), QAbstractButton::event(), QAbstractSlider::event(), QCalendarPopup::event(), QFocusFrame::event(), QFrame::event(), QProgressBar::event(), QRubberBand::event(), QSplashScreen::event(), MyClass::event(), QWindowContainer::event(), MyWidget::event(), QAbstractSpinBox::event(), QCalendarWidget::event(), QComboBox::event(), QDialogButtonBox::event(), QDockWidget::event(), QGroupBox::event(), QMainWindow::event(), QMdi::ControlLabel::event(), QMdi::ControllerWidget::event(), QMdiSubWindow::event(), QToolBar::event(), and QVideoWidget::event().
|
static |
Returns a pointer to the widget with window identifier/handle id.
The window identifier type depends on the underlying window system, see qwindowdefs.h
for the actual definition. If there is no widget with this identifier, \nullptr is returned.
Definition at line 2334 of file qwidget.cpp.
References QWidgetPrivate::mapper.
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
The event is passed in the event parameter
A widget normally must setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)
The default implementation updates the widget (except for windows that do not specify a focusPolicy()).
Reimplemented in QtPrivate::QWellArray, QLineEdit, QMenuBar, QPushButton, QAbstractButton, QComboBox, QLabel, QAbstractSpinBox, QDateTimeEdit, QGroupBox, QQuickWidget, and QMdiSubWindow.
Definition at line 9711 of file qwidget.cpp.
References focusPolicy, isWindow(), Qt::NoFocus, and update().
Referenced by event(), QAbstractButton::focusInEvent(), QLabel::focusInEvent(), QAbstractSpinBox::focusInEvent(), and QGroupBox::focusInEvent().
|
inlineprotected |
Finds a new widget to give the keyboard focus to, as appropriate for \uicontrol Tab, and returns true
if it can find a new widget, or false if it can't.
|
protectedvirtual |
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true
if it can find a new widget, or false if it can't.
If next is true, this function searches forward, if next is false, it searches backward.
Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its "current active link" forward or backward, and call focusNextPrevChild() only when it reaches the last or first link on the "page".
Child widgets call focusNextPrevChild() on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you thus gain control of focus traversal for all child widgets.
Reimplemented in QDateTimeEdit, QLabel, QMenu, and QQuickWidget.
Definition at line 6800 of file qwidget.cpp.
References Qt::BacktabFocusReason, d, QEvent::FocusIn, QApplicationPrivate::focusNextPrevChild_helper(), isWindow(), next, parentWidget(), QWindowPrivate::platformWindow, qt_window_private(), Qt::SubWindow, Qt::TabFocusReason, window(), QPlatformWindow::windowEvent(), windowHandle(), and windowType().
Referenced by event(), QDateTimeEdit::focusNextPrevChild(), QLabel::focusNextPrevChild(), QScrollArea::focusNextPrevChild(), and QAbstractButton::keyPressEvent().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget.
The events is passed in the event parameter.
A widget normally must setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)
The default implementation updates the widget (except for windows that do not specify a focusPolicy()).
Reimplemented in QtPrivate::QWellArray, QKeySequenceEdit, QLineEdit, QMenuBar, QPushButton, QAbstractButton, QComboBox, QLabel, QAbstractSpinBox, QQuickWidget, and QMdiSubWindow.
Definition at line 9737 of file qwidget.cpp.
References focusPolicy, QInputMethod::hide(), QGuiApplication::inputMethod(), isWindow(), Qt::NoFocus, qApp, testAttribute(), update(), and Qt::WA_InputMethodEnabled.
Referenced by event(), QKeySequenceEdit::focusOutEvent(), QLineEdit::focusOutEvent(), QAbstractButton::focusOutEvent(), QLabel::focusOutEvent(), and QAbstractSpinBox::focusOutEvent().
Qt::FocusPolicy QWidget::focusPolicy | ( | ) | const |
Definition at line 7899 of file qwidget.cpp.
|
inlineprotected |
Finds a new widget to give the keyboard focus to, as appropriate for \uicontrol Shift+Tab, and returns true
if it can find a new widget, or false if it can't.
QWidget * QWidget::focusProxy | ( | ) | const |
Returns the focus proxy, or \nullptr if there is no focus proxy.
Definition at line 6452 of file qwidget.cpp.
References d.
Referenced by correctWidgetContext(), QWidgetPrivate::deepestFocusProxy(), QAbstractItemViewPrivate::selectAllInEditor(), setFocus(), and setTabOrder().
QWidget * QWidget::focusWidget | ( | ) | const |
Returns the last child of this widget that setFocus had been called on.
For top level widgets this is the widget that will get focus in case this window gets activated
This is not the same as QApplication::focusWidget(), which returns the focus widget in the currently active window.
Definition at line 6851 of file qwidget.cpp.
Referenced by QGroupBoxPrivate::_q_fixFocus(), QGraphicsScenePrivate::addPopup(), QMdiArea::addSubWindow(), clearFocus(), QWidgetWindowPrivate::clearFocusObject(), QApplicationPrivate::closePopup(), QApplicationPrivate::focusNextPrevChild_helper(), QWidgetWindow::focusObject(), QWidgetWindow::handleContextMenuEvent(), QWidgetWindow::handleGestureEvent(), QWidgetWindow::handleKeyEvent(), hasFocus(), QGraphicsProxyWidget::inputMethodQuery(), QMdiSubWindowPrivate::leaveInteractiveMode(), QApplicationPrivate::openPopup(), QGraphicsProxyWidgetPrivate::sendWidgetKeyEvent(), QApplicationPrivate::setActiveWindow(), setAttribute(), QMenuBarPrivate::setCurrentAction(), setFocus(), QMdiSubWindowPrivate::setFocusWidget(), setParent(), QDialogPrivate::setVisible(), QGraphicsViewPrivate::updateInputMethodSensitivity(), and QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget().
|
inline |
|
inline |
Returns the font metrics for the widget's current font.
Equivalent to QFontMetrics
(widget->font()).
Definition at line 847 of file qwidget.h.
Referenced by QWhatsThat::QWhatsThat(), QQC2::QCommonStyle::drawControl(), QCommonStyle::drawControl(), QStatusBar::event(), QStyleOption::initFrom(), QMenuBar::initStyleOption(), QTabBar::initStyleOption(), QAbstractSpinBox::minimumSizeHint(), QGroupBox::minimumSizeHint(), QLineEdit::minimumSizeHint(), QProgressBar::minimumSizeHint(), QLineEdit::paintEvent(), QCommonStyle::pixelMetric(), QStatusBar::reformat(), DetailButton::sizeHint(), QAbstractSpinBox::sizeHint(), QCheckBox::sizeHint(), QDateTimeEdit::sizeHint(), QProgressBar::sizeHint(), QPushButton::sizeHint(), QRadioButton::sizeHint(), QToolBoxButton::sizeHint(), QToolButton::sizeHint(), QQC2_NAMESPACE::QMacStyle::subControlRect(), QQC2::QCommonStyle::subControlRect(), QMacStyle::subControlRect(), QCommonStyle::subControlRect(), and QTabBar::tabSizeHint().
QPalette::ColorRole QWidget::foregroundRole | ( | ) | const |
Returns the foreground role.
The foreground role defines the color from the widget's \l palette that is used to draw the foreground.
If no explicit foreground role is set, the function returns a role that contrasts with the background role.
Definition at line 4418 of file qwidget.cpp.
References backgroundRole(), QPalette::Base, QPalette::Button, QPalette::ButtonText, d, QPalette::Dark, QPalette::Highlight, QPalette::HighlightedText, QPalette::Light, QPalette::NoRole, QPalette::Shadow, QPalette::Text, QPalette::ToolTipBase, QPalette::ToolTipText, and QPalette::WindowText.
Referenced by QCommonStyle::drawControl(), initPainter(), and QLabel::paintEvent().
QRect QWidget::frameGeometry | ( | ) | const |
Definition at line 3475 of file qwidget.cpp.
References QRect::bottom(), d, isWindow(), QRect::left(), Qt::Popup, QRect::right(), QRect::top(), and windowType().
QSize QWidget::frameSize | ( | ) | const |
Definition at line 7179 of file qwidget.cpp.
References QRect::bottom(), d, isWindow(), QRect::left(), Qt::Popup, QRect::right(), QRect::top(), and windowType().
Renders the widget into a pixmap restricted by the given rectangle. If the widget has any children, then they are also painted in the appropriate positions.
If a rectangle with an invalid size is specified (the default), the entire widget is painted.
Definition at line 5219 of file qwidget.cpp.
References d, QPaintDevice::devicePixelRatio(), dpr(), DrawChildren, DrawWindowBackground, IgnoreMask, QPixmap, rect, sendResizeEvents(), testAttribute(), QRect::topLeft(), Qt::transparent, Qt::WA_PendingResizeEvent, and Qt::WA_WState_Created.
Referenced by QRollEffect::QRollEffect(), and QAlphaWidget::run().
void QWidget::grabGesture | ( | Qt::GestureType | gesture, |
Qt::GestureFlags | flags = Qt::GestureFlags() |
||
) |
Subscribes the widget to a given gesture with specific flags.
Definition at line 12382 of file qwidget.cpp.
References d, QGestureManager::instance(), and void.
Referenced by QScroller::grabGesture(), and QGraphicsView::setupViewport().
void QWidget::grabKeyboard | ( | ) |
Grabs the keyboard input.
This widget receives all keyboard events until releaseKeyboard() is called; other widgets get no keyboard events at all. Mouse events are not affected. Use grabMouse() if you want to grab that.
The focus widget is not affected, except that it doesn't receive any keyboard events. setFocus() moves the focus as usual, but the new focus widget receives keyboard events only after releaseKeyboard() is called.
If a different widget is currently grabbing keyboard input, that widget's grab is released first.
Definition at line 12751 of file qwidget.cpp.
References grabberWindow(), keyboardGrb, releaseKeyboard(), and window().
Referenced by QWidgetResizeHandler::doResize(), and QWhatsThisPrivate::say().
void QWidget::grabMouse | ( | ) |
Grabs the mouse input.
This widget receives all mouse events until releaseMouse() is called; other widgets get no mouse events at all. Keyboard events are not affected. Use grabKeyboard() if you want to grab that.
-nograb
command line option while debugging.It is almost never necessary to grab the mouse when using Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the mouse when a mouse button is pressed and keeps it until the last button is released.
false
for a widget, that widget cannot call grabMouse().Definition at line 12683 of file qwidget.cpp.
References grabMouseForWidget().
Referenced by QWidgetResizeHandler::doResize(), and QWidgetResizeHandler::keyPressEvent().
Definition at line 12705 of file qwidget.cpp.
References cursor, and grabMouseForWidget().
int QWidget::grabShortcut | ( | const QKeySequence & | key, |
Qt::ShortcutContext | context = Qt::WindowShortcut |
||
) |
Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context.
If the context is Qt::ApplicationShortcut, the shortcut applies to the application as a whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut, or to the window itself, Qt::WindowShortcut.
If the same key sequence has been grabbed by several widgets, when the key sequence occurs a QEvent::Shortcut event is sent to all the widgets to which it applies in a non-deterministic order, but with the `‘ambiguous’' flag set to true.
Definition at line 11774 of file qwidget.cpp.
References context, QGuiApplicationPrivate::instance(), Q_ASSERT, qApp, qWidgetShortcutContextMatcher(), setAttribute(), and Qt::WA_GrabbedShortcut.
Referenced by QTabBar::insertTab(), QAbstractButton::setShortcut(), QTabBar::setTabText(), and QGroupBox::setTitle().
bool QWidget::hasFocus | ( | ) | const |
Definition at line 6471 of file qwidget.cpp.
References e, QApplication::focusWidget(), focusWidget(), and window().
Referenced by QFileDialogPrivate::_q_autoCompleteFileName(), QFileDialogPrivate::_q_selectionChanged(), QFontDialogPrivate::_q_sizeHighlighted(), clearFocus(), QLineEdit::event(), QStyleOption::initFrom(), QComboBox::initStyleOption(), QMenuBar::initStyleOption(), QLineEdit::inputMethodEvent(), QAbstractButton::keyPressEvent(), QMenuBar::leaveEvent(), QtPrivate::QWellArray::paintCell(), QMdiSubWindowPrivate::restoreFocus(), QTabBar::setCurrentIndex(), QDialogPrivate::setVisible(), and QMdiSubWindow::showShaded().
|
virtual |
Returns true
if the widget's preferred height depends on its width; otherwise returns false
.
Reimplemented in QTabWidget.
Definition at line 10435 of file qwidget.cpp.
References d.
Referenced by QWidgetWindowPrivate::closestAcceptableGeometry(), QWidgetItem::hasHeightForWidth(), heightForWidth(), and QSizeGrip::mousePressEvent().
|
inline |
Definition at line 856 of file qwidget.h.
References Qt::WA_MouseTracking.
Referenced by QPushButton::initStyleOption().
|
inline |
Definition at line 865 of file qwidget.h.
References Qt::WA_TabletTracking.
|
virtual |
Returns the preferred height for this widget, given the width w.
If this widget has a layout, the default implementation returns the layout's preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.
Reimplemented in QTabWidget, QCommandLinkButton, QLabel, and QMenuBar.
Definition at line 10422 of file qwidget.cpp.
References hasHeightForWidth(), layout(), and QLayout::totalHeightForWidth().
Referenced by QWidgetItem::heightForWidth(), QLabel::heightForWidth(), menuBarHeightForWidth(), QWidgetItem::minimumHeightForWidth(), and QScrollAreaPrivate::updateScrollBars().
|
slot |
Hides the widget.
This function is equivalent to setVisible(false).
Definition at line 8209 of file qwidget.cpp.
References setVisible().
Referenced by QtPrivate::QColorShower::QColorShower(), QToolBarLayout::QToolBarLayout(), QDialog::~QDialog(), ~QWidget(), QCalendarWidgetPrivate::_q_yearClicked(), QCalendarWidgetPrivate::_q_yearEditingFinished(), QCalendarWidgetPrivate::createNavigationBar(), QWidgetAction::deleteWidget(), QSystemTrayIconPrivate::destroyIcon(), QWizardPrivate::disableUpdates(), QComboBoxPrivate::doHidePopup(), QWizardPrivate::ensureButton(), QInputDialogPrivate::ensureComboBox(), QInputDialogPrivate::ensureDoubleSpinBox(), QInputDialogPrivate::ensureIntSpinBox(), QInputDialogPrivate::ensureLineEdit(), QFocusFrame::eventFilter(), QWidgetPlatformColorDialog::hide(), QWidgetPlatformFileDialog::hide(), QWidgetPlatformFontDialog::hide(), QWidgetPlatformMessageDialog::hide(), QBalloonTip::hideBalloon(), QMenuBarPrivate::init(), QTabBarPrivate::init(), QStackedLayout::insertWidget(), QStatusBar::insertWidget(), QDialogButtonBoxPrivate::layoutButtons(), QTabBarPrivate::layoutTabs(), QMenuBar::mousePressEvent(), QSplashScreen::mousePressEvent(), QStatusBar::removeWidget(), QAlphaWidget::render(), QSplitter::replaceWidget(), QProgressDialog::reset(), QDockAreaLayoutInfo::restoreState(), QTabBar::setAutoHide(), QWizardPrivate::setButtonLayout(), QMenuBarPrivate::setCurrentAction(), QStackedLayout::setCurrentIndex(), QToolBarLayout::setGeometry(), QInputDialogPrivate::setInputWidget(), setParent(), QWatermarkLabel::setSideWidget(), QTabBar::setTabButton(), QFocusFrame::setWidget(), QDockWidgetLayout::setWidgetForRole(), QComboBox::showPopup(), QBalloonTip::updateBalloonPosition(), QAbstractItemView::updateEditorGeometries(), and QMenuBarPrivate::updateGeometries().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive widget hide events.
The event is passed in the event parameter.
Hide events are sent to widgets immediately after they have been hidden.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().
Reimplemented in QComboBoxPrivateScroller, QCalendarPopup, QMenu, QScrollBar, QTabBar, QQuickWidget, QComboBox, QComboBoxPrivateContainer, QAbstractSpinBox, QVideoWidget, QMdiSubWindow, and QSizeGrip.
Definition at line 10144 of file qwidget.cpp.
Referenced by event(), QAbstractSpinBox::hideEvent(), QVideoWidget::hideEvent(), and QSizeGrip::hideEvent().
Initializes the painter pen, background and font to the same as the given widget's.
This function is called automatically when the painter is opened on a QWidget.
Reimplemented from QPaintDevice.
Definition at line 12918 of file qwidget.cpp.
References backgroundRole(), QPalette::brush(), QPainter::font(), font, foregroundRole(), painter, palette, and QPainter::pen().
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events.
This handler is called when the state of the input method changes.
Note that when creating custom text editing widgets, the Qt::WA_InputMethodEnabled window attribute must be set explicitly (using the setAttribute() function) in order to receive input method events.
The default implementation calls event->ignore(), which rejects the Input Method event. See the \l QInputMethodEvent documentation for more details.
Reimplemented in QComboBox, and QLineEdit.
Definition at line 9944 of file qwidget.cpp.
Referenced by event().
Qt::InputMethodHints QWidget::inputMethodHints | ( | ) | const |
Definition at line 10003 of file qwidget.cpp.
References Qt::ImhNone, priv(), and Q_ASSERT.
|
virtual |
This method is only relevant for input widgets.
It is used by the input method to query a set of properties of the widget to be able to support complex input method operations as support for surrounding text and reconversions.
query specifies which property is queried.
Reimplemented in QAbstractSpinBox, QComboBox, and QLineEdit.
Definition at line 9959 of file qwidget.cpp.
References font, height, Qt::ImAnchorPosition, Qt::ImCursorPosition, Qt::ImCursorRectangle, Qt::ImFont, Qt::ImHints, Qt::ImInputItemClipRectangle, inputMethodHints, inputMethodQuery(), and width.
Referenced by QScrollArea::ensureWidgetVisible(), event(), QWidgetWindow::handleContextMenuEvent(), QLineEdit::inputMethodQuery(), QComboBox::inputMethodQuery(), QPlainTextEdit::inputMethodQuery(), QTextEdit::inputMethodQuery(), inputMethodQuery(), and QComboBox::inputMethodQuery().
Inserts the action action to this widget's list of actions, before the action before.
It appends the action if before is \nullptr or before is not a valid action for this widget.
A QWidget should only have one of each action.
Definition at line 3149 of file qwidget.cpp.
References QEvent::ActionAdded, QList< T >::append(), QActionPrivate::associatedObjects, d, e, pos, Q_UNLIKELY, qWarning, removeAction(), and QCoreApplication::sendEvent().
Referenced by addAction(), addActions(), insertActions(), QMenu::insertMenu(), QMenuBar::insertMenu(), QWidgetPlatformMenu::insertMenuItem(), QMenu::insertSection(), QMenu::insertSection(), QMenu::insertSeparator(), QMenuBar::insertSeparator(), QToolBar::insertSeparator(), QToolBar::insertWidget(), and QTornOffMenu::syncWithMenu().
Inserts the actions actions to this widget's list of actions, before the action before.
It appends the action if before is \nullptr or before is not a valid action for this widget.
A QWidget can have at most one of each action.
Definition at line 3183 of file qwidget.cpp.
References actions(), QList< T >::at(), i, insertAction(), and QList< T >::size().
|
inline |
Returns the window system identifier of the widget, or 0 if the widget is not created yet.
Definition at line 220 of file qwidget.h.
Referenced by ~QWidget(), create(), effectiveWinId(), QWidgetPrivate::hideChildren(), operator<<(), QApplicationPrivate::pickMouseReceiver(), q_createNativeChildrenAndSetParent(), QApplicationPrivate::sendMouseEvent(), setAttribute(), and winId().
bool QWidget::isActiveWindow | ( | ) | const |
Definition at line 6901 of file qwidget.cpp.
References QApplication::activeWindow(), QGuiApplication::focusWindow(), isActiveWindow, isModal(), isVisible(), parentWidget(), Qt::Popup, QStyle::SH_Widget_ShareActivation, style(), Qt::Tool, topLevelWidget(), QWidgetWindow::widget(), window(), windowHandle(), and windowType().
bool QWidget::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, and both widgets are within the same window; otherwise returns false
.
Definition at line 8868 of file qwidget.cpp.
References child.
Referenced by QApplicationPrivate::focusNextPrevChild_helper(), iWantTheFocus(), QWidgetRepaintManager::moveStaticWidgets(), QWidgetPrivate::reparentFocusWidgets(), QApplicationPrivate::sendSyntheticEnterLeave(), QMdiSubWindowPrivate::setActive(), QStackedLayout::setCurrentIndex(), setFocusProxy(), QMdiSubWindowPrivate::setFocusWidget(), QComboBoxPrivateContainer::setItemView(), setParent(), setTabOrder(), QMdiSubWindow::showShaded(), and QApplicationPrivate::translateRawTouchEvent().
|
inline |
Definition at line 814 of file qwidget.h.
References Qt::WA_Disabled.
Referenced by QAbstractButton::animateClick(), QMenu::changeEvent(), QAbstractButton::changeEvent(), QAbstractSlider::changeEvent(), QComboBox::changeEvent(), QAbstractSpinBox::changeEvent(), QGroupBox::changeEvent(), QAbstractButton::click(), QApplicationPrivate::dispatchEnterLeave(), QWindowsVistaStyle::drawComplexControl(), src_gui_image_qicon::MyWidget::drawIcon(), QCommonStyle::drawPrimitive(), QDockWidgetTitleButton::enterEvent(), QAbstractButton::event(), event(), QGraphicsScene::focusNextPrevChild(), QApplicationPrivate::focusNextPrevChild_helper(), QWidgetWindow::handleContextMenuEvent(), QStyleOption::initFrom(), QGroupBox::initStyleOption(), QMenuBar::initStyleOption(), QLineEdit::inputMethodQuery(), QQuickComboBoxPrivate::itemHovered(), QDialog::keyPressEvent(), QDockWidgetTitleButton::leaveEvent(), QAbstractButtonPrivate::moveFocus(), QQuickMenuPrivate::onItemHovered(), operator<<(), QCommandLinkButton::paintEvent(), QLabel::paintEvent(), QSplitterHandle::paintEvent(), QDockWidgetTitleButton::paintEvent(), palette(), populateTitleBarButtonTheme(), setAttribute(), setFocus(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QWindowsVistaStyle::styleHint(), QWizardPrivate::switchToPage(), and QQuickControlsTestUtils::verifyButtonClickable().
bool QWidget::isEnabledTo | ( | const QWidget * | ancestor | ) | const |
Returns true
if this widget would become enabled if ancestor is enabled; otherwise returns false
.
This is the case if neither the widget itself nor every parent up to but excluding ancestor has been explicitly disabled.
isEnabledTo(0) returns false if this widget or any if its ancestors was explicitly disabled.
The word ancestor here means a parent widget within the same window.
Therefore isEnabledTo(0) stops at this widget's window, unlike isEnabled() which also takes parent windows into considerations.
Definition at line 3097 of file qwidget.cpp.
References parentWidget(), testAttribute(), and Qt::WA_ForceDisabled.
bool QWidget::isFullScreen | ( | ) | const |
Definition at line 2989 of file qwidget.cpp.
References Qt::WindowFullScreen.
Referenced by normalGeometry(), QVideoWidget::setFullScreen(), and snippet_ctor2().
|
inline |
Returns true
if the widget is hidden, otherwise returns false
.
A hidden widget will only become visible when show() is called on it. It will not be automatically shown when the parent is shown.
To check visibility, use !isVisible() instead (notice the exclamation mark).
isHidden() implies !isVisible(), but a widget can be not visible and not hidden at the same time. This is the case for widgets that are children of widgets that are not visible.
Widgets are hidden if: \list
Definition at line 877 of file qwidget.h.
References Qt::WA_WState_Hidden.
Referenced by QMdiAreaPrivate::_q_currentTabChanged(), QMdiSubWindowPrivate::drawTitleBarWhenMaximized(), QOpenGLWidget::event(), event(), QToolBar::event(), QSizeGrip::eventFilter(), QStatusBar::insertPermanentWidget(), QStatusBar::insertWidget(), QWidgetItem::isEmpty(), QFormLayoutItem::isHidden(), QFormLayout::isRowVisible(), isVisibleTo(), menuBarHeightForWidth(), QAbstractButtonPrivate::moveFocus(), QSplitter::moveSplitter(), QTabBarPrivate::normalizedScrollRect(), QWidgetPrivate::prepareToRender(), QSplitterPrivate::recalc(), QSplitter::replaceWidget(), QToolBarAreaLayout::saveState(), QWidgetAction::setDefaultWidget(), setFocus(), QSplitterPrivate::setGeo(), QToolBarLayout::setGeometry(), showAllHiddenTopLevelWidgets(), and waitForPopup().
|
inline |
Definition at line 420 of file qwidget.h.
References Qt::LeftToRight.
Referenced by QMdiSubWindow::eventFilter(), QMdiSubWindow::keyPressEvent(), and QMdiSubWindow::resizeEvent().
bool QWidget::isMaximized | ( | ) | const |
Definition at line 2883 of file qwidget.cpp.
References Qt::WindowMaximized.
Referenced by QMdiAreaPrivate::emitWindowActivated(), QMdiSubWindow::event(), QMdiSubWindow::maximizedButtonsWidget(), QMdiSubWindow::maximizedSystemMenuIconWidget(), QMdiSubWindow::mouseDoubleClickEvent(), normalGeometry(), QMdiSubWindow::paintEvent(), setMinimumSize(), QMdiAreaPrivate::setViewMode(), QMdiAreaPrivate::updateScrollBars(), and QMdiArea::viewportEvent().
bool QWidget::isMinimized | ( | ) | const |
Definition at line 2843 of file qwidget.cpp.
References Qt::WindowMinimized.
Referenced by event(), QMdiSubWindow::event(), QMdiArea::eventFilter(), QMainWindowLayout::hover(), QMdiSubWindow::minimumSizeHint(), QMdiSubWindow::mouseDoubleClickEvent(), QWidgetResizeHandler::mouseMoveEvent(), QMdiSubWindow::paintEvent(), QMdiSubWindow::showEvent(), and showMinimized().
|
inline |
Definition at line 817 of file qwidget.h.
References Qt::NonModal.
Referenced by QDialog::closeEvent(), isActiveWindow(), and QProgressDialog::setValue().
|
inline |
Definition at line 419 of file qwidget.h.
References Qt::RightToLeft.
Referenced by QtPrivate::QWellArray::columnAt(), QtPrivate::QWellArray::columnX(), QDateTimeEdit::displayFormat(), QDateTimeEdit::focusInEvent(), QMenu::keyPressEvent(), QMenuBar::keyPressEvent(), QTabBar::keyPressEvent(), QTabWidget::keyPressEvent(), QAbstractSlider::keyPressEvent(), QColumnViewGrip::mouseDoubleClickEvent(), QTabBar::mouseMoveEvent(), QColumnViewGrip::moveGrip(), QTabBar::moveTab(), QtPrivate::QWellArray::paintEvent(), QDialog::resizeEvent(), QDateTimeEdit::setDisplayFormat(), and QDialog::setSizeGripEnabled().
|
inline |
Definition at line 874 of file qwidget.h.
References Qt::WA_WState_Visible.
Referenced by ~QWidget(), QPrintDialogPrivate::_q_collapseOrExpandDialog(), QFileDialogPrivate::_q_selectionChanged(), QMenu::actionEvent(), QMenuBar::actionEvent(), QLayout::addChildWidget(), QDialog::adjustPosition(), changeEvent(), QMenu::changeEvent(), QMdiSubWindow::changeEvent(), QSplitter::childEvent(), QDialog::closeEvent(), QComboBoxPrivate::doHidePopup(), QSplitter::event(), event(), QMenuBar::eventFilter(), QComboBoxPrivateContainer::eventFilter(), QMainWindowLayout::hover(), QSplitterPrivate::insertWidget(), isActiveWindow(), isVisibleTo(), QDialog::keyPressEvent(), QAbstractSpinBox::keyPressEvent(), QWidgetRepaintManager::markDirty(), QMdiSubWindow::maximizedButtonsWidget(), QMdiSubWindow::maximizedSystemMenuIconWidget(), QMenuBarPrivate::menuRect(), QStatusBarPrivate::messageRect(), QMdiSubWindow::minimumSizeHint(), QMenu::mouseMoveEvent(), QtAndroidMenu::onContextItemSelected(), operator<<(), QWidgetPrivate::overlappedRegion(), palette(), QGraphicsScenePrivate::removePopup(), QLayoutPrivate::reparentChildWidgets(), QMdiSubWindow::resizeEvent(), QMdiSubWindowPrivate::restoreFocus(), scroll(), scroll(), QFileDialog::selectFile(), QApplicationPrivate::sendSyntheticEnterLeave(), QGraphicsProxyWidgetPrivate::sendWidgetKeyEvent(), QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(), QToolButton::setArrowType(), setAttribute(), QMdiAreaPrivate::setChildActivationEnabled(), QDockWidget::setFloating(), QAbstractButton::setIconSize(), QAbstractSpinBox::setLineEdit(), QComboBox::setLineEdit(), setMask(), QSplitter::setOrientation(), setParent(), QWidgetPrivate::setParent_sys(), QSplashScreen::setPixmap(), QtPrivate::QWellArray::setSelected(), QMenu::setSeparatorsCollapsible(), QStatusBar::setSizeGripEnabled(), QMenu::setTearOffEnabled(), QToolButton::setToolButtonStyle(), QProgressBar::setValue(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowState(), QErrorMessage::showMessage(), showMinimized(), QComboBox::showPopup(), QCompleterPrivate::showPopup(), QMdiSubWindow::showShaded(), QMacStyle::sizeFromContents(), snippet_ctor2(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetRepaintManager::sync(), QWidgetRepaintManager::sync(), QCalendarWidget::updateCell(), QCalendarWidget::updateCells(), QMenuBarPrivate::updateGeometries(), QComboBoxPrivateContainer::updateScrollers(), and QQuickControlsTestUtils::verifyButtonClickable().
bool QWidget::isVisibleTo | ( | const QWidget * | ancestor | ) | const |
Returns true
if this widget would become visible if ancestor is shown; otherwise returns false
.
The true case occurs if neither the widget itself nor any parent up to but excluding ancestor has been explicitly hidden.
This function will still return true if the widget is obscured by other windows on the screen, but could be physically visible if it or they were to be moved.
isVisibleTo(0) is identical to isVisible().
Definition at line 8689 of file qwidget.cpp.
References isHidden(), isVisible(), and parentWidget().
Referenced by QGraphicsScene::focusNextPrevChild(), and QApplicationPrivate::focusNextPrevChild_helper().
|
inline |
Returns true
if the widget is an independent window, otherwise returns false
.
A window is a widget that isn't visually the child of any other widget and that usually has a frame and a \l{QWidget::setWindowTitle()}{window title}.
A window can have a \l{QWidget::parentWidget()}{parent widget}. It will then be grouped with its parent and deleted when the parent is deleted, minimized when the parent is minimized etc. If supported by the window manager, it will also have a common taskbar entry with its parent.
QDialog and QMainWindow widgets are by default windows, even if a parent widget is specified in the constructor. This behavior is specified by the Qt::Window flag.
Definition at line 811 of file qwidget.h.
References Qt::Window.
Referenced by ~QWidget(), QLayout::activate(), QWidgetAnimator::animate(), QWidgetWindowPrivate::closestAcceptableGeometry(), correctWidgetContext(), create(), cursor(), destroy(), QApplicationPrivate::dispatchEnterLeave(), QWindowsVistaStyle::drawControl(), QMenu::event(), event(), QDockWidget::event(), focusInEvent(), focusNextPrevChild(), QApplicationPrivate::focusNextPrevChild_helper(), focusOutEvent(), frameGeometry(), frameSize(), QWidgetWindow::handleMoveEvent(), QApplicationPrivate::handlePaletteChanged(), QWidgetPrivate::hide_helper(), QWidgetPrivate::hideChildren(), QMainWindowLayout::hover(), QStyleOption::initFrom(), QWidgetItem::isEmpty(), QDockWidget::isFloating(), QToolBar::isFloating(), QWindowsVistaStylePrivate::isItemViewDelegateLineEdit(), QGraphicsSceneIndexPrivate::itemCollidesWithPath(), lower(), QWidgetRepaintManager::markNeedsFlush(), menuBarHeightForWidth(), QWidgetResizeHandler::mouseMoveEvent(), QSizeGrip::mousePressEvent(), move(), QDockWidgetLayout::nativeWindowDeco(), normalGeometry(), operator<<(), QWidgetPrivate::overlappedRegion(), QToolBar::paintEvent(), QCommonStyle::pixelMetric(), QMacStyle::pixelMetric(), pos(), QWidgetPrivate::prepareToRender(), q_createNativeChildrenAndSetParent(), raise(), QMdiAreaPrivate::resizeToMinimumTileSize(), QToolBarAreaLayout::saveState(), QApplicationPrivate::sendSyntheticEnterLeave(), QGraphicsScene::setActiveWindow(), setAttribute(), setBaseSize(), QToolBarLayout::setExpanded(), setFixedSize(), setGeometry(), setLayout(), setMask(), setMaximumSize(), setMinimumSize(), setParent(), setSizeIncrement(), setSizePolicy(), QDockWidget::setTitleBarWidget(), QFocusFrame::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowOpacity(), setWindowState(), QWidgetPrivate::showChildren(), stackUnder(), QQC2::QWindowsXPStyle::standardIcon(), QWindowsVistaStyle::standardIcon(), QQC2::QWindowsXPStyle::standardPixmap(), QWindowsVistaStyle::standardPixmap(), QQC2::QWindowsStyle::styleHint(), QWidgetPrivate::subtractOpaqueSiblings(), QMainWindowLayout::unplug(), unsetCursor(), QToolBarLayout::updateMacBorderMetrics(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), windowOpacity(), x(), and y().
bool QWidget::isWindowModified | ( | ) | const |
Definition at line 11544 of file qwidget.cpp.
References testAttribute(), and Qt::WA_WindowModified.
Referenced by QMdiSubWindow::event(), qt_setWindowTitle_helperHelper(), QMdiSubWindow::setWidget(), and tabTextFor().
|
static |
Returns the widget that is currently grabbing the keyboard input.
If no widget in this application is currently grabbing the keyboard, \nullptr is returned.
Definition at line 12812 of file qwidget.cpp.
References keyboardGrb.
Referenced by destroy(), QWidgetWindow::handleContextMenuEvent(), QWidgetWindow::handleKeyEvent(), and ungrabKeyboardForPopup().
This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget.
A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.
If you reimplement this handler, it is very important that you call the base class implementation if you do not act upon the key.
The default implementation closes popup widgets if the user presses the key sequence for QKeySequence::Cancel (typically the Escape key). Otherwise the event is ignored, so that the widget's parent can interpret it.
Note that QKeyEvent starts with isAccepted() == true, so you do not need to call QKeyEvent::accept() - just do not call the base class implementation if you act upon the key.
Reimplemented in QtPrivate::QWellArray, QDialog, QWhatsThat, QKeySequenceEdit, QLineEdit, QMenu, QMenuBar, QPushButton, QTabBar, QTabWidget, QQuickWidget, QFileDialogLineEdit, QAbstractButton, QComboBox, QAbstractSlider, QLabel, QInputDialogSpinBox, QInputDialogDoubleSpinBox, QMessageBox, QAbstractSpinBox, QCalendarWidget, QDateTimeEdit, and QMdiSubWindow.
Definition at line 9652 of file qwidget.cpp.
References QKeySequence::Cancel, close(), Qt::Popup, and windowType().
Referenced by event(), QInputDialogSpinBox::keyPressEvent(), QInputDialogDoubleSpinBox::keyPressEvent(), and QCalendarWidget::keyPressEvent().
This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget.
A widget must \l{setFocusPolicy()}{accept focus} initially and \l{hasFocus()}{have focus} in order to receive a key release event.
If you reimplement this handler, it is very important that you call the base class implementation if you do not act upon the key.
The default implementation ignores the event, so that the widget's parent can interpret it.
Note that QKeyEvent starts with isAccepted() == true, so you do not need to call QKeyEvent::accept() - just do not call the base class implementation if you act upon the key.
Reimplemented in QKeySequenceEdit, QLineEdit, QQuickWidget, QAbstractButton, QComboBox, and QAbstractSpinBox.
Definition at line 9687 of file qwidget.cpp.
Referenced by event(), QLineEdit::keyReleaseEvent(), QComboBox::keyReleaseEvent(), and QPlainTextEdit::keyReleaseEvent().
QLayout * QWidget::layout | ( | ) | const |
Returns the layout manager that is installed on this widget, or \nullptr if no layout manager is installed.
The layout manager sets the geometry of the widget's children that have been added to the layout.
Definition at line 10255 of file qwidget.cpp.
References QLayout::layout().
Referenced by DragWidget::DragWidget(), FinalWidget::FinalWidget(), QComboBoxPrivateContainer::QComboBoxPrivateContainer(), Window::Window(), dropevents::Window::Window(), QLayout::~QLayout(), QLayout::addChildWidget(), QMainWindowLayout::animationFinished(), QMainWindow::centralWidget(), QDockWidget::changeEvent(), QLayout::closestAcceptableSize(), QStackedWidget::currentWidget(), dockedGeometry(), QDockWidget::event(), QWidgetItem::expandingDirections(), heightForWidth(), QWidgetItem::heightForWidth(), QMainWindowLayout::hover(), QDockWidget::initStyleOption(), QToolBar::initStyleOption(), QMainWindowPrivate::mainWindowLayout(), QWidgetItem::minimumHeightForWidth(), QMdiSubWindow::minimumSizeHint(), QApplicationPrivate::notify_helper(), QDockWidget::paintEvent(), QMainWindowLayout::plug(), QWidgetPrivate::prepareToRender(), QWidgetPrivate::safeAreaMargins(), QWizard::setButtonLayout(), QCalendarPopup::setCalendarWidget(), QMessageBox::setCheckBox(), QDockWidget::setFeatures(), QToolBar::setIconSize(), QComboBoxPrivateContainer::setItemView(), setLayout(), QPagePreview::setPageLayout(), QDockWidget::setTitleBarWidget(), QDockWidget::setWidget(), QMdiSubWindow::setWidget(), QComboBox::showPopup(), QCommonStyle::subElementRect(), QDockWidget::titleBarWidget(), QMainWindowLayout::unplug(), QScrollAreaPrivate::updateScrollBars(), QComboBoxPrivateContainer::updateTopBottomMargin(), QDockWidget::widget(), and QStackedWidget::widget().
Qt::LayoutDirection QWidget::layoutDirection | ( | ) | const |
Definition at line 4899 of file qwidget.cpp.
References Qt::LeftToRight, Qt::RightToLeft, testAttribute(), and Qt::WA_RightToLeft.
This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter.
A leave event is sent to the widget when the mouse cursor leaves the widget.
Reimplemented in QComboBoxPrivateScroller, QMenu, QMenuBar, QToolButton, QDockWidgetTitleButton, QMdi::ControllerWidget, and QMdiSubWindow.
Definition at line 9777 of file qwidget.cpp.
Referenced by event(), QToolButton::leaveEvent(), and QDockWidgetTitleButton::leaveEvent().
QLocale QWidget::locale | ( | ) | const |
Definition at line 5925 of file qwidget.cpp.
References d.
|
slot |
Lowers the widget to the bottom of the parent widget's stack.
After this call the widget will be visually behind (and therefore obscured by) any overlapping sibling widgets.
Definition at line 11916 of file qwidget.cpp.
References create(), d, e, isWindow(), QWindowContainer::parentWasLowered(), parentWidget(), Q_ASSERT, QCoreApplication::sendEvent(), testAttribute(), Qt::WA_WState_Created, and QEvent::ZOrderChange.
Referenced by QDockAreaLayoutInfo::apply(), QStackedLayout::insertWidget(), QAlphaWidget::render(), QSplitter::replaceWidget(), and QTabBar::setTabButton().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4255 of file qwidget.cpp.
References mapFrom(), QObject::parent(), pos, and QPointF::toPoint().
Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system.
The parent must not be \nullptr and must be a parent of the calling widget.
Definition at line 4236 of file qwidget.cpp.
References QObject::parent(), pos, and Q_ASSERT_X.
Referenced by QWidgetWindow::handleMoveEvent(), mapFrom(), and QApplicationPrivate::sendSyntheticEnterLeave().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 12596 of file qwidget.cpp.
References mapFromGlobal(), pos, and QPointF::toPoint().
Translates the global screen coordinate pos to widget coordinates.
Definition at line 12586 of file qwidget.cpp.
References mapToGlobalTransform(), and pos.
Referenced by QApplicationPrivate::dispatchEnterLeave(), QWidgetResizeHandler::doResize(), QToolBar::event(), QWidgetResizeHandler::eventFilter(), QMdiSubWindow::eventFilter(), QWidgetWindow::handleMouseEvent(), QMainWindowLayout::hover(), QGraphicsScenePrivate::itemsAtPosition(), QMdiSubWindow::keyPressEvent(), mapFromGlobal(), QSplitterHandle::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QTipLabel::mouseMoveEvent(), QMdiSubWindow::mouseMoveEvent(), QComboBoxPrivateContainer::mousePressEvent(), QSplitterHandle::mouseReleaseEvent(), QApplicationPrivate::pickMouseReceiver(), PressDelayHandler::sendMouseEvent(), QApplicationPrivate::sendSyntheticEnterLeave(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), and QApplicationPrivate::updateTouchPointsForWidget().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4301 of file qwidget.cpp.
References pos.
Translates the parent widget coordinate pos to widget coordinates.
Same as mapFromGlobal() if the widget has no parent.
Definition at line 4293 of file qwidget.cpp.
References pos.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4222 of file qwidget.cpp.
References mapTo(), QObject::parent(), pos, and QPointF::toPoint().
Translates the widget coordinate pos to the coordinate system of parent.
The parent must not be \nullptr and must be a parent of the calling widget.
Definition at line 4204 of file qwidget.cpp.
References QObject::parent(), pos, and Q_ASSERT_X.
Referenced by QWidgetRepaintManager::bltRect(), QScrollArea::ensureWidgetVisible(), QCalendarWidget::eventFilter(), findTextureWidgetsRecursively(), mapTo(), QWidgetRepaintManager::markDirty(), QWidgetRepaintManager::markNeedsFlush(), QWidgetPrivate::moveRect(), QGraphicsProxyWidget::subWidgetRect(), QWidgetRepaintManager::sync(), and QFocusFramePrivate::updateSize().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 12572 of file qwidget.cpp.
References mapToGlobal(), pos, and QPointF::toPoint().
Translates the widget coordinate pos to global screen coordinates.
For example, {mapToGlobal(QPointF(0,0))} would give the global coordinates of the top-left pixel of the widget.
Definition at line 12562 of file qwidget.cpp.
References mapToGlobalTransform(), and pos.
Referenced by event(), QComboBoxPrivateContainer::eventFilter(), QPixmapStyle::eventFilter(), QSystemTrayIconSys::globalGeometry(), QWidgetWindow::handleContextMenuEvent(), QWidgetWindow::handleMouseEvent(), QtWaylandClient::QWaylandInputDevice::handleTouchPoint(), QLineEdit::inputMethodQuery(), QMdiSubWindow::keyPressEvent(), mapToGlobal(), QAbstractButtonPrivate::moveFocus(), QApplicationPrivate::pickMouseReceiver(), QMenuPrivate::popup(), QWhatsThisPrivate::say(), QDockWidget::setFloating(), QVideoWidget::setFullScreen(), QComboBox::showPopup(), and QCompleterPrivate::showPopup().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4278 of file qwidget.cpp.
References pos.
Translates the widget coordinate pos to a coordinate in the parent widget.
Same as mapToGlobal() if the widget has no parent.
Definition at line 4270 of file qwidget.cpp.
References pos.
Referenced by QMdiSubWindow::mousePressEvent(), QApplication::notify(), and QToolBarLayout::updateMacBorderMetrics().
QRegion QWidget::mask | ( | ) | const |
Returns the mask currently set on a widget.
If no mask is set the return value will be an empty region.
Definition at line 10240 of file qwidget.cpp.
References d.
Referenced by ScreenWidget::ScreenWidget(), QWidgetPrivate::overlappedRegion(), QComboBoxPrivateContainer::resizeEvent(), and QWidgetPrivate::subtractOpaqueSiblings().
QSize QWidget::maximumSize | ( | ) | const |
Definition at line 3781 of file qwidget.cpp.
References d, and QWIDGETSIZE_MAX.
|
overrideprotectedvirtual |
Internal implementation of the virtual QPaintDevice::metric() function.
m is the metric to get.
Reimplemented from QPaintDevice.
Definition at line 12856 of file qwidget.cpp.
References QScreen::depth, QScreen::devicePixelRatio, QPaintDevice::devicePixelRatio(), QPaintDevice::devicePixelRatioFScale(), QScreen::geometry, QRect::height(), QSizeF::height(), QScreen::logicalDotsPerInchX, QScreen::logicalDotsPerInchY, QPaintDevice::metric(), QPaintDevice::PdmDepth, QPaintDevice::PdmDevicePixelRatio, QPaintDevice::PdmDevicePixelRatioScaled, QPaintDevice::PdmDpiX, QPaintDevice::PdmDpiY, QPaintDevice::PdmHeight, QPaintDevice::PdmHeightMM, QPaintDevice::PdmPhysicalDpiX, QPaintDevice::PdmPhysicalDpiY, QPaintDevice::PdmWidth, QPaintDevice::PdmWidthMM, QScreen::physicalDotsPerInchX, QScreen::physicalDotsPerInchY, QScreen::physicalSize, qEnvironmentVariableIntValue(), qRound(), screen(), QRect::width(), QSizeF::width(), window(), and windowHandle().
Referenced by QOpenGLWidget::metric(), QMainWindow::setIconSize(), and QToolBar::setIconSize().
QSize QWidget::minimumSize | ( | ) | const |
Definition at line 3759 of file qwidget.cpp.
References d.
|
virtual |
Reimplemented in QDialog, QInputDialog, QWatermarkLabel, QAbstractSpinBox, QCalendarWidget, QCheckBox, QComboBox, QCommandLinkButton, QDial, QDockWidgetTitleButton, QGroupBox, QLabel, QLineEdit, QMdiSubWindow, QMenuBar, QProgressBar, QPushButton, QRadioButton, QSlider, QSplitter, QTabBar, QTabWidget, QToolBoxButton, and QToolButton.
Definition at line 8845 of file qwidget.cpp.
References d.
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget.
The default implementation calls mousePressEvent().
Reimplemented in QLineEdit, QTabBar, QQuickWidget, QSystemTrayIconSys, QColumnViewGrip, QMdi::ControlLabel, and QMdiSubWindow.
Definition at line 9576 of file qwidget.cpp.
References mousePressEvent().
Referenced by event(), and QMdiSubWindow::mouseDoubleClickEvent().
|
static |
Returns the widget that is currently grabbing the mouse input.
If no widget in this application is currently grabbing the mouse, \nullptr is returned.
Definition at line 12795 of file qwidget.cpp.
References qt_mouseGrb, and qt_pressGrab.
Referenced by destroy(), QWidgetWindow::handleEnterLeaveEvent(), QApplicationPrivate::pickMouseReceiver(), QApplicationPrivate::sendMouseEvent(), QApplicationPrivate::sendSyntheticEnterLeave(), and ungrabMouseForPopup().
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.
If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with QMouseEvent::pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call QToolTip::showText() instead of setToolTip() in your implementation of mouseMoveEvent().
Reimplemented in QtPrivate::QColorPicker, QtPrivate::QColorLuminancePicker, QWhatsThat, QCheckBox, QLineEdit, QMenu, QMenuBar, QPushButton, QRadioButton, QScrollBar, QSizeGrip, QSplitterHandle, QTabBar, QQuickWidget, QtPrivate::QColorWell, QtPrivate::QColorShowLabel, QTipLabel, QAbstractButton, QComboBoxPrivateScroller, QLabel, QSlider, DragWidget, FinalWidget, QColumnViewGrip, QAbstractSpinBox, QGroupBox, QMdi::ControllerWidget, QDial, and QMdiSubWindow.
Definition at line 9507 of file qwidget.cpp.
Referenced by event(), QSizeGrip::mouseMoveEvent(), QtPrivate::QColorWell::mouseMoveEvent(), and QMdiSubWindow::mouseMoveEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.
If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.
The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.
Reimplemented in QtPrivate::QWellArray, QtPrivate::QColorPicker, QtPrivate::QColorLuminancePicker, QWhatsThat, QLineEdit, QMenu, QMenuBar, QScrollBar, QSizeGrip, QSplashScreen, QSplitterHandle, QTabBar, QToolButton, QQuickWidget, QtPrivate::QColorWell, QtPrivate::QColorShowLabel, QBalloonTip, QAbstractButton, QComboBox, QComboBoxPrivateContainer, QCalendarPopup, QSystemTrayIconSys, QLabel, QSlider, MyCheckBox, DragWidget, MainWindow, FinalWidget, QInputDialogSpinBox, QInputDialogDoubleSpinBox, QColumnViewGrip, QAbstractSpinBox, QCalendarWidget, QDateTimeEdit, QGroupBox, QMdi::ControllerWidget, QDial, QMdi::ControlLabel, and QMdiSubWindow.
Definition at line 9529 of file qwidget.cpp.
References QApplication::activePopupWidget(), close(), contains(), Qt::Popup, rect, and windowType().
Referenced by event(), mouseDoubleClickEvent(), QSizeGrip::mousePressEvent(), QCalendarPopup::mousePressEvent(), MyCheckBox::mousePressEvent(), QInputDialogSpinBox::mousePressEvent(), QInputDialogDoubleSpinBox::mousePressEvent(), QCalendarWidget::mousePressEvent(), and QMdiSubWindow::mousePressEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget.
Reimplemented in QtPrivate::QWellArray, QWhatsThat, QCalendarPopup, QLineEdit, QMenu, QMenuBar, QScrollBar, QSplitterHandle, QTabBar, QToolButton, QQuickWidget, QtPrivate::QColorWell, QtPrivate::QColorShowLabel, QAbstractButton, QComboBox, QComboBoxPrivateContainer, QLabel, QSlider, QColumnViewGrip, QAbstractSpinBox, QGroupBox, QMdi::ControllerWidget, QDial, QMdi::ControlLabel, QMdiSubWindow, and QSizeGrip.
Definition at line 9554 of file qwidget.cpp.
Referenced by event(), QMdiSubWindow::mouseReleaseEvent(), and QSizeGrip::mouseReleaseEvent().
Definition at line 7197 of file qwidget.cpp.
References d, geometry, height, isWindow(), QWindowContainer::parentWasMoved(), setAttribute(), testAttribute(), Qt::WA_Moved, Qt::WA_PendingMoveEvent, Qt::WA_WState_Created, width, x, and y.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to move(QPoint(x, y)).
Definition at line 880 of file qwidget.h.
Referenced by QDialog::adjustPosition(), QAlphaWidget::eventFilter(), QTabBarPrivate::layoutTab(), QRubberBand::move(), QTipLabel::placeTip(), QDateTimeEditPrivate::positionCalendarPopup(), MainWindow::readSettings(), restoreGeometry(), QAlphaWidget::run(), QRollEffect::run(), QWhatsThisPrivate::say(), QDockWidget::setFloating(), QVideoWidget::setFullScreen(), QSplashScreen::setPixmap(), and QScrollAreaPrivate::updateWidgetPosition().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter.
When the widget receives this event, it is already at the new position.
The old position is accessible through QMoveEvent::oldPos().
Reimplemented in QSystemTrayIconSys, QRubberBand, QVideoWidget, QMdiSubWindow, and QSizeGrip.
Definition at line 9847 of file qwidget.cpp.
Referenced by event(), QSystemTrayIconSys::moveEvent(), and QMdiSubWindow::moveEvent().
|
protectedvirtual |
This special event handler can be reimplemented in a subclass to receive native platform events identified by eventType which are passed in the message parameter.
In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result. The result parameter has meaning only on Windows. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.
\table \header
Definition at line 10175 of file qwidget.cpp.
References Q_UNUSED.
Referenced by QWidgetWindow::nativeEvent().
QWidget * QWidget::nativeParentWidget | ( | ) | const |
Returns the native parent for this widget, i.e. the next ancestor widget that has a system identifier, or \nullptr if it does not have any native parent.
Definition at line 4340 of file qwidget.cpp.
References QObject::parent(), and parentWidget().
Referenced by QWindowsVistaStylePrivate::backingStoreForWidget(), QWidgetPrivate::create(), effectiveWinId(), grabberWindow(), QWidgetWindow::handleMoveEvent(), QWidgetRepaintManager::markNeedsFlush(), q_createNativeChildrenAndSetParent(), QWidgetPrivate::setParent_sys(), and QApplicationPrivate::windowForWidget().
QWidget * QWidget::nextInFocusChain | ( | ) | const |
Returns the next widget in this widget's focus chain.
Definition at line 6868 of file qwidget.cpp.
Referenced by QWindowContainer::event(), QLineEdit::inputMethodQuery(), iWantTheFocus(), and QMdiSubWindowPrivate::setFocusWidget().
QRect QWidget::normalGeometry | ( | ) | const |
Definition at line 3675 of file qwidget.cpp.
References d, geometry, isFullScreen(), isMaximized(), and isWindow().
void QWidget::overrideWindowFlags | ( | Qt::WindowFlags | flags | ) |
Sets the window flags for the widget to flags, without telling the window system.
Definition at line 10610 of file qwidget.cpp.
void QWidget::overrideWindowState | ( | Qt::WindowStates | newstate | ) |
The function sets the window state on child widgets similar to setWindowState(). The difference is that the window state changed event has the isOverride() flag set. It exists mainly to keep QWorkspace working.
Definition at line 2907 of file qwidget.cpp.
References e, and QCoreApplication::sendEvent().
Referenced by QMdiSubWindowPrivate::ensureWindowState(), and QMdiSubWindowPrivate::setActive().
|
overridevirtual |
Returns the widget's paint engine.
Note that this function should not be called explicitly by the user, since it's meant for reimplementation purposes only. The function is called by Qt internally, and the default implementation may not always return a valid pointer.
Implements QPaintDevice.
Definition at line 12474 of file qwidget.cpp.
References qWarning.
Referenced by QOpenGLWidget::paintEngine(), and setAttribute().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive paint events passed in event.
A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons:
\list
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.
When the paint event occurs, the update region has normally been erased, so you are painting on the widget's background.
The background can be set using setBackgroundRole() and setPalette().
Since Qt 4.0, QWidget automatically double-buffers its painting, so there is no need to write double-buffering code in paintEvent() to avoid flicker.
Reimplemented in src_gui_painting_qpainter::MyWidget, src_gui_painting_qpainter2::MyWidget, SimpleTransformation, CombinedTransformation, BasicOperations, QPagePreview, QtPrivate::QWellArray, QtPrivate::QColorPicker, QtPrivate::QColorLuminancePicker, QtPrivate::QColorShowLabel, QFileDialogComboBox, MyPushButton, QWhatsThat, QBalloonTip, QSystemTrayIconSys, QtPrivate::QPrevNextCalButton, QCheckBox, QComboBoxPrivateScroller, QCommandLinkButton, QRollEffect, QFocusFrame, QFrame, QLabel, QLCDNumber, QLineEdit, QMenu, QMenuBarExtension, QMenuBar, QProgressBar, QPushButton, QRadioButton, QRubberBand, QScrollBar, QSizeGrip, QSplitterHandle, QStatusBar, QTabBar, QTabWidget, QToolBarExtension, QToolBarSeparator, QToolBoxButton, QToolButton, QOpenGLWidget, QTipLabel, QtPrivate::QCalToolButton, QComboBox, QComboBoxPrivateContainer, QAlphaWidget, QMenuPrivate::ScrollerTearOffItem, QMovableTabWidget, QAbstractButton, QSlider, plaintextlayout::Window, QWizardHeader, QWizard, SplitterHandle, MyWidget, QColumnViewGrip, QAbstractSpinBox, QDateTimeEdit, QDockWidgetTitleButton, QDockWidget, QGroupBox, QMdi::ControllerWidget, QToolBar, QQuickWidget, QSvgWidget, QMdi::ControlLabel, QMdiSubWindow, and QDial.
Definition at line 9829 of file qwidget.cpp.
Referenced by event(), plaintextlayout::Window::paintEvent(), and QMdiSubWindow::paintEvent().
const QPalette & QWidget::palette | ( | ) | const |
Definition at line 4521 of file qwidget.cpp.
References QPalette::Active, QPalette::Disabled, QPalette::Inactive, isActiveWindow, QApplicationPrivate::isBlockedByModal(), isEnabled(), isVisible(), and QPalette::setCurrentColorGroup().
|
inline |
Returns the parent of this widget, or \nullptr if it does not have any parent widget.
Definition at line 904 of file qwidget.h.
References QObject::parent().
Referenced by QMdi::ControllerWidget::ControllerWidget(), QMenuBarExtension::QMenuBarExtension(), QToolBarLayout::QToolBarLayout(), QTornOffMenu::QTornOffMenu(), QMenuPrivate::_q_actionTriggered(), QLayout::addChildWidget(), QGraphicsScene::addItem(), QFormLayoutPrivate::arrangeWidgets(), QStyleHelper::backgroundColor(), backgroundRole(), QMenuBar::changeEvent(), QToolButton::changeEvent(), QLayoutPrivate::checkWidget(), clearFocus(), QMdiSubWindow::closeEvent(), correctWidgetContext(), create(), cursor(), destroy(), QApplicationPrivate::dispatchEnterLeave(), QLayoutPrivate::doResize(), QQC2::QWindowsStyle::drawControl(), QCommonStyle::drawControl(), QGraphicsScene::drawItems(), QPixmapStyle::drawLineEdit(), QWindowsVistaStyle::drawPrimitive(), QQC2::QWindowsStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QBoxLayoutPrivate::effectiveMargins(), QDockWidget::event(), QMdiSubWindow::eventFilter(), QPixmapStyle::eventFilter(), QToolBarLayout::expandedSize(), focusNextPrevChild(), QLineEdit::focusOutEvent(), QLayoutPrivate::getMargin(), QFormLayoutPrivate::getStyle(), QWidgetWindow::handleExposeEvent(), QWidgetWindow::handleMoveEvent(), QMenuBarPrivate::handleReparent(), QWidgetPrivate::hide_helper(), QWidgetPrivate::hide_sys(), QTabBarPrivate::initStyleBaseOption(), QDockWidget::initStyleOption(), QToolBar::initStyleOption(), QToolBoxButton::initStyleOption(), QToolButton::initStyleOption(), QSplitterPrivate::insertWidget_helper(), isActiveWindow(), isEnabledTo(), QWindowsVistaStylePrivate::isItemViewDelegateLineEdit(), QWindowsVistaStylePrivate::isLineEditBaseColorSet(), isVisibleTo(), QGraphicsScenePrivate::itemsAtPosition(), QAbstractButton::keyPressEvent(), QMdiSubWindow::keyPressEvent(), lower(), QWidgetPrivate::lower_sys(), mainwindow_from_dock(), QGraphicsProxyWidgetPrivate::mapToReceiver(), QMdiSubWindow::mdiArea(), mdiAreaParent(), QMenuBar::minimumSizeHint(), QToolBoxButton::minimumSizeHint(), QColumnViewGrip::mouseDoubleClickEvent(), QSplitterHandle::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QMdiSubWindow::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QCalendarPopup::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QSplitterHandle::mouseReleaseEvent(), QToolBarLayout::movable(), QColumnViewGrip::moveGrip(), QWidgetPrivate::moveRect(), nativeParentWidget(), QWidgetPrivate::naturalWidgetFont(), QWidgetPrivate::naturalWidgetPalette(), QApplication::notify(), QDialog::open(), QSplitterHandle::paintEvent(), QToolBarSeparator::paintEvent(), QToolBoxButton::paintEvent(), QMacStyle::pixelMetric(), QWidgetPrivate::prepareToRender(), qt_aqua_get_known_size(), qt_sizegrip_topLevelWidget(), raise(), QWidgetPrivate::raise_sys(), QMdiSubWindowPrivate::removeBaseWidget(), QLayoutPrivate::reparentChildWidgets(), QSplitter::replaceWidget(), QMdiAreaPrivate::resizeToMinimumTileSize(), QWidgetPrivate::safeAreaMargins(), PressDelayHandler::sendMouseEvent(), QApplicationPrivate::sendSyntheticEnterLeave(), setAttribute(), QTabWidget::setCornerWidget(), QToolBarLayout::setExpanded(), setFocusProxy(), QToolBarLayout::setGeometry(), QToolBar::setIconSize(), QGraphicsWidgetPrivate::setLayoutDirection_helper(), setMask(), QMenuBar::setNativeMenuBar(), setParent(), setParent(), QtPrivate::QWellArray::setSelected(), QTabWidget::setTabBar(), QBoxLayoutPrivate::setupGeom(), QFormLayoutPrivate::setupVerticalLayoutData(), QWidgetPrivate::setVisible(), QFocusFrame::setWidget(), QScrollArea::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QMessageBox::setWindowModality(), QDialog::showEvent(), QMdiArea::sizeHint(), QMenuBarExtension::sizeHint(), QMenuBar::sizeHint(), QPushButton::sizeHint(), QSplitterHandle::sizeHint(), QToolBarSeparator::sizeHint(), QToolBoxButton::sizeHint(), stackUnder(), QWidgetPrivate::stackUnder_sys(), QMacStyle::subElementRect(), QMainWindowLayout::unplug(), QMenuPrivate::updateLayoutDirection(), QToolBarLayout::updateMacBorderMetrics(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QFocusFramePrivate::updateSize(), QWindowContainerPrivate::updateUsesNativeWidgets(), waitForPopup(), QStyleHelper::widgetSizePolicy(), and window().
QPoint QWidget::pos | ( | ) | const |
Definition at line 3556 of file qwidget.cpp.
References d, isWindow(), Qt::Popup, and windowType().
QWidget * QWidget::previousInFocusChain | ( | ) | const |
The previousInFocusChain function returns the previous widget in this widget's focus chain.
Definition at line 6881 of file qwidget.cpp.
|
slot |
Raises this widget to the top of the parent widget's stack.
After this call the widget will be visually in front of any overlapping sibling widgets.
Definition at line 11862 of file qwidget.cpp.
References create(), d, e, isWindow(), QWindowContainer::parentWasRaised(), parentWidget(), Q_ASSERT, rect, QCoreApplication::sendEvent(), testAttribute(), Qt::WA_WState_Created, and QEvent::ZOrderChange.
Referenced by QCalendarWidgetPrivate::_q_yearClicked(), QRubberBand::changeEvent(), QFocusFrame::eventFilter(), EditorWindow::find(), QMainWindowLayout::hover(), QMdiAreaPrivate::internalRaise(), QToolBarLayout::setExpanded(), QTabBarPrivate::setupMovableTab(), QRubberBand::showEvent(), and QComboBox::showPopup().
|
overrideprotectedvirtual |
Do PaintDevice rendering with the specified offset.
Reimplemented from QPaintDevice.
Definition at line 12933 of file qwidget.cpp.
References QPaintDevice::redirected().
Referenced by QOpenGLWidget::redirected(), and QWidgetPrivate::render().
void QWidget::releaseKeyboard | ( | ) |
Releases the keyboard grab.
Definition at line 12776 of file qwidget.cpp.
References grabberWindow(), keyboardGrb, and window().
Referenced by destroy(), QWidgetResizeHandler::eventFilter(), grabKeyboard(), and QWidgetResizeHandler::keyPressEvent().
void QWidget::releaseMouse | ( | ) |
Releases the mouse grab.
Definition at line 12727 of file qwidget.cpp.
References releaseMouseGrabOfWidget().
Referenced by destroy(), QWidgetResizeHandler::eventFilter(), grabMouseForWidget(), and QWidgetResizeHandler::keyPressEvent().
void QWidget::releaseShortcut | ( | int | id | ) |
Removes the shortcut with the given id from Qt's shortcut system.
The widget will no longer receive QEvent::Shortcut events for the shortcut's key sequence (unless it has other shortcuts with the same key sequence).
Definition at line 11798 of file qwidget.cpp.
References QGuiApplicationPrivate::instance(), Q_ASSERT, and qApp.
Referenced by QTabBar::removeTab(), QLabel::setBuddy(), QAbstractButton::setShortcut(), QTabBar::setTabText(), and QGroupBox::setTitle().
Removes the action action from this widget's list of actions.
Definition at line 3193 of file qwidget.cpp.
References QEvent::ActionRemoved, QActionPrivate::associatedObjects, d, e, QList< T >::removeAll(), and QCoreApplication::sendEvent().
Referenced by QMenu::clear(), QMenuBar::clear(), QToolBar::clear(), QtWidgetsActionPrivate::destroy(), insertAction(), QWidgetPlatformMenu::removeMenuItem(), QTornOffMenu::syncWithMenu(), and QToolBarLayout::takeAt().
void QWidget::render | ( | QPaintDevice * | target, |
const QPoint & | targetOffset = QPoint() , |
||
const QRegion & | sourceRegion = QRegion() , |
||
RenderFlags | renderFlags = RenderFlags(DrawWindowBackground | DrawChildren) |
||
) |
Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. Rendering starts at targetOffset in the target. For example:
If sourceRegion is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget.
Ensure that you call QPainter::end() for the target device's active painter (if any) before rendering. For example:
Definition at line 5099 of file qwidget.cpp.
References render().
Referenced by render().
void QWidget::render | ( | QPainter * | painter, |
const QPoint & | targetOffset = QPoint() , |
||
const QRegion & | sourceRegion = QRegion() , |
||
RenderFlags | renderFlags = RenderFlags(DrawWindowBackground | DrawChildren) |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Renders the widget into the painter's QPainter::device().
Transformations and settings applied to the painter will be used when rendering.
Definition at line 5119 of file qwidget.cpp.
References QPaintEnginePrivate::baseSystemClip, QPainter::clipRegion(), d, QPainter::deviceTransform(), engine, QPainter::hasClipping(), QPainter::isActive(), QRegion::isEmpty(), QTransform::map(), QPainter::opacity(), QPainter::paintEngine(), painter, QInternal::Printer, Q_ASSERT, Q_UNLIKELY, qFuzzyIsNull(), qWarning, QPaintEnginePrivate::setSystemTransformAndViewport(), QPaintEnginePrivate::setSystemViewport(), QPaintEnginePrivate::systemClip, QPaintEnginePrivate::systemStateChanged(), QPaintEnginePrivate::systemTransform, and QPaintEnginePrivate::systemViewport.
|
slot |
Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden.
We suggest only using repaint() if you need an immediate repaint, for example during animation. In almost all circumstances update() is better, as it permits Qt to optimize for speed and minimize flicker.
Definition at line 11057 of file qwidget.cpp.
References rect, and repaint().
Referenced by QAbstractButton::animateClick(), QWidgetWindow::event(), QAbstractButton::keyPressEvent(), QScrollBar::mouseMoveEvent(), QAbstractButton::mouseMoveEvent(), QScrollBar::mousePressEvent(), QTabBar::mousePressEvent(), QAbstractButton::mousePressEvent(), QAlphaWidget::render(), repaint(), QSplashScreen::repaint(), repaint(), QProgressBar::reset(), QProgressBar::setAlignment(), QtPrivate::QColorPicker::setCol(), QtPrivate::QColorLuminancePicker::setCol(), QProgressBar::setTextVisible(), and QProgressBar::setValue().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a rectangle rect inside the widget.
Definition at line 11087 of file qwidget.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a region rgn inside the widget.
Definition at line 11098 of file qwidget.cpp.
References d.
void QWidget::repaint | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a rectangle (x, y, w, h) inside the widget.
If w is negative, it is replaced with {width() - x}, and if h is negative, it is replaced width
{height() - y}.
Definition at line 11070 of file qwidget.cpp.
References repaint(), x, and y.
Definition at line 7257 of file qwidget.cpp.
References d, geometry, maximumSize, minimumSize, setAttribute(), testAttribute(), Qt::WA_PendingResizeEvent, Qt::WA_Resized, Qt::WA_WState_Created, x, and y.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to resize(QSize(w, h)).
Definition at line 883 of file qwidget.h.
References resize().
Referenced by QWhatsThat::QWhatsThat(), QMenu::actionEvent(), adjustSize(), QMenu::changeEvent(), QMenuBar::changeEvent(), QWidgetPrivate::create(), QMdiSubWindow::event(), QPrintPreviewDialogPrivate::init(), main(), main(), QColumnViewGrip::moveGrip(), MainWindow::readSettings(), QRubberBand::resize(), QColumnViewPreviewColumn::resizeEvent(), QVideoWidget::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), QAlphaWidget::run(), QRollEffect::run(), setFixedSize(), QWidgetPrivate::setGeometry_sys(), setMaximumSize(), setMinimumSize(), QSplashScreen::setPixmap(), QMenu::setTearOffEnabled(), MyScrollArea::setWidget(), QScrollArea::setWidget(), QMdiSubWindow::showEvent(), QMdiSubWindow::showShaded(), QScrollAreaPrivate::updateScrollBars(), and QTipLabel::updateSize().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter.
When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Reimplemented in QtPrivate::QColorPicker, QDialog, QBalloonTip, QSystemTrayIconSys, QMenuBar, QRubberBand, QSplitter, QSplitterHandle, QStatusBar, QTabBar, QTabWidget, QQuickWidget, QOpenGLWidget, QTipLabel, QComboBox, QComboBoxPrivateContainer, QMessageBox, QProgressDialog, QWizard, QAbstractSpinBox, QCalendarWidget, QGroupBox, QVideoWidget, QDial, and QMdiSubWindow.
Definition at line 9868 of file qwidget.cpp.
Referenced by event(), QtPrivate::QColorPicker::resizeEvent(), QBalloonTip::resizeEvent(), QSystemTrayIconSys::resizeEvent(), QSplitterHandle::resizeEvent(), QStatusBar::resizeEvent(), QTabWidget::resizeEvent(), QTipLabel::resizeEvent(), QComboBoxPrivateContainer::resizeEvent(), QAbstractSpinBox::resizeEvent(), QCalendarWidget::resizeEvent(), QGroupBox::resizeEvent(), QVideoWidget::resizeEvent(), QDial::resizeEvent(), and QMdiSubWindow::resizeEvent().
bool QWidget::restoreGeometry | ( | const QByteArray & | geometry | ) |
Restores the geometry and state of top-level widgets stored in the byte array geometry. Returns true
on success; otherwise returns false
.
If the restored geometry is off-screen, it will be modified to be inside the available screen geometry.
To restore geometry saved using QSettings, you can use code like this:
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
Use QMainWindow::restoreState() to restore the geometry and the state of toolbars and dock widgets.
Definition at line 7535 of file qwidget.cpp.
References QScreen::availableGeometry, QWidgetPrivate::checkRestoredGeometry(), currentMajorVersion, fullScreen, QScreen::geometry, geometry, QRect::isValid(), maximized, move(), QStyle::pixelMetric(), QStyle::PM_TitleBarHeight, qMax(), QDataStream::Qt_4_0, screen(), QGuiApplication::screens(), setGeometry(), QRect::setSize(), setWindowState(), QRect::size(), size, sizeHint, QApplication::style(), QRect::topLeft(), QList< T >::value(), QRect::width(), Qt::WindowFullScreen, Qt::WindowMaximized, Qt::WindowNoState, and windowState().
QByteArray QWidget::saveGeometry | ( | ) | const |
To save the geometry when the window closes, you can implement a close event like this:
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
Use QMainWindow::saveState() to save the geometry and the state of toolbars and dock widgets.
Definition at line 7423 of file qwidget.cpp.
References frameGeometry, geometry, QListSpecialMethodsBase< T >::indexOf(), normalGeometry, QDataStream::Qt_4_0, screen(), QGuiApplication::screens(), width, Qt::WindowFullScreen, Qt::WindowMaximized, windowState(), and QIODeviceBase::WriteOnly.
QScreen * QWidget::screen | ( | ) | const |
Returns the screen the widget is on.
Definition at line 2503 of file qwidget.cpp.
References d, QGuiApplication::primaryScreen, qt_widget_private, QGuiApplication::screenAt(), and window().
Referenced by QSplashScreen::QSplashScreen(), QDialog::adjustPosition(), QDockAreaLayout::constrainedRect(), QQuickWidget::event(), QDockWidget::event(), QSystemTrayIconPrivate::geometry_sys(), metric(), QOpenGLWidget::metric(), QSizeGrip::mousePressEvent(), QWindowsContext::nonClientMetricsForWindow(), QTipLabel::placeTip(), QMenuPrivate::popupGeometry(), restoreGeometry(), saveGeometry(), QWhatsThisPrivate::say(), QWidgetPrivate::screen(), QScrollerPrivate::setDpiFromWidget(), QWidgetPrivate::setParent_sys(), QSplashScreen::setPixmap(), setScreen(), QComboBox::showPopup(), QCompleterPrivate::showPopup(), QWindowsContext::systemParametersInfoForWindow(), QMenuPrivate::updateActionRects(), and QTipLabel::updateSize().
void QWidget::scroll | ( | int | dx, |
int | dy | ||
) |
Scrolls the widget including its children dx pixels to the right and dy downward.
Both dx and dy may be negative.
After scrolling, the widgets will receive paint events for the areas that need to be repainted. For widgets that Qt knows to be opaque, this is only the newly exposed parts. For example, if an opaque widget is scrolled 8 pixels to the left, only an 8-pixel wide stripe at the right edge needs updating.
Since widgets propagate the contents of their parents by default, you need to set the \l autoFillBackground property, or use setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make a widget opaque.
For widgets that use contents propagation, a scroll will cause an update of the entire scroll area.
Definition at line 10973 of file qwidget.cpp.
References QObject::children(), d, isVisible(), proxy, rect, size, QRect::translated(), and updatesEnabled.
Referenced by QMenuPrivate::drawScroller(), QMenuPrivate::init(), QMenuPrivate::setFirstActionActive(), and QMenuPrivate::updateActionRects().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version only scrolls r and does not move the children of the widget.
If r is empty or invalid, the result is undefined.
Definition at line 11012 of file qwidget.cpp.
References QObject::children(), d, isVisible(), proxy, rect, size, and updatesEnabled.
void QWidget::setAcceptDrops | ( | bool | on | ) |
Definition at line 3443 of file qwidget.cpp.
References setAttribute(), and Qt::WA_AcceptDrops.
Referenced by DragWidget::DragWidget(), QWindowContainer::QWindowContainer(), dropevents::Window::Window(), and QGraphicsView::setupViewport().
void QWidget::setAttribute | ( | Qt::WidgetAttribute | attribute, |
bool | on = true |
||
) |
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition at line 11244 of file qwidget.cpp.
References Qt::AA_DontCreateNativeWidgetSiblings, QEvent::AcceptDropsChange, Qt::ApplicationModal, QInputMethod::commit(), d, Qt::Desktop, e, QGuiApplication::focusObject(), focusWidget(), QPlatformIntegration::hasCapability(), i, Qt::ImEnabled, QObject::inherits(), QGuiApplication::inputMethod(), internalWinId(), isEnabled(), isVisible(), isWindow(), QEvent::MouseTrackingChange, QPlatformIntegration::NativeWidgets, Qt::NonModal, paintEngine(), parentWidget(), QGuiApplicationPrivate::platformIntegration(), Q_FALLTHROUGH, qobject_cast< QWidget * >(), QCoreApplication::sendEvent(), setAttribute(), setAttribute_internal(), QEvent::TabletTrackingChange, QCoreApplication::testAttribute(), testAttribute(), QInputMethod::update(), Qt::WA_AcceptDrops, Qt::WA_AcceptTouchEvents, Qt::WA_AttributeCount, Qt::WA_DontShowOnScreen, Qt::WA_DropSiteRegistered, Qt::WA_InputMethodEnabled, Qt::WA_MacMiniSize, Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, Qt::WA_MouseTracking, Qt::WA_NativeWindow, Qt::WA_NoChildEventsForParent, Qt::WA_NoChildEventsFromChildren, Qt::WA_NoSystemBackground, Qt::WA_OpaquePaintEvent, Qt::WA_PaintOnScreen, Qt::WA_ShowModal, Qt::WA_StaticContents, Qt::WA_TabletTracking, Qt::WA_TranslucentBackground, Qt::WA_TransparentForMouseEvents, Qt::WA_UpdatesDisabled, Qt::WA_WindowPropagation, Qt::WA_WState_Created, Qt::WA_X11NetWmWindowTypeCombo, Qt::WA_X11NetWmWindowTypeDesktop, Qt::WA_X11NetWmWindowTypeDialog, Qt::WA_X11NetWmWindowTypeDND, Qt::WA_X11NetWmWindowTypeDock, Qt::WA_X11NetWmWindowTypeDropDownMenu, Qt::WA_X11NetWmWindowTypeMenu, Qt::WA_X11NetWmWindowTypeNotification, Qt::WA_X11NetWmWindowTypePopupMenu, Qt::WA_X11NetWmWindowTypeSplash, Qt::WA_X11NetWmWindowTypeToolBar, Qt::WA_X11NetWmWindowTypeToolTip, Qt::WA_X11NetWmWindowTypeUtility, and windowType().
Referenced by QAlphaWidget::QAlphaWidget(), QCalendarPopup::QCalendarPopup(), QtPrivate::QColorPicker::QColorPicker(), QComboBoxPrivateContainer::QComboBoxPrivateContainer(), QComboBoxPrivateScroller::QComboBoxPrivateScroller(), QPageSetupDialog::QPageSetupDialog(), QPageSetupDialog::QPageSetupDialog(), QPageSetupWidget::QPageSetupWidget(), QPrintDialog::QPrintDialog(), QPrintDialog::QPrintDialog(), QRollEffect::QRollEffect(), QRubberBand::QRubberBand(), QSystemTrayIconSys::QSystemTrayIconSys(), QTornOffMenu::QTornOffMenu(), QWhatsThat::QWhatsThat(), QFileDialogPrivate::_q_showContextMenu(), QMessageBox::about(), QMessageBox::aboutQt(), QMenu::actionEvent(), addingSubWindowsExample(), QWidgetTextControlPrivate::contextMenuEvent(), QLineEdit::contextMenuEvent(), QLabel::contextMenuEvent(), QMainWindow::contextMenuEvent(), create(), destroy(), QAbstractButton::event(), QLabel::event(), event(), QMdiSubWindow::event(), QSizeGrip::eventFilter(), QDialog::exec(), QFileDialog::getOpenFileContent(), QScroller::grabGesture(), grabShortcut(), QWidgetWindow::handleExposeEvent(), QWidgetPrivate::hideChildren(), QMenu::mousePressEvent(), QMenuBar::mousePressEvent(), QComboBoxPrivateContainer::mousePressEvent(), QCalendarPopup::mousePressEvent(), QCalendarWidget::mousePressEvent(), move(), QApplicationPrivate::notify_helper(), QDialog::open(), QAndroidStyle::polish(), QWindowsVistaStyle::polish(), QPixmapStyle::polish(), QWidgetPrivate::prepareToRender(), QAlphaWidget::render(), resize(), QSplitterHandle::resizeEvent(), QAlphaWidget::run(), QRollEffect::run(), QFileDialog::saveFileContent(), setAcceptDrops(), QFileDialog::setAcceptMode(), setAttribute(), QDateTimeEdit::setCalendarPopup(), setCursor(), QComboBox::setEditable(), setEnabled(), QDockWidget::setFloating(), setFont(), QFrame::setFrameStyle(), setGeometry(), setLayoutDirection(), QComboBox::setLineEdit(), setLocale(), setMaximumSize(), setMinimumSize(), QDialog::setModal(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QSplitter::setOrientation(), setPalette(), setParent(), QSplashScreen::setPixmap(), QLineEdit::setReadOnly(), setSizePolicy(), setStyle(), setUpdatesEnabled(), QGraphicsView::setupViewport(), setVisible(), QColorDialog::setVisible(), QFileDialog::setVisible(), QFontDialog::setVisible(), QWidgetWindowPrivate::setVisible(), QWidgetPrivate::setVisible(), QMdiSubWindow::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowIcon(), setWindowModality(), setWindowModified(), setWindowOpacity(), QWidgetPrivate::showChildren(), QDialog::showEvent(), QApplicationPrivate::translateRawTouchEvent(), QMacStyle::unpolish(), QAndroidStyle::unpolish(), QWindowsVistaStyle::unpolish(), unsetCursor(), unsetLayoutDirection(), unsetLocale(), and winId().
void QWidget::setAutoFillBackground | ( | bool | enabled | ) |
Definition at line 319 of file qwidget.cpp.
References d, enabled, and update().
Referenced by QCalendarWidgetPrivate::createNavigationBar(), QWizardPrivate::recreateLayout(), and QGraphicsView::setupViewport().
void QWidget::setBackgroundRole | ( | QPalette::ColorRole | role | ) |
Sets the background role of the widget to role.
The background role defines the brush from the widget's \l palette that is used to render the background.
If role is QPalette::NoRole, then the widget inherits its parent's background role.
Note that styles are free to choose any color from the palette. You can modify the palette or set a style sheet if you don't achieve the result you want with setBackgroundRole().
Definition at line 4398 of file qwidget.cpp.
References d.
Referenced by QTipLabel::QTipLabel(), QToolBox::QToolBox(), QToolBoxButton::QToolBoxButton(), QWizardHeader::QWizardHeader(), ScreenWidget::ScreenWidget(), QCalendarWidgetPrivate::createNavigationBar(), QWizardPrivate::recreateLayout(), and QToolBoxPrivate::updateTabs().
void QWidget::setBaseSize | ( | int | basew, |
int | baseh | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setBaseSize(QSize(basew, baseh)).
Sets the widgets base size to width basew and height baseh.
Definition at line 4061 of file qwidget.cpp.
References d, and isWindow().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The setContentsMargins function sets the margins around the widget's contents.
Sets the margins around the contents of the widget to have the sizes determined by margins. The margins are used by the layout system, and may be used by subclasses to specify the area to draw in (e.g. excluding the frame).
Changing the margins will trigger a resizeEvent().
Definition at line 7706 of file qwidget.cpp.
References QMargins::bottom(), QMargins::left(), QMargins::right(), setContentsMargins(), and QMargins::top().
void QWidget::setContentsMargins | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom.
The margins are used by the layout system, and may be used by subclasses to specify the area to draw in (e.g. excluding the frame).
Changing the margins will trigger a resizeEvent().
Definition at line 7676 of file qwidget.cpp.
References d.
Referenced by QTornOffMenu::QTornOffMenu(), QMdiSubWindow::event(), QWindowsVistaStyle::polish(), QPixmapStyle::polish(), QWizardPrivate::recreateLayout(), QSplitterHandle::resizeEvent(), setContentsMargins(), QFrame::setFrameRect(), QMessageBoxPrivate::setupLayout(), and QWindowsVistaStyle::unpolish().
void QWidget::setContextMenuPolicy | ( | Qt::ContextMenuPolicy | policy | ) |
Definition at line 7872 of file qwidget.cpp.
References policy.
Definition at line 4967 of file qwidget.cpp.
References Qt::ArrowCursor, cursor, QEvent::CursorChange, d, QCoreApplication::sendEvent(), setAttribute(), QCursor::shape(), and Qt::WA_SetCursor.
Referenced by QWhatsThat::QWhatsThat(), QApplicationPrivate::dispatchEnterLeave(), QToolBar::event(), QWhatsThat::mouseMoveEvent(), QSizeGrip::moveEvent(), QSplitterHandle::setOrientation(), and QLineEdit::setReadOnly().
|
slot |
Disables widget input events if disable is true; otherwise enables input events.
See the \l enabled documentation for more information.
Definition at line 3457 of file qwidget.cpp.
References setEnabled().
|
slot |
Definition at line 3365 of file qwidget.cpp.
References d, setAttribute(), and Qt::WA_ForceDisabled.
Referenced by QAlphaWidget::QAlphaWidget(), QRollEffect::QRollEffect(), QTornOffMenu::QTornOffMenu(), ScreenWidget::ScreenWidget(), QInputDialogPrivate::_q_currentRowChanged(), QGroupBoxPrivate::_q_setChildrenEnabled(), QPrintPreviewDialogPrivate::_q_setMode(), QFileDialogPrivate::_q_updateOkButton(), QGroupBox::childEvent(), QMenuBarPrivate::copyActionToPlatformMenu(), QToolBarLayout::layoutActions(), QTabBarPrivate::layoutTabs(), QTabBarPrivate::makeVisible(), QAlphaWidget::run(), QRollEffect::run(), QToolButton::setDefaultAction(), setDisabled(), ScreenWidget::setImage(), QInputDialogPrivate::setInputWidget(), QTabWidget::setTabEnabled(), and QCalendarWidgetPrivate::updateMonthMenu().
void QWidget::setFixedHeight | ( | int | h | ) |
Sets both the minimum and maximum heights of the widget to h without changing the widths.
Provided for convenience.
Definition at line 4182 of file qwidget.cpp.
References d, maximumSize, minimumSize, setMaximumSize(), setMinimumSize(), Qt::Vertical, and width.
Referenced by QWizardHeader::QWizardHeader(), and QWizardPrivate::recreateLayout().
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking.
This will override the default size constraints set by QLayout.
To remove constraints, set the size to QWIDGETSIZE_MAX.
Alternatively, if you want the widget to have a fixed size based on its contents, you can call QLayout::setSizeConstraint(QLayout::SetFixedSize);
Definition at line 4089 of file qwidget.cpp.
References setFixedSize().
Referenced by QMdi::ControlLabel::ControlLabel(), QLayout::activate(), QMdi::ControlLabel::event(), setFixedSize(), and QWizardHeader::setup().
void QWidget::setFixedSize | ( | int | w, |
int | h | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the width of the widget to w and the height to h.
Definition at line 4102 of file qwidget.cpp.
References d, isWindow(), QWIDGETSIZE_MAX, and resize().
void QWidget::setFixedWidth | ( | int | w | ) |
Sets both the minimum and maximum width of the widget to w without changing the heights.
Provided for convenience.
Definition at line 4162 of file qwidget.cpp.
References d, height, Qt::Horizontal, maximumSize, minimumSize, setMaximumSize(), and setMinimumSize().
|
inlineslot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}.
Definition at line 423 of file qwidget.h.
References Qt::OtherFocusReason, and setFocus().
Referenced by QGroupBoxPrivate::_q_fixFocus(), QCalendarWidgetPrivate::_q_yearClicked(), QGraphicsScenePrivate::addPopup(), QMdiArea::addSubWindow(), QAbstractButton::animateClick(), QApplicationPrivate::closePopup(), QAbstractItemDelegatePrivate::editorEventFilter(), QAbstractButton::event(), QGroupBox::event(), QCalendarWidget::eventFilter(), QMenu::focusNextPrevChild(), QWidgetWindow::handleFocusInEvent(), QPrintPreviewDialogPrivate::init(), QMdiSubWindowPrivate::leaveInteractiveMode(), QCalendarWidget::mousePressEvent(), QAbstractButtonPrivate::moveFocus(), QApplicationPrivate::notifyActiveWindowChange(), QApplicationPrivate::openPopup(), QMdiSubWindowPrivate::restoreFocus(), QApplicationPrivate::setActiveWindow(), QMenuBarPrivate::setCurrentAction(), QMenuPrivate::setCurrentAction(), QMessageBox::setDefaultButton(), setFocus(), setFocus(), setFocusProxy(), QMdiSubWindowPrivate::setFocusWidget(), QMenuBarPrivate::setKeyboardMode(), QDialogPrivate::setVisible(), QWidgetPrivate::show_helper(), and QWizardPrivate::switchToPage().
void QWidget::setFocus | ( | Qt::FocusReason | reason | ) |
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the \l{isActiveWindow()}{active window}.
The reason argument will be passed into any focus event sent from this function, it is used to give an explanation of what caused the widget to get focus. If the window is not active, the widget will be given the focus when the window becomes active.
First, a focus about to change event is sent to the focus widget (if any) to tell it that it is about to lose the focus. Then focus is changed, a focus out event is sent to the previous focus item and a focus in event is sent to the new item to tell it that it just received the focus. (Nothing happens if the focus in and focus out widgets are the same.)
setFocus() gives focus to a widget regardless of its focus policy, but does not clear any keyboard grab (see grabKeyboard()).
Be aware that if the widget is hidden, it will not accept focus until it is shown.
Definition at line 6521 of file qwidget.cpp.
References QInputMethod::commit(), QApplicationPrivate::focus_widget, QEvent::FocusAboutToChange, QEvent::FocusIn, QEvent::FocusOut, focusProxy(), QApplication::focusWidget(), focusWidget(), QGuiApplication::inputMethod(), isEnabled(), isHidden(), Qt::MenuBarFocusReason, Qt::NoFocusReason, Qt::PopupFocusReason, QCoreApplication::sendEvent(), setFocus(), QApplicationPrivate::setFocusWidget(), testAttribute(), Qt::WA_InputMethodEnabled, and window().
void QWidget::setFocusPolicy | ( | Qt::FocusPolicy | policy | ) |
Definition at line 7904 of file qwidget.cpp.
Referenced by QMdi::ControlLabel::ControlLabel(), QMdi::ControllerWidget::ControllerWidget(), QDockWidgetTitleButton::QDockWidgetTitleButton(), QToolBarLayout::QToolBarLayout(), QToolBoxButton::QToolBoxButton(), QtPrivate::QWellArray::QWellArray(), QWhatsThat::QWhatsThat(), QQuickComboBoxPrivate::createdItem(), QItemDelegate::createEditor(), QCalendarWidgetPrivate::createNavigationBar(), QFontDialogPrivate::init(), QMenuBarPrivate::init(), QTabBarPrivate::init(), QGroupBox::setCheckable(), QLabel::setTextInteractionFlags(), and QGraphicsView::setupViewport().
Sets the widget's focus proxy to widget w.
If w is \nullptr, the function resets this widget to have no focus proxy.
Some widgets can "have focus", but create a child widget, such as QLineEdit, to actually handle the focus. In this case, the widget can set the line edit to be its focus proxy.
setFocusProxy() sets the widget which will actually get focus when "this widget" gets it. If there is a focus proxy, setFocus() and hasFocus() operate on the focus proxy. If "this widget" is the focus widget, then setFocusProxy() moves focus to the new focus proxy.
Definition at line 6372 of file qwidget.cpp.
References child, QObject::children(), className, d, QApplicationPrivate::focus_widget, fp, isAncestorOf(), metaObject(), QObject::objectName, Qt::OtherFocusReason, parentWidget(), Q_ASSERT, Q_UNLIKELY, qobject_cast< QWidget * >(), qWarning, setFocus(), and toLocal8Bit().
Referenced by QFontDialogPrivate::init(), QKeySequenceEditPrivate::init(), QDialogButtonBoxPrivate::layoutButtons(), and QTabWidget::setTabBar().
Definition at line 4674 of file qwidget.cpp.
References d, font, qt_styleSheet(), QFont::resolve(), QFont::resolveMask(), setAttribute(), style(), and Qt::WA_SetFont.
Referenced by QWizardHeader::QWizardHeader(), QComboBox::changeEvent(), QCalendarWidgetPrivate::createNavigationBar(), QWindowsVistaStyle::polish(), QWizardPrivate::recreateLayout(), QToolButton::setDefaultAction(), QWidgetPlatformMenu::setFont(), QWindowsVistaStyle::unpolish(), and QFontDialogPrivate::updateSampleFont().
void QWidget::setForegroundRole | ( | QPalette::ColorRole | role | ) |
Sets the foreground role of the widget to role.
The foreground role defines the color from the widget's \l palette that is used to draw the foreground.
If role is QPalette::NoRole, the widget uses a foreground role that contrasts with the background role.
Note that styles are free to choose any color from the palette. You can modify the palette or set a style sheet if you don't achieve the result you want with setForegroundRole().
Definition at line 4463 of file qwidget.cpp.
References d.
Referenced by QTipLabel::QTipLabel().
Definition at line 7273 of file qwidget.cpp.
References d, isWindow(), maximumSize, minimumSize, QWindowContainer::parentWasMoved(), setAttribute(), testAttribute(), Qt::WA_Moved, Qt::WA_PendingMoveEvent, Qt::WA_PendingResizeEvent, Qt::WA_Resized, and Qt::WA_WState_Created.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)).
Definition at line 886 of file qwidget.h.
Referenced by QSystemTrayIconSys::QSystemTrayIconSys(), QCalendarWidgetPrivate::_q_yearClicked(), QWidgetAnimator::animate(), QWidgetPrivate::create(), QLayoutPrivate::doResize(), QPixmapStyle::eventFilter(), fixToolBarOrientation(), QProgressDialogPrivate::layout(), QTabBarPrivate::layoutTabs(), QMenuPrivate::mouseEventTaken(), QSizeGrip::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QMdi::RegularTiler::rearrange(), QMdi::SimpleCascader::rearrange(), QMdi::IconTiler::rearrange(), QSplitter::replaceWidget(), QRubberBand::resize(), restoreGeometry(), QDockAreaLayoutInfo::restoreState(), QWidgetItem::setGeometry(), QRubberBand::setGeometry(), QToolBarLayout::setGeometry(), QStackedLayout::setGeometry(), QWidgetPrivate::setGeometry_sys(), QAbstractItemView::setIndexWidget(), QStackedLayout::setStackingMode(), QTabBarPrivate::setupMovableTab(), QComboBox::showPopup(), QMenuPrivate::updateActionRects(), QAbstractSpinBoxPrivate::updateEditFieldGeometry(), QDateTimeEditPrivate::updateEditFieldGeometry(), QMenuBarPrivate::updateGeometries(), and QComboBoxPrivate::updateLineEditGeometry().
|
slot |
Convenience function, equivalent to setVisible(!hidden).
Definition at line 8446 of file qwidget.cpp.
References setVisible().
void QWidget::setInputMethodHints | ( | Qt::InputMethodHints | hints | ) |
Definition at line 10017 of file qwidget.cpp.
References d, QGuiApplication::focusObject(), Qt::ImHints, QGuiApplication::inputMethod(), Q_UNUSED, and QInputMethod::update().
Referenced by QInputDialog::getItem(), QInputDialog::getMultiLineText(), QInputDialog::getText(), QLineEdit::setEchoMode(), and QGraphicsViewPrivate::updateInputMethodSensitivity().
Sets the layout manager for this widget to layout.
If there already is a layout manager installed on this widget, QWidget won't let you install another. You must first delete the existing layout manager (returned by layout()) before you can call setLayout() with the new layout.
If layout is the layout manager on a different widget, setLayout() will reparent the layout and make it the layout manager for this widget.
Example:
An alternative to calling this function is to pass this widget to the layout's constructor.
The QWidget will take ownership of layout.
Definition at line 10286 of file qwidget.cpp.
References className, d, QByteArray::data(), QLayout::invalidate(), QObject::isWidgetType(), isWindow(), layout(), metaObject(), QObject::objectName, QObject::parent(), Q_UNLIKELY, qWarning, QObject::setParent(), QString::toLocal8Bit(), and toLocal8Bit().
Referenced by Window::Window(), QCalendarWidgetPrivate::createNavigationBar(), and QPrintPreviewDialogPrivate::init().
void QWidget::setLayoutDirection | ( | Qt::LayoutDirection | direction | ) |
Definition at line 4886 of file qwidget.cpp.
References d, direction, Qt::LayoutDirectionAuto, setAttribute(), unsetLayoutDirection(), and Qt::WA_SetLayoutDirection.
Referenced by QTornOffMenu::QTornOffMenu(), and QComboBoxPrivate::updateLayoutDirection().
Definition at line 5917 of file qwidget.cpp.
References d, locale, setAttribute(), and Qt::WA_SetLocale.
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible.
If the region includes pixels outside the rect() of the widget, window system controls in that area may or may not be visible, depending on the platform.
Note that this effect can be slow if the region is particularly complex.
The following code shows how an image with an alpha channel can be used to generate a mask for a widget:
The label shown by this code is masked using the image it contains, giving the appearance that an irregularly-shaped image is being drawn directly onto the screen.
Masked widgets receive mouse events only on their visible portions.
Definition at line 13065 of file qwidget.cpp.
References setMask().
Referenced by clearMask(), QMenu::event(), main(), QSplitterHandle::resizeEvent(), QTipLabel::resizeEvent(), QComboBoxPrivateContainer::resizeEvent(), and setMask().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Causes only the parts of the widget which overlap region to be visible.
If the region includes pixels outside the rect() of the widget, window system controls in that area may or may not be visible, depending on the platform.
Since QRegion allows arbitrarily complex regions to be created, widget masks can be made to suit the most unconventionally-shaped windows, and even allow widgets to be displayed with holes in them. Note that this effect can be slow if the region is particularly complex.
Widget masks are used to hint to the window system that the application does not want mouse events for areas outside the mask. On most systems, they also result in coarse visual clipping. To get smooth window edges, use translucent background and anti-aliased painting instead, as shown in the \l{Translucent Background} example.
Definition at line 12981 of file qwidget.cpp.
References d, QRegion::isEmpty(), isVisible(), isWindow(), parentWidget(), rect, testAttribute(), QRegion::translate(), update(), and Qt::WA_WState_Created.
void QWidget::setMaximumHeight | ( | int | maxh | ) |
Definition at line 4146 of file qwidget.cpp.
References d, maximumSize, QWIDGETSIZE_MAX, setMaximumSize(), Qt::Vertical, and width.
Definition at line 835 of file qwidget.h.
Referenced by QLayout::activate(), setFixedHeight(), setFixedWidth(), setMaximumHeight(), setMaximumWidth(), and QWizardHeader::setup().
void QWidget::setMaximumSize | ( | int | maxw, |
int | maxh | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function corresponds to setMaximumSize(QSize(maxw, maxh)).
Sets the maximum width to maxw and the maximum height to maxh.
Definition at line 4012 of file qwidget.cpp.
References d, height, isWindow(), qMin(), resize(), setAttribute(), testAttribute(), Qt::WA_Resized, and width.
void QWidget::setMaximumWidth | ( | int | maxw | ) |
Definition at line 4137 of file qwidget.cpp.
References d, height, Qt::Horizontal, maximumSize, QWIDGETSIZE_MAX, and setMaximumSize().
Referenced by QPrintPreviewDialogPrivate::updatePageNumLabel().
void QWidget::setMinimumHeight | ( | int | minh | ) |
Definition at line 4128 of file qwidget.cpp.
References d, minimumSize, setMinimumSize(), Qt::Vertical, and width.
Referenced by QtPrivate::QColorShower::QColorShower(), and QWizardPrivate::recreateLayout().
Definition at line 832 of file qwidget.h.
Referenced by FinalWidget::FinalWidget(), QPagePreview::QPagePreview(), QSystemTrayIconSys::QSystemTrayIconSys(), ScreenWidget::ScreenWidget(), QLayout::activate(), setFixedHeight(), setFixedWidth(), QToolBar::setIconSize(), setMinimumHeight(), setMinimumWidth(), QToolBar::setToolButtonStyle(), QWizardHeader::setup(), and QMdiSubWindow::showShaded().
void QWidget::setMinimumSize | ( | int | minw, |
int | minh | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function corresponds to setMinimumSize(QSize(minw, minh)).
Sets the minimum width to minw and the minimum height to minh.
Definition at line 3952 of file qwidget.cpp.
References d, height, isMaximized(), isWindow(), maximized, qMax(), resize(), setAttribute(), testAttribute(), Qt::WA_Resized, width, and Qt::WindowMaximized.
void QWidget::setMinimumWidth | ( | int | minw | ) |
Definition at line 4119 of file qwidget.cpp.
References d, height, Qt::Horizontal, minimumSize, and setMinimumSize().
Referenced by QtPrivate::QColorShower::QColorShower(), QWidgetPlatformMenu::setMinimumWidth(), and QPrintPreviewDialogPrivate::updatePageNumLabel().
|
inline |
Definition at line 853 of file qwidget.h.
References setAttribute(), and Qt::WA_MouseTracking.
Referenced by QMdi::ControllerWidget::ControllerWidget(), QSystemTrayIconSys::QSystemTrayIconSys(), QTipLabel::QTipLabel(), QWhatsThat::QWhatsThat(), QWidgetResizeHandler::QWidgetResizeHandler(), QMenuPrivate::ScrollerTearOffItem::ScrollerTearOffItem(), QMenu::changeEvent(), QMenuBar::changeEvent(), QLabel::setText(), and QGraphicsView::setupViewport().
Definition at line 4537 of file qwidget.cpp.
References d, palette, QPalette::resolve(), QPalette::resolveMask(), setAttribute(), and Qt::WA_SetPalette.
Referenced by QTipLabel::QTipLabel(), QWhatsThat::QWhatsThat(), ScreenWidget::ScreenWidget(), QFocusFrame::eventFilter(), QtPrivate::QCalToolButton::paintEvent(), QWindowsVistaStyle::polish(), QPixmapStyle::polish(), QWizardPrivate::recreateLayout(), ScreenWidget::setColor(), QToolTip::setPalette(), QWizardPrivate::updatePalette(), QToolBoxPrivate::updateTabs(), and QComboBoxPrivate::updateViewContainerPaletteAndOpacity().
Sets the parent of the widget to parent, and resets the window flags.
The widget is moved to position (0, 0) in its new parent.
If the new parent widget is in a different window, the reparented widget and its children are appended to the end of the \l{setFocusPolicy()}{tab chain} of the new parent widget, in the same internal order as before. If one of the moved widgets had keyboard focus, setParent() calls clearFocus() for that widget.
If the new parent widget is in the same window as the old parent, setting the parent doesn't change the tab order or keyboard focus.
If the "new" parent widget is the old parent widget, this function does nothing.
Definition at line 10652 of file qwidget.cpp.
References QObject::parent(), parentWidget(), setParent(), windowFlags(), and Qt::WindowType_Mask.
Referenced by QTornOffMenu::QTornOffMenu(), QDialogButtonBox::addButton(), QMainWindowLayout::animationFinished(), QWidgetPrivate::create(), QQuickDialogButtonBoxPrivate::createStandardButton(), QSplitterPrivate::insertWidget_helper(), QDialog::open(), QMdiSubWindowPrivate::removeBaseWidget(), QDialogButtonBoxPrivate::removeButton(), QLayoutPrivate::reparentChildWidgets(), QSplitter::replaceWidget(), QDockAreaLayout::restoreDockWidget(), QWizard::setButton(), QTabWidget::setCornerWidget(), QAbstractItemView::setIndexWidget(), setParent(), QTabWidget::setTabBar(), QTabBar::setTabButton(), MyScrollArea::setWidget(), QMdiSubWindow::setWidget(), QScrollArea::setWidget(), QWidgetPrivate::setWidgetParentHelper(), QMessageBox::setWindowModality(), QMainWindow::takeCentralWidget(), and QMainWindowLayout::unplug().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function also takes widget flags, f as an argument.
Definition at line 10680 of file qwidget.cpp.
References Qt::AA_DontCreateNativeWidgetSiblings, Qt::AA_UseStyleSheetPropagationInWidgetStyles, bypassGraphicsProxyWidget(), QEvent::ChildAdded, QEvent::ChildPolished, className, clearFocus(), create(), d, Qt::Desktop, destroy(), e, focusWidget(), QWidgetPrivate::get(), hide(), isAncestorOf(), isVisible(), isWindow(), metaObject(), Qt::MSWindowsOwnDC, QObject::objectName, QObject::parent(), QEvent::ParentAboutToChange, QEvent::ParentChange, QWindowContainer::parentWasChanged(), parentWidget(), Q_ASSERT_X, q_evaluateRhiConfig(), Q_FUNC_INFO, qPrintable, qScopeGuard(), qSendWindowChangeToTextureChildrenRecursively(), QT_CONFIG, qWarning, QSurface::RasterSurface, QCoreApplication::sendEvent(), setAttribute(), QWidgetPrivate::setTextureChildSeen(), QCoreApplication::testAttribute(), testAttribute(), Qt::WA_ForceDisabled, Qt::WA_ForceUpdatesDisabled, Qt::WA_NativeWindow, Qt::WA_PaintOnScreen, Qt::WA_Resized, Qt::WA_StyleSheet, Qt::WA_WState_Created, Qt::WA_WState_ExplicitShowHide, Qt::WA_WState_Hidden, Qt::Window, window(), QEvent::WindowAboutToChangeInternal, QEvent::WindowChangeInternal, and windowHandle().
Sets the screen on which the widget should be shown to screen.
Setting the screen only makes sense for windows. If necessary, the widget's window will get recreated on screen.
Definition at line 2531 of file qwidget.cpp.
Referenced by QDialog::adjustPosition(), and QWidgetPrivate::create().
void QWidget::setShortcutAutoRepeat | ( | int | id, |
bool | enable = true |
||
) |
If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled.
Definition at line 11832 of file qwidget.cpp.
References QGuiApplicationPrivate::instance(), Q_ASSERT, and qApp.
void QWidget::setShortcutEnabled | ( | int | id, |
bool | enable = true |
||
) |
If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled.
Definition at line 11817 of file qwidget.cpp.
References QGuiApplicationPrivate::instance(), Q_ASSERT, and qApp.
Referenced by QTabBar::setTabEnabled(), QTabBar::setTabText(), and QTabBar::setTabVisible().
void QWidget::setSizeIncrement | ( | int | w, |
int | h | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the x (width) size increment to w and the y (height) size increment to h.
Definition at line 4042 of file qwidget.cpp.
References d, and isWindow().
void QWidget::setSizePolicy | ( | QSizePolicy | policy | ) |
Definition at line 10377 of file qwidget.cpp.
References d, isWindow(), policy, QSizePolicy::retainSizeWhenHidden(), setAttribute(), updateGeometry(), and Qt::WA_WState_OwnSizePolicy.
Referenced by QMdi::ControllerWidget::ControllerWidget(), DetailButton::DetailButton(), QtPrivate::QColorPicker::QColorPicker(), QtPrivate::QColorShower::QColorShower(), QtPrivate::QColorWell::QColorWell(), QComboBoxPrivateScroller::QComboBoxPrivateScroller(), QPagePreview::QPagePreview(), QToolBarExtension::QToolBarExtension(), QToolBarSeparator::QToolBarSeparator(), QToolBoxButton::QToolBoxButton(), QWizardHeader::QWizardHeader(), QDefaultItemEditorFactory::createEditor(), QCalendarWidgetPrivate::createNavigationBar(), QFontDialogPrivate::init(), QWizardPrivate::init(), QTabBarPrivate::init(), QTabWidgetPrivate::init(), QMessageBoxPrivate::init(), QPrintPreviewDialogPrivate::init(), QWizardPrivate::recreateLayout(), QFrame::setFrameStyle(), QToolBar::setOrientation(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QSplitter::setOrientation(), QSplitter::setStretchFactor(), and QMessageBoxPrivate::updateSize().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width.
Definition at line 907 of file qwidget.h.
References setSizePolicy().
Sets the widget's GUI style to style.
The ownership of the style object is not transferred.
If no style is set, the widget uses the application's style, QApplication::style() instead.
Setting a widget's style has no effect on existing or future child widgets.
Definition at line 2637 of file qwidget.cpp.
References d, qApp, QStyleSheetStyle, qt_styleSheet(), setAttribute(), style(), and Qt::WA_SetStyle.
Referenced by QTornOffMenu::QTornOffMenu(), QDialogButtonBoxPrivate::createButton(), QWizardPrivate::ensureButton(), and QWizardPrivate::setStyle().
Definition at line 2562 of file qwidget.cpp.
References child, d, QString::isEmpty(), proxy, QStyleSheetStyle, qt_styleSheet(), styleSheet, testAttribute(), and Qt::WA_SetStyle.
Referenced by QTornOffMenu::QTornOffMenu(), and QTipLabel::placeTip().
|
inline |
Definition at line 862 of file qwidget.h.
References setAttribute(), and Qt::WA_TabletTracking.
Puts the second widget after the first widget in the focus order.
It effectively removes the second widget from its focus chain and inserts it after the first widget.
Note that since the tab order of the second widget is changed, you should order a chain like this:
not like this:
If first or second has a focus proxy, setTabOrder() correctly substitutes the proxy.
Definition at line 7002 of file qwidget.cpp.
References focusPolicy, focusProxy(), isAncestorOf(), next, Qt::NoFocus, Q_UNLIKELY, qobject_cast< QWidget * >(), qWarning, and window().
Referenced by QAbstractItemViewPrivate::editor(), QDialogButtonBoxPrivate::layoutButtons(), QWizardPrivate::setButtonLayout(), and setTabOrder().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the tab order for the widgets in the widgets list by calling \l{QWidget::setTabOrder(QWidget *, QWidget *)} for each consecutive pair of widgets.
Instead of setting up each pair manually like this:
you can call:
The call does not create a closed tab focus loop. If there are more widgets with \l{Qt::TabFocus} focus policy, tabbing on {d} will move focus to one of those widgets, not back to
{a}.
Definition at line 917 of file qwidget.h.
References setTabOrder(), widget, and widgets.
void QWidget::setUpdatesEnabled | ( | bool | enable | ) |
Definition at line 7940 of file qwidget.cpp.
References d, setAttribute(), and Qt::WA_ForceUpdatesDisabled.
Referenced by QComboBox::showPopup().
|
virtualslot |
Reimplemented in QPrintPreviewDialog, QPrintPreviewWidget, QColorDialog, QDialog, QFileDialog, QFontDialog, QInputDialog, QWizard, and QSizeGrip.
Definition at line 8329 of file qwidget.cpp.
References d, setAttribute(), testAttribute(), visible, Qt::WA_WState_ExplicitShowHide, and Qt::WA_WState_Hidden.
Referenced by QRubberBand::QRubberBand(), QPrintDialogPrivate::_q_collapseOrExpandDialog(), QMdiSubWindow::changeEvent(), QMenuBarPrivate::copyActionToPlatformMenu(), QSizeGrip::eventFilter(), QPageSetupDialog::exec(), QPrintDialog::exec(), extension(), hide(), hideOrShowWidgetsInLayout(), QTabBarPrivate::moveTabFinished(), QWizardPrivate::recreateLayout(), QDockAreaLayout::restoreDockWidget(), QToolBarAreaLayout::restoreState(), QDockAreaLayoutInfo::restoreState(), QTabBar::setAutoHide(), setHidden(), QStackedLayout::setStackingMode(), QTabWidget::setTabVisible(), QMessageBoxPrivate::setupLayout(), QTabBarPrivate::setupMovableTab(), QFormLayoutItem::setVisible(), QPrintPreviewDialog::setVisible(), QPrintPreviewWidget::setVisible(), QColorDialog::setVisible(), QFileDialog::setVisible(), QFontDialog::setVisible(), QInputDialog::setVisible(), QWizard::setVisible(), QMenuBar::setVisible(), QSizeGrip::setVisible(), show(), showFullScreen(), showMaximized(), showMinimized(), showNormal(), QMdiSubWindow::showShaded(), QQuickMenuBarPrivate::toggleCurrentMenu(), QMenuPrivate::updateActionRects(), and QDockWidgetPrivate::updateButtons().
Definition at line 6254 of file qwidget.cpp.
References d, and windowFilePath.
void QWidget::setWindowFlag | ( | Qt::WindowType | flag, |
bool | on = true |
||
) |
Sets the window flag flag on this widget if on is true; otherwise clears the flag.
Definition at line 10564 of file qwidget.cpp.
References d.
void QWidget::setWindowFlags | ( | Qt::WindowFlags | type | ) |
Definition at line 10550 of file qwidget.cpp.
References d.
Referenced by QRubberBand::changeEvent(), QVideoWidget::setFullScreen(), and QWidgetPlatformDialog::show().
Definition at line 6178 of file qwidget.cpp.
References d, emit, icon, QIcon::isNull(), setAttribute(), Qt::WA_SetWindowIcon, and windowIconChanged().
Referenced by QMdi::ControlContainer::ControlContainer(), QMdiSubWindow::setWidget(), and QMdi::ControlContainer::updateWindowIcon().
Definition at line 6085 of file qwidget.cpp.
References d, e, emit, QEvent::IconTextChange, QCoreApplication::sendEvent(), windowIconText, and windowIconTextChanged().
void QWidget::setWindowModality | ( | Qt::WindowModality | windowModality | ) |
Definition at line 2806 of file qwidget.cpp.
References Qt::NonModal, setAttribute(), Qt::WA_SetWindowModality, Qt::WA_ShowModal, and windowModality.
Referenced by QErrorMessage::QErrorMessage(), moo(), QDialog::open(), QMessageBox::setWindowModality(), and QWidgetPlatformDialog::show().
|
slot |
Definition at line 11549 of file qwidget.cpp.
References d, e, QEvent::ModifiedChange, QCoreApplication::sendEvent(), setAttribute(), and Qt::WA_WindowModified.
Referenced by QMdiSubWindow::event(), QMdiSubWindow::eventFilter(), and QMdiSubWindow::setWidget().
Definition at line 11486 of file qwidget.cpp.
References d, isWindow(), QGraphicsItem::NoCache, QTLWExtra::opacity, proxy, qBound(), scene, setAttribute(), testAttribute(), QGraphicsScene::update(), Qt::WA_WState_Created, and Qt::WA_WState_WindowOpacitySet.
Referenced by QTipLabel::QTipLabel(), QAlphaWidget::~QAlphaWidget(), QWindowsVistaStyle::polish(), QAlphaWidget::render(), QAlphaWidget::run(), QMacStyle::unpolish(), QWindowsVistaStyle::unpolish(), and QComboBoxPrivate::updateViewContainerPaletteAndOpacity().
Sets the window's role to role.
This only makes sense for windows on X11.
Definition at line 6308 of file qwidget.cpp.
References d, Q_UNUSED, and windowHandle().
void QWidget::setWindowState | ( | Qt::WindowStates | windowState | ) |
Sets the window state to windowState.
The window state is a OR'ed combination of Qt::WindowState: Qt::WindowMinimized, Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
If the window is not visible (i.e. isVisible() returns false
), the window state will take effect when show() is called. For visible windows, the change is immediate. For example, to toggle between full-screen and normal mode, use the following code:
In order to restore and activate a minimized window (while preserving its maximized and/or full-screen state), use the following:
Calling this function will hide the widget. You must call show() to make the widget visible again.
When the window state changes, the widget receives a changeEvent() of type QEvent::WindowStateChange.
Definition at line 2944 of file qwidget.cpp.
References activateWindow(), adjustSize(), create(), d, e, geometry, isVisible(), isWindow(), Q_ASSERT, QCoreApplication::sendEvent(), testAttribute(), Qt::WA_Resized, Qt::WA_WState_Created, Qt::WindowActive, Qt::WindowFullScreen, windowHandle(), Qt::WindowMaximized, Qt::WindowMinimized, and windowState().
Referenced by QDockAreaLayout::restoreDockWidget(), restoreGeometry(), QToolBarAreaLayout::restoreState(), QDialog::showEvent(), showFullScreen(), showMaximized(), showMinimized(), and showNormal().
Definition at line 6109 of file qwidget.cpp.
References d, e, emit, QString::isEmpty(), QString::isNull(), QCoreApplication::sendEvent(), title, windowTitle, QEvent::WindowTitleChange, and windowTitleChanged().
Referenced by ClipWindow::ClipWindow(), MainWindow::MainWindow(), QAbstractPrintDialog::QAbstractPrintDialog(), QAbstractPrintDialog::QAbstractPrintDialog(), QDockWidget::QDockWidget(), QPageSetupDialog::QPageSetupDialog(), QPageSetupDialog::QPageSetupDialog(), QPrintPropertiesDialog::QPrintPropertiesDialog(), QToolBar::QToolBar(), Viewer::Viewer(), dropevents::Window::Window(), QColorDialog::getColor(), QInputDialog::getDouble(), QFontDialogPrivate::getFont(), QInputDialog::getInt(), QInputDialog::getItem(), QInputDialog::getMultiLineText(), QInputDialog::getText(), main(), QErrorMessage::qtHandler(), MainWindow::saveFile(), QMessageBox::setWindowTitle(), QWidgetPlatformColorDialog::show(), QWidgetPlatformFileDialog::show(), QWidgetPlatformFontDialog::show(), and QTornOffMenu::updateWindowTitle().
|
overrideprotectedvirtual |
A painter that is shared among other instances of QPainter.
Reimplemented from QPaintDevice.
Definition at line 12943 of file qwidget.cpp.
References sp.
|
slot |
Shows the widget and its child widgets.
This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true), depending on the platform's default behavior for the window flags.
Definition at line 7956 of file qwidget.cpp.
References QPlatformIntegration::defaultWindowState(), QGuiApplicationPrivate::platformIntegration(), setVisible(), showFullScreen(), showMaximized(), Qt::WindowFullScreen, and Qt::WindowMaximized.
Referenced by QCalendarWidgetPrivate::_q_yearClicked(), QCalendarWidgetPrivate::_q_yearEditingFinished(), QMessageBox::about(), QMessageBox::aboutQt(), QDialogButtonBoxPrivate::addButtonsToLayout(), addingSubWindowsExample(), QMainWindowLayout::animationFinished(), camera_blah(), QSplitter::childEvent(), QErrorMessage::done(), QWizardPrivate::enableUpdates(), QInputDialogPrivate::ensureLayout(), QFocusFrame::eventFilter(), QMdiSubWindow::eventFilter(), QDialog::exec(), EditorWindow::find(), QProgressDialog::forceShow(), QFileDialog::getOpenFileContent(), QMainWindowLayout::hover(), QStatusBar::insertPermanentWidget(), QSplitterPrivate::insertWidget(), QStatusBar::insertWidget(), QSplitterPrivate::insertWidget_helper(), Window::invokableMethod(), QDialogButtonBoxPrivate::layoutButtons(), QTabBarPrivate::layoutTabs(), main(), main(), mainWindowExample(), QMenuPrivate::mouseEventTaken(), Window::normalMethod(), QDialog::open(), overview_viewfinder(), QAlphaWidget::render(), QSplitter::replaceWidget(), QAlphaWidget::run(), QRollEffect::run(), QFileDialog::saveFileContent(), QWhatsThisPrivate::say(), QWizardPrivate::setButtonLayout(), QToolBarLayout::setGeometry(), QCalendarWidget::setGridVisible(), QAbstractItemView::setIndexWidget(), QInputDialogPrivate::setInputWidget(), QMdiSubWindowPrivate::setMaximizeMode(), QMdiSubWindowPrivate::setNormalMode(), QTabWidget::setTabBar(), QTabBar::setTabButton(), QProgressDialog::setValue(), QCalendarWidget::setVerticalHeaderFormat(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QWidgetPlatformDialog::show(), showAllHiddenTopLevelWidgets(), QWidgetPrivate::showChildren(), QErrorMessage::showMessage(), QComboBox::showPopup(), QWizardPrivate::switchToPage(), QMenuBarPrivate::updateGeometries(), VideoExample::VideoSurface(), VideoExample::VideoWidget(), and wrapInFunction().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter.
Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().
Reimplemented in QDialog, QRubberBand, QStatusBar, QTabBar, QTabWidget, QQuickWidget, QComboBox, QComboBoxPrivateContainer, QToolBox, QPrintPropertiesDialog, QMessageBox, QProgressDialog, QAbstractSpinBox, QVideoWidget, QMdiSubWindow, and QSizeGrip.
Definition at line 10122 of file qwidget.cpp.
Referenced by event(), QComboBox::showEvent(), QToolBox::showEvent(), QVideoWidget::showEvent(), QMdiSubWindow::showEvent(), and QSizeGrip::showEvent().
|
slot |
Shows the widget in full-screen mode.
Calling this function only affects \l{isWindow()}{windows}.
To return from full-screen mode, call showNormal() or close().
An alternative would be to bypass the window manager entirely and create a window with the Qt::X11BypassWindowManagerHint flag. This has other severe problems though, like totally broken keyboard focus and very strange effects on desktop changes or when the user raises other windows.
X11 window managers that follow modern post-ICCCM specifications support full-screen mode properly.
On macOS, showing a window full screen puts the entire application in full-screen mode, providing it with a dedicated desktop. Showing another window while the application runs in full-screen mode might automatically make that window full screen as well. To prevent that, exit full-screen mode by calling showNormal() or by close() on the full screen window before showing another window.
Definition at line 3028 of file qwidget.cpp.
References activateWindow(), ensurePolished(), setVisible(), setWindowState(), Qt::WindowFullScreen, Qt::WindowMaximized, Qt::WindowMinimized, and windowState().
Referenced by QVideoWidget::setFullScreen(), and show().
|
slot |
Shows the widget maximized.
Calling this function only affects \l{isWindow()}{windows}.
On X11, this function may not work properly with certain window managers. See the \l{Window Geometry} documentation for an explanation.
Definition at line 3051 of file qwidget.cpp.
References ensurePolished(), setVisible(), setWindowState(), Qt::WindowFullScreen, Qt::WindowMaximized, Qt::WindowMinimized, and windowState().
Referenced by QMdiAreaPrivate::emitWindowActivated(), QMdiSubWindow::event(), QMdiSubWindow::eventFilter(), QMdiSubWindow::mouseDoubleClickEvent(), QMdiAreaPrivate::setViewMode(), and show().
|
slot |
Shows the widget minimized, as an icon.
Calling this function only affects \l{isWindow()}{windows}.
Definition at line 2854 of file qwidget.cpp.
References ensurePolished(), isMinimized(), isVisible(), setVisible(), setWindowState(), Qt::WindowActive, Qt::WindowMinimized, and windowState().
Referenced by QMdiSubWindow::event(), and QMdiSubWindow::eventFilter().
|
slot |
Restores the widget after it has been maximized or minimized.
Calling this function only affects \l{isWindow()}{windows}.
Definition at line 3067 of file qwidget.cpp.
References ensurePolished(), setVisible(), setWindowState(), Qt::WindowFullScreen, Qt::WindowMaximized, Qt::WindowMinimized, and windowState().
Referenced by QMdiSubWindow::event(), QMdiSubWindow::eventFilter(), QMdiSubWindow::mouseDoubleClickEvent(), QVideoWidget::setFullScreen(), QMdiAreaPrivate::setViewMode(), and QToolTip::showText().
|
virtual |
Reimplemented in QtPrivate::QWellArray, QtPrivate::QColorPicker, QDialog, QInputDialog, DetailButton, QProgressDialog, QWizard, QAbstractSpinBox, QCalendarWidget, QCheckBox, QComboBox, QComboBoxPrivateScroller, QCommandLinkButton, QDateTimeEdit, QDial, QDockWidgetTitleButton, QFontComboBox, QFrame, QLabel, QLCDNumber, QLineEdit, QMdi::ControlLabel, QMdi::ControllerWidget, QMdiSubWindow, QMenu, QMenuBarExtension, QMenuBar, QProgressBar, QPushButton, QRadioButton, QScrollBar, QSizeGrip, QSlider, QSplitter, QSplitterHandle, QTabBar, QTabWidget, QToolBarExtension, QToolBarSeparator, QToolBoxButton, QToolButton, QQuickWidget, QVideoWidget, and QSvgWidget.
Definition at line 8818 of file qwidget.cpp.
References d.
QSize QWidget::sizeIncrement | ( | ) | const |
Definition at line 3860 of file qwidget.cpp.
References d.
QSizePolicy QWidget::sizePolicy | ( | ) | const |
Definition at line 10371 of file qwidget.cpp.
References d.
Places the widget under w in the parent widget's stack.
To make this work, the widget itself and w must be siblings.
Definition at line 11963 of file qwidget.cpp.
References create(), d, e, isWindow(), parentWidget(), Q_ASSERT, QCoreApplication::sendEvent(), testAttribute(), Qt::WA_WState_Created, and QEvent::ZOrderChange.
Referenced by QFocusFrame::eventFilter(), and QMdiAreaPrivate::internalRaise().
QStyle * QWidget::style | ( | ) | const |
Definition at line 2607 of file qwidget.cpp.
References d, and QApplication::style().
Referenced by QComboBoxPrivateContainer::QComboBoxPrivateContainer(), QDockAreaLayout::QDockAreaLayout(), QErrorMessage::QErrorMessage(), QMainWindowLayout::QMainWindowLayout(), QMenuBarExtension::QMenuBarExtension(), QTipLabel::QTipLabel(), QTornOffMenu::QTornOffMenu(), QWidgetAnimator::animate(), QLineEdit::changeEvent(), QMenu::changeEvent(), QMenuBar::changeEvent(), QTabBar::changeEvent(), QToolButton::changeEvent(), QMessageBox::changeEvent(), QAbstractSpinBox::changeEvent(), QDialogButtonBox::changeEvent(), QScrollBar::contextMenuEvent(), QItemDelegate::doCheck(), QItemDelegate::doLayout(), QItemDelegate::drawCheck(), QMacStyle::drawComplexControl(), QCommonStyle::drawControl(), QItemDelegate::drawDisplay(), QItemDelegate::drawFocus(), QFrame::drawFrame(), QStyledItemDelegate::editorEvent(), QLineEdit::event(), QMenu::event(), QTabBar::event(), QWizard::event(), event(), QGroupBox::event(), QMdiSubWindow::event(), QScrollBar::event(), QToolBar::event(), QFocusFrame::eventFilter(), QMenuBar::eventFilter(), QFontDialog::eventFilter(), QToolBarLayout::expandedSize(), QLineEdit::focusInEvent(), QWidgetTextControl::getPaintContext(), QSplitter::handleWidth(), QTabWidget::heightForWidth(), QMenuBar::heightForWidth(), QMenuPrivate::hideMenu(), QComboBox::hidePopup(), QRadioButton::hitButton(), QCheckBox::hitButton(), QPushButton::hitButton(), QAbstractButton::iconSize(), QComboBox::iconSize(), QTabBar::iconSize(), QMenuSloppyState::initialize(), QTabBarPrivate::initStyleBaseOption(), QLineEdit::initStyleOption(), QGroupBox::initStyleOption(), QScrollBar::initStyleOption(), QAbstractSpinBox::initStyleOption(), QTabBar::initStyleOption(), QTabWidget::initStyleOption(), QToolBar::initStyleOption(), QToolButton::initStyleOption(), QTabBar::insertTab(), isActiveWindow(), QMenu::keyPressEvent(), QMenuBar::keyPressEvent(), QAbstractSpinBox::keyPressEvent(), QToolBarLayout::layoutActions(), QAbstractSpinBox::minimumSizeHint(), QCalendarWidget::minimumSizeHint(), QGroupBox::minimumSizeHint(), QLineEdit::minimumSizeHint(), QMdiSubWindow::minimumSizeHint(), QMenuBar::minimumSizeHint(), QSlider::minimumSizeHint(), QTabWidget::minimumSizeHint(), QToolBoxButton::minimumSizeHint(), QScrollBar::mouseMoveEvent(), QGroupBox::mouseMoveEvent(), QMdiSubWindow::mouseMoveEvent(), QScrollBar::mousePressEvent(), QTabBar::mousePressEvent(), QToolButton::mousePressEvent(), QComboBoxPrivateContainer::mousePressEvent(), QSlider::mousePressEvent(), QGroupBox::mousePressEvent(), QTabBar::mouseReleaseEvent(), QSlider::mouseReleaseEvent(), QGroupBox::mouseReleaseEvent(), QSplitter::opaqueResize(), QStyledItemDelegate::paint(), QtPrivate::QWellArray::paintCell(), QFileDialogComboBox::paintEvent(), MyPushButton::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QCommandLinkButton::paintEvent(), QFocusFrame::paintEvent(), QLabel::paintEvent(), QLineEdit::paintEvent(), QMenu::paintEvent(), QMenuBar::paintEvent(), QSplitterHandle::paintEvent(), QStatusBar::paintEvent(), QTabBar::paintEvent(), QToolBarSeparator::paintEvent(), QToolBoxButton::paintEvent(), QComboBoxListView::paintEvent(), QComboBoxPrivateContainer::paintEvent(), MyWidget::paintEvent(), QColumnViewGrip::paintEvent(), QDockWidgetTitleButton::paintEvent(), QMdi::ControllerWidget::paintEvent(), QToolBar::paintEvent(), QSvgWidget::paintEvent(), QMdiSubWindow::paintEvent(), QMacStyle::pixelMetric(), QMainWindowLayout::plug(), qSmartSpacing(), qt_setWindowTitle_helperHelper(), QMdi::SimpleCascader::rearrange(), QMenuPrivate::rect(), QGraphicsProxyWidgetPrivate::removeSubFocusHelper(), QTipLabel::resizeEvent(), QComboBoxPrivateContainer::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), QLineEdit::setCursorMoveStyle(), QComboBox::setEditable(), setFont(), QFrame::setFrameStyle(), QToolBarLayout::setGeometry(), QMainWindow::setIconSize(), QToolBar::setIconSize(), QMessageBox::setInformativeText(), QComboBoxPrivateContainer::setItemView(), QAbstractSpinBox::setLineEdit(), QToolBarExtension::setOrientation(), QLineEdit::setSelection(), setStyle(), QTabBar::setTabsClosable(), QToolButton::setToolButtonStyle(), QFormLayoutPrivate::setupVerticalLayoutData(), QFocusFrame::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QWizard::setWizardStyle(), QMdiSubWindow::showEvent(), QComboBox::showPopup(), DetailButton::sizeHint(), QProgressDialog::sizeHint(), QAbstractSpinBox::sizeHint(), QCheckBox::sizeHint(), QComboBoxPrivateScroller::sizeHint(), QDateTimeEdit::sizeHint(), QDockWidgetTitleButton::sizeHint(), QLineEdit::sizeHint(), QMdi::ControllerWidget::sizeHint(), QMenu::sizeHint(), QMenuBarExtension::sizeHint(), QMenuBar::sizeHint(), QProgressBar::sizeHint(), QPushButton::sizeHint(), QRadioButton::sizeHint(), QScrollBar::sizeHint(), QSizeGrip::sizeHint(), QSlider::sizeHint(), QSplitterHandle::sizeHint(), QTabWidget::sizeHint(), QToolBarExtension::sizeHint(), QToolBarSeparator::sizeHint(), QToolBoxButton::sizeHint(), QToolButton::sizeHint(), QStyledItemDelegate::sizeHint(), QMessageBoxPrivate::standardIcon(), QAbstractSpinBox::stepBy(), QDockAreaLayout::styleChangedEvent(), QCommonStyle::subElementRect(), QTabBar::tabSizeHint(), QMenuPrivate::updateActionRects(), QStyledItemDelegate::updateEditorGeometry(), QToolBarLayout::updateMarginAndSpacing(), QComboBoxPrivateContainer::updateScrollers(), QComboBoxPrivateContainer::updateStyleSettings(), and QComboBoxPrivateContainer::updateTopBottomMargin().
QString QWidget::styleSheet | ( | ) | const |
Definition at line 2554 of file qwidget.cpp.
References d.
|
inline |
Returns true
if attribute attribute is set on this widget; otherwise returns false
.
Definition at line 910 of file qwidget.h.
Referenced by QRollEffect::QRollEffect(), ~QWidget(), acceptDrops(), QLayout::addChildWidget(), QWidgetRepaintManager::addStaticWidget(), changeEvent(), QComboBox::changeEvent(), clearFocus(), QMdiSubWindow::closeEvent(), QApplicationPrivate::closePopup(), contentsMargins(), create(), cursor(), destroy(), QApplicationPrivate::dispatchEnterLeave(), QLayoutPrivate::doResize(), QMacStyle::drawComplexControl(), QWindowsVistaStyle::drawComplexControl(), QCommonStyle::drawControl(), effectiveWinId(), QMacStyle::event(), event(), QMdiSubWindow::event(), QWhatsThisPrivate::eventFilter(), QSizeGrip::eventFilter(), QDialog::exec(), focusOutEvent(), QApplication::font(), formatWidgetAttributes(), QWidgetItem::geometry(), QSplitterLayoutStruct::getWidgetSize(), grab(), grabForPopup(), QWidgetWindow::handleExposeEvent(), QWidgetWindow::handleMoveEvent(), QWidgetWindow::handleResizeEvent(), QWidgetItem::heightForWidth(), QWidgetPrivate::hideChildren(), QRadioButton::initStyleOption(), QCheckBox::initStyleOption(), QStatusBar::insertPermanentWidget(), QStatusBar::insertWidget(), isEnabledTo(), isWindowModified(), QMdiAreaPrivate::lastWindowAboutToBeDestroyed(), layoutDirection(), lower(), QWidgetItem::maximumSize(), QWidgetItem::minimumHeightForWidth(), QWidgetItem::minimumSize(), QCheckBox::mouseMoveEvent(), QPushButton::mouseMoveEvent(), QRadioButton::mouseMoveEvent(), QSizeGrip::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QSizeGrip::mousePressEvent(), move(), QDialog::open(), QTipLabel::placeTip(), QWidgetPrivate::prepareToRender(), q_createNativeChildrenAndSetParent(), qt_aqua_get_known_size(), raise(), resize(), QWidgetPrivate::safeAreaMargins(), QApplicationPrivate::sendMouseEvent(), setAttribute(), QWidgetAction::setDefaultWidget(), QComboBox::setEditable(), QWidgetPrivate::setEnabled_helper(), setFocus(), QFrame::setFrameStyle(), setGeometry(), QWidgetItem::setGeometry(), QGraphicsWidgetPrivate::setLayoutDirection_helper(), setMask(), setMaximumSize(), setMinimumSize(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QSplitter::setOrientation(), setParent(), QWidgetPrivate::setParent_sys(), QGraphicsScene::setStyle(), setStyleSheet(), setVisible(), QColorDialog::setVisible(), QFileDialog::setVisible(), QFontDialog::setVisible(), QWidgetWindowPrivate::setVisible(), QWidgetPrivate::setVisible(), MyScrollArea::setWidget(), QMdiSubWindow::setWidget(), QScrollArea::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowOpacity(), setWindowState(), QWidgetPrivate::showChildren(), QDialog::showEvent(), QComboBox::showPopup(), QMacStyle::sizeFromContents(), QWidgetItem::sizeHint(), stackUnder(), QWidgetRepaintManager::staticContents(), QMacStyle::subControlRect(), QWidgetRepaintManager::sync(), QApplicationPrivate::translateRawTouchEvent(), QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget(), usePlatformSizeGrip(), QStyleHelper::widgetSizePolicy(), and winId().
|
inline |
Use window() instead.
Definition at line 312 of file qwidget.h.
References window().
Referenced by isActiveWindow(), QDockWidgetPrivate::nonClientAreaMouseEvent(), and PressDelayHandler::sendMouseEvent().
|
inline |
Returns true
if the widget is under the mouse cursor; otherwise returns false
.
This value is not updated properly during drag and drop operations.
Definition at line 859 of file qwidget.h.
References Qt::WA_UnderMouse.
Referenced by QToolBar::event(), QWidgetWindow::handleEnterLeaveEvent(), QStyleOption::initFrom(), QRadioButton::initStyleOption(), QCheckBox::initStyleOption(), QPushButton::initStyleOption(), QCheckBox::mouseMoveEvent(), QPushButton::mouseMoveEvent(), QRadioButton::mouseMoveEvent(), QCommandLinkButton::paintEvent(), QDockWidgetTitleButton::paintEvent(), and QBalloonTip::timerEvent().
void QWidget::ungrabGesture | ( | Qt::GestureType | gesture | ) |
Unsubscribes the widget from a given gesture type.
Definition at line 12395 of file qwidget.cpp.
References d, QGestureManager::instance(), and manager.
Referenced by QScroller::ungrabGesture().
void QWidget::unsetCursor | ( | ) |
Definition at line 4990 of file qwidget.cpp.
References QEvent::CursorChange, d, isWindow(), QCoreApplication::sendEvent(), setAttribute(), and Qt::WA_SetCursor.
Referenced by QToolBar::event(), QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(), and QGraphicsProxyWidgetPrivate::setWidget_helper().
void QWidget::unsetLayoutDirection | ( | ) |
Definition at line 4904 of file qwidget.cpp.
References d, setAttribute(), and Qt::WA_SetLayoutDirection.
Referenced by setLayoutDirection().
void QWidget::unsetLocale | ( | ) |
Definition at line 5943 of file qwidget.cpp.
References d, setAttribute(), and Qt::WA_SetLocale.
|
slot |
Updates the widget unless updates are disabled or the widget is hidden.
This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.
Calling update() several times normally results in just one paintEvent() call.
Qt normally erases the widget's area before the paintEvent() call. If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is responsible for painting all its pixels with an opaque color.
Definition at line 11135 of file qwidget.cpp.
References rect, and update().
Referenced by QMenu::actionEvent(), QMenuBar::actionEvent(), QMainWindowLayout::animationFinished(), MyClass::areaEntered(), MyClass::areaExited(), changeEvent(), QLineEdit::changeEvent(), QDockWidget::changeEvent(), QToolButton::enterEvent(), QDockWidgetTitleButton::enterEvent(), QSplitterHandle::event(), QStatusBar::event(), QTabBar::event(), event(), QDockWidget::event(), QGroupBox::event(), QMdiSubWindow::event(), QScrollBar::event(), QAlphaWidget::eventFilter(), QMdiSubWindow::eventFilter(), QLineEdit::focusInEvent(), QComboBox::focusInEvent(), focusInEvent(), QComboBox::focusOutEvent(), focusOutEvent(), QComboBoxPrivateContainer::hideEvent(), QStatusBar::hideOrShow(), QMainWindowLayout::hover(), QDateTimeEdit::keyPressEvent(), QToolButton::leaveEvent(), QDockWidgetTitleButton::leaveEvent(), QMdi::ControllerWidget::leaveEvent(), QMdiSubWindow::leaveEvent(), QCheckBox::mouseMoveEvent(), QPushButton::mouseMoveEvent(), QRadioButton::mouseMoveEvent(), QScrollBar::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QGroupBox::mouseMoveEvent(), QMdi::ControllerWidget::mouseMoveEvent(), QMdiSubWindow::mouseMoveEvent(), QMenu::mousePressEvent(), QSplitterHandle::mousePressEvent(), QSlider::mousePressEvent(), QGroupBox::mousePressEvent(), QMdi::ControllerWidget::mousePressEvent(), QMdiSubWindow::mousePressEvent(), QSplitterHandle::mouseReleaseEvent(), QTabBar::mouseReleaseEvent(), QSlider::mouseReleaseEvent(), QGroupBox::mouseReleaseEvent(), QMdi::ControllerWidget::mouseReleaseEvent(), QMdiSubWindow::mouseReleaseEvent(), QTabBar::moveTab(), QMenuBarPrivate::popupAction(), QStatusBar::reformat(), QTabBar::removeTab(), QProgressBar::resetFormat(), QSystemTrayIconSys::resizeEvent(), QAbstractSpinBox::resizeEvent(), QIconModeViewBase::scrollContentsBy(), QGroupBox::setAlignment(), QLineEdit::setAlignment(), QToolButton::setArrowType(), QPushButton::setAutoDefault(), setAutoFillBackground(), QToolButton::setAutoRaise(), QAbstractSpinBox::setButtonSymbols(), QDateTimeEdit::setCalendarPopup(), QGroupBox::setCheckable(), QGroupBox::setChecked(), QtPrivate::QColorPicker::setCrossVisible(), QMenuPrivate::setCurrentAction(), QTabBar::setCurrentIndex(), QPushButton::setDefault(), QCommandLinkButton::setDescription(), QLCDNumber::setDigitCount(), QTabBar::setDrawBase(), QLineEdit::setEchoMode(), QDockWidget::setFeatures(), QGroupBox::setFlat(), QPushButton::setFlat(), QProgressBar::setFormat(), QAbstractSpinBox::setFrame(), QLineEdit::setFrame(), QFrame::setFrameStyle(), QAbstractButton::setIcon(), QAbstractButton::setIconSize(), QTabBar::setIconSize(), QProgressBar::setInvertedAppearance(), QAbstractSlider::setInvertedAppearance(), QMenuBarPrivate::setKeyboardMode(), QComboBox::setLineEdit(), setMask(), QDial::setNotchesVisible(), QDial::setNotchTarget(), QToolBarSeparator::setOrientation(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QPagePreview::setPageLayout(), QPagePreview::setPagePreviewLayout(), QMovableTabWidget::setPixmap(), QLineEdit::setPlaceholderText(), QComboBox::setPlaceholderText(), QProgressBar::setRange(), QAbstractSpinBox::setReadOnly(), QLineEdit::setReadOnly(), QComboBox::setRootModelIndex(), QLabel::setScaledContents(), QLCDNumber::setSegmentStyle(), QToolBoxButton::setSelected(), QMenu::setSeparatorsCollapsible(), QAbstractSlider::setSliderPosition(), QLCDNumber::setSmallDecimalPoint(), QApplication::setStyle(), QTabBar::setTabButton(), QTabBar::setTabEnabled(), QTabBar::setTabIcon(), QTabBar::setTabsClosable(), QTabBar::setTabTextColor(), QTabBar::setTabVisible(), QAbstractButton::setText(), QProgressBar::setTextDirection(), QLineEdit::setTextMargins(), QSlider::setTickInterval(), QSlider::setTickPosition(), QGroupBox::setTitle(), QToolButton::setToolButtonStyle(), QDockWidgetLayout::setVerticalTitleBar(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QDial::setWrapping(), QQuickWidget::showEvent(), QComboBoxPrivateContainer::showEvent(), QComboBox::showPopup(), QAbstractSlider::sliderChange(), QComboBoxPrivateContainer::timerEvent(), update(), updateAllWidgets(), QtPrivate::QWellArray::updateCell(), QSystemTrayIconSys::updateIcon(), and QToolBoxPrivate::updateTabs().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version updates a rectangle rect inside the widget.
Definition at line 11152 of file qwidget.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version repaints a region rgn inside the widget.
Definition at line 11163 of file qwidget.cpp.
References d.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version updates a rectangle (x, y, w, h) inside the widget.
void QWidget::updateGeometry | ( | ) |
Notifies the layout system that this widget has changed and may need to change geometry.
Call this function if the sizeHint() or sizePolicy() have changed.
For explicitly hidden widgets, updateGeometry() is a no-op. The layout system will be notified as soon as the widget is shown.
Definition at line 10526 of file qwidget.cpp.
References d.
Referenced by QLayout::activate(), changeEvent(), QPushButton::event(), QTabBar::resizeEvent(), QGroupBox::setAlignment(), QToolButton::setArrowType(), QPushButton::setAutoDefault(), QAbstractSpinBox::setButtonSymbols(), QGroupBox::setCheckable(), QCommandLinkButton::setDescription(), QGroupBox::setFlat(), QPushButton::setFlat(), QLineEdit::setFrame(), QAbstractSpinBox::setGroupSeparatorShown(), QAbstractButton::setIcon(), QAbstractButton::setIconSize(), QComboBox::setIconSize(), QTabBar::setIconSize(), QComboBox::setMinimumContentsLength(), QMenuBar::setNativeMenuBar(), QCalendarWidget::setNavigationBarVisible(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QComboBox::setPlaceholderText(), QSpinBox::setPrefix(), QDoubleSpinBox::setPrefix(), QComboBox::setSizeAdjustPolicy(), setSizePolicy(), QSpinBox::setSuffix(), QDoubleSpinBox::setSuffix(), QAbstractButton::setText(), QLineEdit::setTextMargins(), QSlider::setTickPosition(), QGroupBox::setTitle(), QToolButton::setToolButtonStyle(), QWizardHeader::setup(), QWizard::setWizardStyle(), QComboBox::showEvent(), and QComboBoxPrivateContainer::timerEvent().
|
protectedslot |
Updates the widget's micro focus and informs input methods that the state specified by query has changed.
Definition at line 11844 of file qwidget.cpp.
References QGuiApplication::focusObject(), QGuiApplication::inputMethod(), and QInputMethod::update().
Referenced by QLineEdit::focusInEvent(), QAbstractSpinBox::setLineEdit(), and QComboBox::setLineEdit().
|
inline |
Definition at line 868 of file qwidget.h.
References Qt::WA_UpdatesDisabled.
QRegion QWidget::visibleRegion | ( | ) | const |
Returns the unobscured region where paint events can occur.
For visible widgets, this is an approximation of the area not covered by other widgets; otherwise, this is an empty region.
The repaint() function calls this function if necessary, so in general you do not need to call it.
Definition at line 8713 of file qwidget.cpp.
References d, and QRect::isEmpty().
QWidget * QWidget::window | ( | ) | const |
Returns the window for this widget, i.e.
the next ancestor widget that has (or could have) a window-system frame.
If the widget is a window, the widget itself is returned.
Typical usage is changing the window title:
Definition at line 4320 of file qwidget.cpp.
References parentWidget().
Referenced by ~QWidget(), activateWindow(), QDialog::adjustPosition(), QApplication::alert(), clearFocus(), QQuickControlsTestUtils::clickButton(), QWidgetTextControlPrivate::contextMenuEvent(), correctWidgetContext(), create(), createWindowContainer(), detachWindow(), QApplicationPrivate::dispatchEnterLeave(), QQuickControlsTestUtils::doubleClickButton(), QMacStyle::drawComplexControl(), QMenu::event(), QOpenGLWidget::event(), QAbstractButton::event(), QLabel::event(), QWindowContainer::event(), event(), QMdiSubWindow::event(), QCalendarWidget::eventFilter(), QPushButton::focusInEvent(), focusNextPrevChild(), QPushButton::focusOutEvent(), grabKeyboard(), QMenuBarPrivate::handleReparent(), QtWaylandClient::QWaylandInputDevice::handleTouchPoint(), hasFocus(), QWidgetPrivate::hideChildren(), QStyleOption::initFrom(), QOpenGLWidgetPrivate::initialize(), isActiveWindow(), QApplicationPrivate::isBlockedByModal(), QQuickWidgetRenderControlPrivate::isRenderWindow(), QQuickStyleItem::itemChange(), QWidgetRepaintManager::markDirty(), metric(), QOpenGLWidget::metric(), QToolBarPrivate::mouseMoveEvent(), QAbstractButtonPrivate::moveFocus(), QWidgetPrivate::moveRect(), QApplication::notify(), QApplicationPrivate::notify_helper(), QToolBar::paintEvent(), QMacStyle::pixelMetric(), QWidgetPrivate::prepareToRender(), q_createNativeChildrenAndSetParent(), qquickitem_autoParent(), QTest::qWaitForWindowActive(), QTest::qWaitForWindowExposed(), releaseKeyboard(), QWidgetPrivate::reparentFocusWidgets(), QWidgetPrivate::safeAreaMargins(), screen(), QWidgetPrivate::scrollRect(), QApplicationPrivate::sendSyntheticEnterLeave(), QApplicationPrivate::setActiveWindow(), QMenuBarPrivate::setCurrentAction(), setFocus(), QMenuBarPrivate::setKeyboardMode(), setParent(), QWidgetPrivate::setParent_sys(), setTabOrder(), QDialogPrivate::setVisible(), QQuickWidget::showEvent(), QComboBox::showPopup(), QQnxScreen::topLevelAt(), QtWaylandClient::QWaylandTouchExtension::touch_extension_touch(), QMenuPrivate::transientParentWindow(), QApplicationPrivate::tryModalHelper(), QToolBarLayout::updateMacBorderMetrics(), QQuickControlsTestUtils::verifyButtonClickable(), QSGThreadedRenderLoop::windowDestroyed(), and QtWaylandClient::QWaylandQtKeyExtension::zqt_key_v1_key().
QString QWidget::windowFilePath | ( | ) | const |
Definition at line 6248 of file qwidget.cpp.
References d.
|
inline |
Window flags are a combination of a type (e.g.
Qt::Dialog) and zero or more hints to the window system (e.g. Qt::FramelessWindowHint).
If the widget had type Qt::Widget or Qt::SubWindow and becomes a window (Qt::Window, Qt::Dialog, etc.), it is put at position (0, 0) on the desktop. If the widget is a window and becomes a Qt::Widget or Qt::SubWindow, it is put at position (0, 0) relative to its parent widget.
Definition at line 803 of file qwidget.h.
Referenced by QRubberBand::changeEvent(), QGraphicsProxyWidgetPrivate::embedSubWindow(), QMdiSubWindow::event(), QRubberBand::initStyleOption(), QMdiSubWindow::mouseDoubleClickEvent(), QSizeGrip::mousePressEvent(), operator<<(), QMdiSubWindow::paintEvent(), QMacStyle::pixelMetric(), QVideoWidget::setFullScreen(), setParent(), QMdiSubWindow::showEvent(), QMdiSubWindow::showShaded(), and QMdiAreaPrivate::windowStaysOnTop().
QWindow * QWidget::windowHandle | ( | ) | const |
If this is a native widget, return the associated QWindow.
Otherwise return null.
Native widgets include toplevel widgets, QGLWidget, and child widgets on which winId() was called.
Definition at line 2490 of file qwidget.cpp.
References d.
Referenced by activateWindow(), QDialog::adjustPosition(), QDockWidget::changeEvent(), QTest::QTouchEventWidgetSequence::commit(), QWidgetTextControlPrivate::contextMenuEvent(), destroy(), QMacStyle::drawComplexControl(), QMenu::event(), QOpenGLWidget::event(), QWindowContainer::event(), event(), QTipLabel::eventFilter(), QMenuBar::eventFilter(), QSplashScreen::finish(), focusNextPrevChild(), QMenuBarPrivate::handleReparent(), hasPlatformWindow(), QOpenGLWidgetPrivate::initialize(), isActiveWindow(), QApplicationPrivate::isBlockedByModal(), QQuickWidgetRenderControlPrivate::isRenderWindow(), metric(), QSizeGrip::mousePressEvent(), QApplicationPrivate::notifyActiveWindowChange(), QWindowContainer::parentWasChanged(), q_createNativeChildrenAndSetParent(), QWidgetPrivate::safeAreaMargins(), QWidgetPrivate::setConstraints_sys(), QWidgetPrivate::setGeometry_sys(), setParent(), QWidgetPrivate::setParent_sys(), setWindowRole(), setWindowState(), QWidgetPlatformDialog::show(), QWidgetPrivate::showChildren(), QQuickWidget::showEvent(), QWidgetPlatformMenu::showPopup(), QToolBarLayout::updateMacBorderMetrics(), QApplicationPrivate::windowForWidget(), and QApplicationPrivate::windowNeverBlocked().
QIcon QWidget::windowIcon | ( | ) | const |
Definition at line 6139 of file qwidget.cpp.
References d, and QGuiApplication::windowIcon.
This signal is emitted when the window's icon has changed, with the new icon as an argument.
Referenced by setWindowIcon().
QString QWidget::windowIconText | ( | ) | const |
Definition at line 6218 of file qwidget.cpp.
References d.
This signal is emitted when the window's icon text has changed, with the new iconText as an argument.
This signal is deprecated.
Referenced by setWindowIconText().
Qt::WindowModality QWidget::windowModality | ( | ) | const |
Definition at line 2801 of file qwidget.cpp.
qreal QWidget::windowOpacity | ( | ) | const |
Definition at line 11480 of file qwidget.cpp.
References d, and isWindow().
QString QWidget::windowRole | ( | ) | const |
Returns the window's role, or an empty string.
Definition at line 6298 of file qwidget.cpp.
References d.
Qt::WindowStates QWidget::windowState | ( | ) | const |
Returns the current window state.
The window state is a OR'ed combination of Qt::WindowState: Qt::WindowMinimized, Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
Definition at line 2895 of file qwidget.cpp.
Referenced by QSizeGripPrivate::_q_showIfNotHidden(), QApplication::alert(), QMdiSubWindow::changeEvent(), QMdiSubWindowPrivate::ensureWindowState(), QQuickWidget::event(), QVideoWidget::event(), QWidgetWindow::handleWindowStateChangedEvent(), operator<<(), restoreGeometry(), saveGeometry(), QMdiSubWindowPrivate::setActive(), setWindowState(), QDialog::showEvent(), showFullScreen(), showMaximized(), showMinimized(), and showNormal().
QString QWidget::windowTitle | ( | ) | const |
Definition at line 5973 of file qwidget.cpp.
References d, and QFileInfo::fileName().
This signal is emitted when the window's title has changed, with the new title as an argument.
Referenced by setWindowTitle().
|
inline |
Returns the window type of this widget.
This is identical to windowFlags() & Qt::WindowType_Mask.
Definition at line 801 of file qwidget.h.
References toInt(), and Qt::WindowType_Mask.
Referenced by changeEvent(), correctWidgetContext(), create(), QApplicationPrivate::desktop(), destroy(), QCoreGraphicsPaintEngine::end(), event(), focusNextPrevChild(), QApplicationPrivate::focusNextPrevChild_helper(), frameGeometry(), frameSize(), QWidgetWindow::handleMouseEvent(), isActiveWindow(), keyPressEvent(), mousePressEvent(), operator<<(), QMacStyle::pixelMetric(), QWindowsVistaStylePrivate::pixelMetricFromSystemDp(), pos(), QMdiAreaPrivate::resizeToMinimumTileSize(), setAttribute(), QWidgetPrivate::setParent_sys(), QGraphicsItemPrivate::setVisibleHelper(), QFocusFrame::setWidget(), x(), and y().
WId QWidget::winId | ( | ) | const |
Returns the window system identifier of the widget.
Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle.
This value may change at run-time. An event with type QEvent::WinIdChange will be sent to the widget following a change in window system identifier.
Definition at line 2364 of file qwidget.cpp.
References createWinId(), internalWinId(), setAttribute(), testAttribute(), Qt::WA_NativeWindow, and Qt::WA_WState_Created.
Referenced by QWidgetPrivate::create(), event(), q_createNativeChildrenAndSetParent(), QXcbSystemTrayBackingStore::recreateImage(), and QWindowContainerPrivate::updateUsesNativeWidgets().
int QWidget::x | ( | ) | const |
Definition at line 3501 of file qwidget.cpp.
References d, isWindow(), Qt::Popup, and windowType().
int QWidget::y | ( | ) | const |
Definition at line 3521 of file qwidget.cpp.
References d, isWindow(), Qt::Popup, and windowType().
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 749 of file qwidget.h.
Referenced by QDockWidget::paintEvent().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 748 of file qwidget.h.
Referenced by grab(), QtPrivate::QColorLuminancePicker::paintEvent(), QLabel::pixmap(), and QWizardHeader::setup().
|
friend |
|
friend |
Definition at line 760 of file qwidget.h.
Referenced by setStyle(), and setStyleSheet().
|
friend |
Definition at line 12344 of file qwidget.cpp.
|
friend |
Definition at line 12349 of file qwidget.cpp.
Referenced by QFocusFrame::paintEvent(), QMdiSubWindow::paintEvent(), screen(), QComboBox::setLineEdit(), and QComboBox::showPopup().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
related |
\macro QWIDGETSIZE_MAX
Defines the maximum size for a QWidget object.
The largest allowed size for a widget is QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX), i.e. QSize (16777215,16777215).
Sets up the user interface for the specified widget.
|
readwrite |
whether drop events are enabled for this widget
Setting this property to true announces to the system that this widget may be able to accept drop events.
If the widget is the desktop (windowType() == Qt::Desktop), this may fail if another application is using the desktop; you can call acceptDrops() to test if this occurs.
By default, this property is false
.
|
readwrite |
whether the widget background is filled automatically
If enabled, this property will cause Qt to fill the background of the widget before invoking the paint event. The color used is defined by the QPalette::Window color role from the widget's \l{QPalette}{palette}.
In addition, Windows are always filled with QPalette::Window, unless the WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.
This property cannot be turned off (i.e., set to false) if a widget's parent has a static gradient for its background.
By default, this property is false
.
Definition at line 93 of file qwidget.h.
Referenced by QMdiSubWindow::paintEvent().
|
readwrite |
the base size of the widget
The base size is used to calculate a proper widget size if the widget defines sizeIncrement().
By default, for a newly-created widget, this property contains a size with zero width and height.
|
read |
the bounding rectangle of the widget's children
Hidden children are excluded.
By default, for a widget with no children, this property contains a rectangle with zero width and height located at the origin.
|
read |
the combined region occupied by the widget's children
Hidden children are excluded.
By default, for a widget with no children, this property contains an empty region.
|
readwrite |
how the widget shows a context menu
The default value of this property is Qt::DefaultContextMenu, which means the contextMenuEvent() handler is called. Other values are Qt::NoContextMenu, Qt::PreventContextMenu, Qt::ActionsContextMenu, and Qt::CustomContextMenu. With Qt::CustomContextMenu, the signal customContextMenuRequested() is emitted.
|
readwrite |
the cursor shape for this widget
The mouse cursor will assume this shape when it's over this widget. See the \l{Qt::CursorShape}{list of predefined cursor objects} for a range of useful shapes.
An editor widget might use an I-beam cursor:
If no cursor has been set, or after a call to unsetCursor(), the parent's cursor is used.
By default, this property contains a cursor with the Qt::ArrowCursor shape.
Some underlying window implementations will reset the cursor if it leaves a widget even if the mouse is grabbed. If you want to have a cursor set for all widgets, even when outside the window, consider QGuiApplication::setOverrideCursor().
Definition at line 93 of file qwidget.h.
Referenced by MainWindow::copySelection(), cursor(), MainWindow::cutSelection(), QApplicationPrivate::dispatchEnterLeave(), QWidgetResizeHandler::doResize(), QSplashScreen::drawContents(), QLabel::focusOutEvent(), grabMouse(), MainWindow::highlightListItems(), MainWindow::insertCalendar(), MainWindow::insertList(), QWidgetResizeHandler::keyPressEvent(), QMdiSubWindow::keyPressEvent(), QLineEdit::mousePressEvent(), MainWindow::pasteSelection(), QTipLabel::placeTip(), MainWindow::selectBlock(), MainWindow::selectFrame(), MainWindow::selectLine(), MainWindow::selectWord(), setCursor(), QLabel::setSelection(), QGraphicsProxyWidgetPrivate::setWidget_helper(), MainWindow::showList(), MainWindow::showTable(), and MainWindow::updateMenus().
|
readwrite |
whether the widget is enabled
In general an enabled widget handles keyboard and mouse events; a disabled widget does not. An exception is made with \l{QAbstractButton}.
Some widgets display themselves differently when they are disabled. For example a button might draw its label grayed out. If your widget needs to know when it becomes enabled or disabled, you can use the changeEvent() with type QEvent::EnabledChange.
Disabling a widget implicitly disables all its children. Enabling respectively enables all child widgets unless they have been explicitly disabled. It it not possible to explicitly enable a child widget which is not a window while its parent widget remains disabled.
By default, this property is true
.
Definition at line 93 of file qwidget.h.
Referenced by setAutoFillBackground(), QTabBar::setDocumentMode(), QTabBar::setExpanding(), QDialog::setSizeGripEnabled(), and QTabBar::setTabEnabled().
|
read |
whether this widget (or its focus proxy) has the keyboard input focus
By default, this property is false
.
|
readwrite |
the way the widget accepts keyboard focus
The policy is Qt::TabFocus if the widget accepts keyboard focus by tabbing, Qt::ClickFocus if the widget accepts focus by clicking, Qt::StrongFocus if it accepts both, and Qt::NoFocus (the default) if it does not accept focus at all.
You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the QLineEdit constructor calls setFocusPolicy(Qt::StrongFocus).
If the widget has a focus proxy, then the focus policy will be propagated to it.
Definition at line 93 of file qwidget.h.
Referenced by QAbstractButton::animateClick(), QAbstractButton::event(), focusInEvent(), QGroupBox::focusInEvent(), QGraphicsScene::focusNextPrevChild(), QApplicationPrivate::focusNextPrevChild_helper(), focusOutEvent(), iWantTheFocus(), QAbstractButtonPrivate::moveFocus(), QMdiSubWindowPrivate::restoreFocus(), QMenuPrivate::setCurrentAction(), QMdiSubWindowPrivate::setFocusWidget(), setTabOrder(), and QDialogPrivate::setVisible().
|
readwrite |
the font currently set for the widget
This property describes the widget's requested font. The font is used by the widget's style when rendering standard components, and is available as a means to ensure that custom widgets can maintain consistency with the native platform's look and feel. It's common that different platforms, or different styles, define different fonts for an application.
When you assign a new font to a widget, the properties from this font are combined with the widget's default font to form the widget's final font. You can call fontInfo() to get a copy of the widget's final font. The final font is also used to initialize QPainter's font.
The default depends on the system environment. QApplication maintains a system/theme font which serves as a default for all widgets. There may also be special font defaults for certain types of widgets. You can also define default fonts for widgets yourself by passing a custom font and the name of a widget to QApplication::setFont(). Finally, the font is matched against Qt's font database to find the best match.
QWidget propagates explicit font properties from parent to child. If you change a specific property on a font and assign that font to a widget, that property will propagate to all the widget's children, overriding any system defaults for that property. Note that fonts by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.
QWidget's font propagation is similar to its palette propagation.
The current style, which is used to render the content of all standard Qt widgets, is free to choose to use the widget font, or in some cases, to ignore it (partially, or completely). In particular, certain styles like GTK style, Mac style, and Windows Vista style, apply special modifications to the widget font to match the platform's native look and feel. Because of this, assigning properties to a widget's font is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a \l styleSheet.
Definition at line 93 of file qwidget.h.
Referenced by QFontComboBox::QFontComboBox(), QWizardHeader::QWizardHeader(), QLabel::changeEvent(), QLineEdit::changeEvent(), QComboBox::changeEvent(), QMessageBox::changeEvent(), QMdiSubWindow::event(), initPainter(), QToolButton::initStyleOption(), QComboBoxListView::initViewItemOption(), QLineEdit::inputMethodQuery(), inputMethodQuery(), QPagePreview::paintEvent(), QDockWidget::paintEvent(), QWindowsVistaStyle::polish(), qt_aqua_get_known_size(), QFontComboBox::setCurrentFont(), QFontDialog::setCurrentFont(), QFontComboBox::setDisplayFont(), setFont(), QFontComboBox::sizeHint(), QLineEdit::sizeHint(), QWindowsVistaStyle::unpolish(), QFontDialogPrivate::updateSampleFont(), QTipLabel::updateSize(), and src_gui_painting_qpainter2::MyWidget::wrapper15().
|
read |
geometry of the widget relative to its parent including any window frame
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and screen geometry.
Definition at line 93 of file qwidget.h.
Referenced by QSizeGrip::mousePressEvent(), QDockWidgetPrivate::nonClientAreaMouseEvent(), operator<<(), and saveGeometry().
|
read |
|
read |
whether the widget is shown in full screen mode
A widget in full screen mode occupies the whole screen area and does not display window decorations, such as a title bar.
By default, this property is false
.
Definition at line 93 of file qwidget.h.
Referenced by restoreGeometry().
|
readwrite |
the geometry of the widget relative to its parent and excluding the window frame
When changing the geometry, the widget, if visible, receives a move event (moveEvent()) and/or a resize event (resizeEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive appropriate events before it is shown.
The size component is adjusted if it lies outside the range defined by minimumSize() and maximumSize().
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and screen geometry.
Definition at line 93 of file qwidget.h.
Referenced by QDialog::adjustPosition(), QWidgetAnimator::animate(), QMdiSubWindow::changeEvent(), childWindowAt(), QApplicationPrivate::closePopup(), QWidgetWindowPrivate::closestAcceptableGeometry(), destroy(), dockedGeometry(), droprectangle::Window::dragMoveEvent(), QWindowsVistaStyle::drawPrimitive(), QDockWidget::event(), QAlphaWidget::eventFilter(), QMdiSubWindow::eventFilter(), QPixmapStyle::eventFilter(), fixToolBarOrientation(), QWidgetItem::geometry(), QColorDialogPrivate::handleColorPickingMouseMove(), QWidgetWindow::handleMouseEvent(), QMdiSubWindow::keyPressEvent(), QWidgetResizeHandler::mouseMoveEvent(), QSizeGrip::mousePressEvent(), MainWindow::mousePressEvent(), QMdiSubWindow::mousePressEvent(), QMdiSubWindow::mouseReleaseEvent(), move(), QDockWidgetPrivate::nonClientAreaMouseEvent(), normalGeometry(), operator<<(), operator<<(), QSystemTrayIconSys::paintEvent(), QMenuPrivate::popup(), QMenuSloppyState::processMouseEvent(), QSplitter::replaceWidget(), resize(), QRubberBand::resize(), restoreGeometry(), QAlphaWidget::run(), QRollEffect::run(), saveGeometry(), QToolBarAreaLayout::saveState(), QEvdevTouchScreenData::screenGeometry(), QSplashScreen::setPixmap(), QStackedLayout::setStackingMode(), QBoxLayoutPrivate::setupGeom(), setWindowState(), QWizard::setWizardStyle(), QMdiSubWindow::showShaded(), spacingHelper(), QQnxScreen::topLevelAt(), QMainWindowLayout::unplug(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QMdiAreaPrivate::updateScrollBars(), and QtWaylandClient::QWaylandQtSurface::zqt_shell_surface_v1_set_frame_margins().
|
read |
the height of the widget excluding any window frame
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and \l{QScreen::geometry}{screen geometry}.
Definition at line 93 of file qwidget.h.
Referenced by QRollEffect::QRollEffect(), QPrintDialogPrivate::_q_collapseOrExpandDialog(), QCalendarWidgetPrivate::_q_yearClicked(), allocHWFrame(), QWidgetAnimator::animate(), QMacStylePrivate::aquaSizeConstrain(), bufferDataSize(), bufferDataSize(), bufferDataSize(), bufferDataSize(), bufferDataSize(), QQuickControlsTestUtils::clickButton(), QLayout::closestAcceptableSize(), QSizeGripPrivate::corner(), QWidgetResizeHandler::doResize(), QQuickControlsTestUtils::doubleClickButton(), QMainWindowLayoutState::fits(), frameSize(), QDockAreaLayout::gapRect(), QCommandLinkButton::heightForWidth(), QMenuBar::heightForWidth(), QTabWidget::initStyleOption(), inputMethodQuery(), QMenu::keyPressEvent(), mapData(), mapData(), mapData(), mapData(), mapData(), QOpenGLWidget::metric(), minimumHeightForWidth(), QDialog::minimumSizeHint(), QCommandLinkButton::minimumSizeHint(), QProgressBar::minimumSizeHint(), QTabBar::minimumSizeHint(), QWidgetResizeHandler::mouseMoveEvent(), QSizeGrip::mousePressEvent(), move(), QRubberBand::move(), QColumnViewGrip::moveGrip(), QDial::notchSize(), QPagePreview::paintEvent(), QtPrivate::QColorLuminancePicker::paintEvent(), QMenu::paintEvent(), QMenuBar::paintEvent(), plaintextlayout::Window::paintEvent(), QWizardHeader::paintEvent(), QWizard::paintEvent(), SplitterHandle::paintEvent(), QTipLabel::placeTip(), Q_LOGGING_CATEGORY(), QMdi::IconTiler::rearrange(), QQuickMenuPositioner::reposition(), QtPrivate::QColorPicker::resizeEvent(), QOpenGLWidget::resizeEvent(), QColumnViewPreviewColumn::resizeEvent(), QMdiSubWindow::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), QWhatsThisPrivate::say(), setFixedWidth(), setMaximumSize(), setMaximumWidth(), setMinimumSize(), setMinimumWidth(), QComboBox::showPopup(), QCompleterPrivate::showPopup(), QDialog::sizeHint(), QMenuBarPrivate::updateGeometries(), QFocusFramePrivate::updateSize(), QScrollAreaPrivate::updateWidgetPosition(), QQuickControlsTestUtils::verifyButtonClickable(), and doc_src_coordsys::SnippetWrappers::wrapper4().
|
readwrite |
What input method specific hints the widget has.
This is only relevant for input widgets. It is used by the input method to retrieve hints as to how the input method should operate. For example, if the Qt::ImhFormattedNumbersOnly flag is set, the input method may change its visual components to reflect that only numbers can be entered.
{w->setInputMethodHints(w->inputMethodHints()|f)} instead of
{w->setInputMethodHints(f)}.The default value is Qt::ImhNone.
Definition at line 93 of file qwidget.h.
Referenced by QInputDialog::getItem(), QInputDialog::getMultiLineText(), QInputDialog::getText(), inputMethodQuery(), QAbstractSpinBox::inputMethodQuery(), QWidgetLineControl::processKeyEvent(), QLineEdit::setEchoMode(), and QGraphicsViewPrivate::updateInputMethodSensitivity().
|
read |
whether this widget's window is the active window
The active window is the window that contains the widget that has keyboard focus (The window may still have focus if it has no widgets or none of its widgets accepts keyboard focus).
When popup windows are visible, this property is true
for both the active window and for the popup.
By default, this property is false
.
Definition at line 93 of file qwidget.h.
Referenced by QApplication::alert(), QAbstractSpinBox::changeEvent(), QWindowsVistaStyle::drawComplexControl(), isActiveWindow(), and palette().
|
readwrite |
the layout direction for this widget.
By default, this property is set to Qt::LeftToRight.
When the layout direction is set on a widget, it will propagate to the widget's children, but not to a child that is a window and not to a child for which setLayoutDirection() has been explicitly called. Also, child widgets added after setLayoutDirection() has been called for the parent do not inherit the parent's layout direction.
Definition at line 93 of file qwidget.h.
Referenced by QToolBarAreaLayout::apply(), QFormLayoutPrivate::arrangeWidgets(), QSplashScreen::drawContents(), QBoxLayoutPrivate::effectiveMargins(), QSplashScreen::event(), QWizard::event(), fixToolBarOrientation(), QToolBarAreaLayout::gapIndex(), QStyleOption::initFrom(), QToolBarAreaLayout::itemRect(), QLineEdit::mouseMoveEvent(), QLabel::paintEvent(), QMenuSloppyState::processMouseEvent(), QMdi::RegularTiler::rearrange(), QMdi::SimpleCascader::rearrange(), QMdi::IconTiler::rearrange(), QWidgetItem::setGeometry(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QCompleterPrivate::showPopup(), QCommonStyle::subElementRect(), and QTabBar::tabRect().
|
readwrite |
the widget's locale
As long as no special locale has been set, this is either the parent's locale or (if this widget is a top level widget), the default locale.
If the widget displays dates or numbers, these should be formatted using the widget's locale.
Definition at line 93 of file qwidget.h.
Referenced by QCalendarWidget::event(), QSpinBox::fixup(), QDoubleSpinBox::fixup(), QCalendarWidget::minimumSizeHint(), setLocale(), QProgressBar::text(), QDateTimeEdit::textFromDateTime(), QDoubleSpinBox::textFromValue(), and QSpinBox::textFromValue().
|
read |
whether this widget is maximized
This property is only relevant for windows.
By default, this property is false
.
Definition at line 93 of file qwidget.h.
Referenced by restoreGeometry(), and setMinimumSize().
|
readwrite |
the widget's maximum height in pixels
This property corresponds to the height held by the \l maximumSize property.
By default, this property contains a value of 16777215.
QWIDGETSIZE_MAX
macro limits the maximum size of widgets.Definition at line 93 of file qwidget.h.
Referenced by QWidgetItem::heightForWidth(), and QWidgetItem::minimumHeightForWidth().
|
readwrite |
the widget's maximum size in pixels
The widget cannot be resized to a larger size than the maximum widget size.
By default, this property contains a size in which both width and height have values of 16777215.
QWIDGETSIZE_MAX
macro limits the maximum size of widgets.Definition at line 93 of file qwidget.h.
Referenced by fixToolBarOrientation(), QTableViewPrivate::heightHintForIndex(), QDockWidgetLayout::maximumSize(), menuBarHeightForWidth(), QWidgetResizeHandler::mouseMoveEvent(), QToolBarAreaLayoutItem::realSizeHint(), resize(), setFixedHeight(), setFixedWidth(), setGeometry(), setMaximumHeight(), setMaximumWidth(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QComboBox::showPopup(), QWidgetItem::sizeHint(), QTableViewPrivate::widthHintForIndex(), and QTreeViewPrivate::widthHintForIndex().
|
readwrite |
the widget's maximum width in pixels
This property corresponds to the width held by the \l maximumSize property.
By default, this property contains a value of 16777215.
QWIDGETSIZE_MAX
macro limits the maximum size of widgets.Definition at line 93 of file qwidget.h.
Referenced by QWizardPrivate::updateMinMaxSizes().
|
read |
whether this widget is minimized (iconified)
This property is only relevant for windows.
By default, this property is false
.
|
readwrite |
the widget's minimum height in pixels
This property corresponds to the height held by the \l minimumSize property.
By default, this property has a value of 0.
Definition at line 93 of file qwidget.h.
Referenced by QWidgetItem::heightForWidth(), QWidgetItem::minimumHeightForWidth(), and QCommandLinkButton::minimumSizeHint().
|
readwrite |
the widget's minimum size
The widget cannot be resized to a smaller size than the minimum widget size. The widget's size is forced to the minimum size if the current size is smaller.
The minimum size set by this function will override the minimum size defined by QLayout. In order to unset the minimum size, use a value of {QSize(0, 0)}.
By default, this property contains a size with zero width and height.
Definition at line 93 of file qwidget.h.
Referenced by QLayout::activate(), fixToolBarOrientation(), QTableViewPrivate::heightHintForIndex(), QWidgetResizeHandler::mouseMoveEvent(), QToolBarAreaLayoutItem::realSizeHint(), resize(), setFixedHeight(), setFixedWidth(), setGeometry(), QWidgetItem::setGeometry(), setMinimumHeight(), setMinimumWidth(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QComboBox::showPopup(), QMdiSubWindow::showShaded(), QWidgetItem::sizeHint(), QTableViewPrivate::widthHintForIndex(), and QTreeViewPrivate::widthHintForIndex().
|
read |
the recommended minimum size for the widget
If the value of this property is an invalid size, no minimum size is recommended.
The default implementation of minimumSizeHint() returns an invalid size if there is no layout for this widget, and returns the layout's minimum size otherwise. Most built-in widgets reimplement minimumSizeHint().
\l QLayout will never resize a widget to a size smaller than the minimum size hint unless minimumSize() is set or the size policy is set to QSizePolicy::Ignore. If minimumSize() is set, the minimum size hint will be ignored.
Definition at line 93 of file qwidget.h.
Referenced by QDialog::minimumSizeHint(), QWatermarkLabel::minimumSizeHint(), QGroupBox::minimumSizeHint(), QToolBarAreaLayoutItem::realSizeHint(), and QWidgetItem::sizeHint().
|
readwrite |
the widget's minimum width in pixels
This property corresponds to the width held by the \l minimumSize property.
By default, this property has a value of 0.
Definition at line 93 of file qwidget.h.
Referenced by menuBarHeightForWidth(), QColumnViewGrip::moveGrip(), QColumnViewPreviewColumn::resizeEvent(), and QColumnViewPreviewColumn::setPreviewWidget().
|
read |
whether the widget is a modal widget
This property only makes sense for windows. A modal widget prevents widgets in all other windows from getting any input.
By default, this property is false
.
|
readwrite |
whether mouse tracking is enabled for the widget
If mouse tracking is disabled (the default), the widget only receives mouse move events when at least one mouse button is pressed while the mouse is being moved.
If mouse tracking is enabled, the widget receives mouse move events even if no buttons are pressed.
|
read |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget
If the widget is already in this state the normal geometry will reflect the widget's current geometry().
For child widgets this property always holds an empty rectangle.
By default, this property contains an empty rectangle.
Definition at line 93 of file qwidget.h.
Referenced by saveGeometry().
|
readwrite |
the widget's palette
This property describes the widget's palette. The palette is used by the widget's style when rendering standard components, and is available as a means to ensure that custom widgets can maintain consistency with the native platform's look and feel. It's common that different platforms, or different styles, have different palettes.
When you assign a new palette to a widget, the color roles from this palette are combined with the widget's default palette to form the widget's final palette. The palette entry for the widget's background role is used to fill the widget's background (see QWidget::autoFillBackground), and the foreground role initializes QPainter's pen.
The default depends on the system environment. QApplication maintains a system/theme palette which serves as a default for all widgets. There may also be special palette defaults for certain types of widgets (e.g., on Windows Vista, all classes that derive from QMenuBar have a special default palette). You can also define default palettes for widgets yourself by passing a custom palette and the name of a widget to QApplication::setPalette(). Finally, the style always has the option of polishing the palette as it's assigned (see QStyle::polish()).
QWidget propagates explicit palette roles from parent to child. If you assign a brush or color to a specific role on a palette and assign that palette to a widget, that role will propagate to all the widget's children, overriding any system defaults for that role. Note that palettes by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.
QWidget's palette propagation is similar to its font propagation.
The current style, which is used to render the content of all standard Qt widgets, is free to choose colors and brushes from the widget palette, or in some cases, to ignore the palette (partially, or completely). In particular, certain styles like GTK style, Mac style, and Windows Vista style, depend on third party APIs to render the content of widgets, and these styles typically do not follow the palette. Because of this, assigning roles to a widget's palette is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a \l {styleSheet}.
Definition at line 93 of file qwidget.h.
Referenced by ScreenWidget::ScreenWidget(), QStyleHelper::backgroundColor(), QLabel::changeEvent(), QLineEdit::changeEvent(), QQC2::QCommonStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QAndroidStyle::drawComplexControl(), QAndroidStyle::AndroidControl::drawControl(), QQC2::QCommonStyle::drawControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QQC2::QCommonStyle::drawPrimitive(), QQC2::QWindowsStyle::drawPrimitive(), QAndroidStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), event(), QWidgetTextControl::getPaintContext(), QStyleOption::initFrom(), initPainter(), QMenuBar::initStyleOption(), QMenuBar::minimumSizeHint(), QTabWidget::minimumSizeHint(), QtPrivate::QWellArray::paintCell(), QPagePreview::paintEvent(), QtPrivate::QColorLuminancePicker::paintEvent(), QFileDialogComboBox::paintEvent(), QWhatsThat::paintEvent(), QCommandLinkButton::paintEvent(), QLineEdit::paintEvent(), QMenu::paintEvent(), QMenuBar::paintEvent(), QSplitterHandle::paintEvent(), QStatusBar::paintEvent(), QtPrivate::QCalToolButton::paintEvent(), QComboBox::paintEvent(), QWizardHeader::paintEvent(), MyWidget::paintEvent(), QToolBar::paintEvent(), MyWidget::paintEvent2(), QWindowsVistaStyle::polish(), QPixmapStyle::polish(), QWizardPrivate::recreateLayout(), ScreenWidget::setColor(), QComboBox::setEditable(), setPalette(), QMenuBar::sizeHint(), QToolBoxPrivate::updateTabs(), and QComboBoxPrivate::updateViewContainerPaletteAndOpacity().
|
readwrite |
the position of the widget within its parent widget
If the widget is a window, the position is that of the widget on the desktop, including its frame.
When changing the position, the widget, if visible, receives a move event (moveEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive an event before it is shown.
By default, this property contains a position that refers to the origin.
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
QPoint(0, 0)
.Definition at line 93 of file qwidget.h.
Referenced by QTipLabel::QTipLabel(), QSplitterHandle::closestLegalPosition(), QSplitter::closestLegalPosition(), QLineEdit::cursorPositionAt(), QDateTimeEdit::dateTimeFromText(), QFFmpeg::Renderer::doNextStep(), src_gui_image_qicon::MyWidget::drawIcon(), QTabBar::event(), event(), QToolBar::event(), QMenu::exec(), QMenu::exec(), QTipLabel::getTipScreen(), QRadioButton::hitButton(), QAbstractButton::hitButton(), QCheckBox::hitButton(), QPushButton::hitButton(), QToolButton::hitButton(), QToolButton::initStyleOption(), insertAction(), QMainWindow::isSeparator(), QDateTimeEdit::keyPressEvent(), QMdiSubWindow::keyPressEvent(), mapFrom(), mapFrom(), mapFromGlobal(), mapFromGlobal(), mapFromParent(), mapFromParent(), mapTo(), mapTo(), mapToGlobal(), mapToGlobal(), mapToParent(), mapToParent(), QGraphicsProxyWidgetPrivate::mapToReceiver(), QTabBar::mouseDoubleClickEvent(), QSplitterHandle::mouseMoveEvent(), QTipLabel::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QtPrivate::QWellArray::mousePressEvent(), QTabBar::mousePressEvent(), QSplitterHandle::mouseReleaseEvent(), QSplitterHandle::moveSplitter(), QSplitter::moveSplitter(), QTipLabel::placeTip(), QMenuPrivate::popup(), MainWindow::readSettings(), QTipLabel::reuseTip(), QLineEdit::setCursorPosition(), QVideoWidget::setFullScreen(), QSplitter::setRubberBand(), QTabWidget::setTabPosition(), QBalloonTip::showBalloon(), QMenu::showTearOffMenu(), QTipLabel::tipChanged(), QBalloonTip::updateBalloonPosition(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QTipLabel::updateSize(), QDateTimeEdit::validate(), QSpinBox::validate(), QDoubleSpinBox::validate(), QSpinBox::valueFromText(), QDoubleSpinBox::valueFromText(), src_gui_util_qvalidator::Wrapper::wrapper0(), src_gui_util_qvalidator::Wrapper::wrapper1(), src_gui_util_qvalidator::Wrapper::wrapper2(), and MainWindow::writeSettings().
|
read |
the internal geometry of the widget excluding any window frame
The rect property equals QRect(0, 0, width(), height()).
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and screen geometry.
Definition at line 93 of file qwidget.h.
Referenced by QMenuPrivate::actionAt(), contentsRect(), QDialog::contextMenuEvent(), QLayoutPrivate::doResize(), QWidgetResizeHandler::doResize(), QPixmapStyle::drawCheckBox(), QQC2_NAMESPACE::QMacStyle::drawComplexControl(), QQC2::QCommonStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QAndroidStyle::drawComplexControl(), QSplashScreen::drawContents(), QAndroidStyle::AndroidControl::drawControl(), QQC2::QCommonStyle::drawControl(), QCommonStyle::drawControl(), QGraphicsScenePrivate::drawItemHelper(), QWindowsVistaStyle::drawPrimitive(), QQC2::QCommonStyle::drawPrimitive(), QQC2::QWindowsStyle::drawPrimitive(), QAndroidStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QQC2::QWindowsXPStyle::drawPrimitive(), QPixmapStyle::drawRadioButton(), QMenuPrivate::drawScroller(), QMenuPrivate::drawTearOff(), QWindowContainer::event(), QGroupBox::event(), QWidgetResizeHandler::eventFilter(), grab(), QWidgetWindow::handleResizeEvent(), QMenuBar::heightForWidth(), QAbstractButton::hitButton(), QStyleOption::initFrom(), QMenuBar::initStyleOption(), QMenuBar::minimumSizeHint(), QCheckBox::mouseMoveEvent(), QMenu::mouseMoveEvent(), QPushButton::mouseMoveEvent(), QScrollBar::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QWhatsThat::mousePressEvent(), QMenu::mousePressEvent(), QCalendarPopup::mousePressEvent(), mousePressEvent(), QWhatsThat::mouseReleaseEvent(), QLineEdit::mouseReleaseEvent(), QAbstractButtonPrivate::moveFocus(), QComboBoxDelegate::paint(), QtPrivate::QWellArray::paintCell(), QCalendarWidget::paintCell(), QPagePreview::paintEvent(), QtPrivate::QWellArray::paintEvent(), QWhatsThat::paintEvent(), QBalloonTip::paintEvent(), QSystemTrayIconSys::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QFocusFrame::paintEvent(), QMenu::paintEvent(), QMenuBar::paintEvent(), QTabBar::paintEvent(), plaintextlayout::Window::paintEvent(), SplitterHandle::paintEvent(), QQuickWidget::paintEvent(), QMdiSubWindow::paintEvent(), raise(), repaint(), repaint(), QDialog::resizeEvent(), QWidgetPrivate::safeAreaMargins(), scroll(), scroll(), QApplicationPrivate::sendMouseEvent(), QMenuPrivate::setFirstActionActive(), QFrame::setFrameRect(), setMask(), QDialog::setSizeGripEnabled(), QMenu::sizeHint(), QMenuBar::sizeHint(), QCommonStyle::styleHint(), QQC2_NAMESPACE::QMacStyle::subControlRect(), QQC2::QCommonStyle::subControlRect(), QMacStyle::subControlRect(), QCommonStyle::subControlRect(), QTabBar::tabRect(), update(), update(), QMenuPrivate::updateActionRects(), widgetRectFor(), src_gui_painting_qpainter2::MyWidget::wrapper11(), and src_gui_painting_qpainter2::MyWidget::wrapper7().
|
readwrite |
the size of the widget excluding any window frame
If the widget is visible when it is being resized, it receives a resize event (resizeEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive an event before it is shown.
The size is adjusted if it lies outside the range defined by minimumSize() and maximumSize().
By default, this property contains a value that depends on the user's platform and screen geometry.
{QSize(0, 0)} will cause the widget to not appear on screen. This also applies to windows.Definition at line 93 of file qwidget.h.
Referenced by QQuickVideoOutput::QQuickVideoOutput(), QSystemTrayIconSys::QSystemTrayIconSys(), _q_boundGeometryToSizeConstraints(), QGraphicsVideoItemPrivate::_q_present(), QDialog::adjustPosition(), QWidgetAnimator::animate(), QMainWindowLayout::animationFinished(), QToolBarLayout::checkUsePopupMenu(), closestAcceptableSize(), QLayout::closestAcceptableSize(), QMacStylePrivate::cocoaCell(), QMacStylePrivate::cocoaControl(), QQuickLabsPlatformMenu::data_count(), QQuickLabsPlatformMenuBar::data_count(), QScrollArea::ensureWidgetVisible(), QOpenGLWidget::event(), QToolBarLayout::expandedSize(), findTextureWidgetsRecursively(), fixToolBarOrientation(), QDockAreaLayout::gapRect(), QFileDialog::getOpenFileContent(), QSplitterLayoutStruct::getWidgetSize(), QSystemTrayIconSys::globalGeometry(), QWidgetWindow::handleMouseEvent(), QTabBarPrivate::initBasicStyleOption(), QDockAreaLayoutInfo::insertGap(), QQuickLabsPlatformMenu::items_count(), mapData(), mapData(), QWidgetRepaintManager::markDirty(), QQuickLabsPlatformMenuBar::menus_count(), QCommandLinkButton::minimumSizeHint(), QProgressBar::minimumSizeHint(), QTabBar::minimumTabSizeHint(), org.qtproject.qt.android.QtActivityDelegate::onPrepareOptionsMenu(), QSystemTrayIconSys::paintEvent(), QTabBar::paintEvent(), QTabWidget::paintEvent(), QGstreamerImageCapture::probeBuffer(), Q_LOGGING_CATEGORY(), qImageFromVideoFrame(), QOpenGLWidget::resizeEvent(), QColumnViewPreviewColumn::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), restoreGeometry(), QAlphaWidget::run(), scroll(), scroll(), QTabBar::setCurrentIndex(), QDockWidget::setFloating(), QAbstractButton::setIconSize(), QComboBox::setIconSize(), QTabBar::setIconSize(), QPlatformVideoSink::setVideoFrame(), QWizard::setWizardStyle(), QMdiSubWindow::showEvent(), QWizard::sizeHint(), QCommandLinkButton::sizeHint(), QMdi::ControllerWidget::sizeHint(), QMdiSubWindow::sizeHint(), QScrollBar::sizeHint(), QQuickWidget::sizeHint(), QVideoWidget::sizeHint(), snippet_ctor2(), QQC2::QCommonStyle::subControlRect(), QCommonStyle::subControlRect(), QGraphicsProxyWidget::subWidgetRect(), QMainWindowLayout::unplug(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QScrollAreaPrivate::updateScrollBars(), QVideoTextureHelper::updateUniformData(), QScrollAreaPrivate::updateWidgetPosition(), and MainWindow::writeSettings().
|
read |
the recommended size for the widget
If the value of this property is an invalid size, no size is recommended.
The default implementation of sizeHint() returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.
Definition at line 93 of file qwidget.h.
Referenced by QRollEffect::QRollEffect(), fixToolBarOrientation(), QSplitterLayoutStruct::getWidgetSize(), QTableViewPrivate::heightHintForIndex(), menuBarHeightForWidth(), QMenuBarPrivate::menuRect(), QColumnViewGrip::mouseDoubleClickEvent(), QDateTimeEditPrivate::positionCalendarPopup(), QToolBarAreaLayoutItem::realSizeHint(), QMdi::SimpleCascader::rearrange(), restoreGeometry(), QWidgetItem::setGeometry(), MyScrollArea::setWidget(), QScrollArea::setWidget(), QDialog::sizeHint(), QWidgetItem::sizeHint(), QStackedLayout::sizeHint(), QFrame::sizeHint(), QVideoWidget::sizeHint(), QMenuBarPrivate::updateGeometries(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QTableViewPrivate::widthHintForIndex(), and QTreeViewPrivate::widthHintForIndex().
|
readwrite |
the size increment of the widget
When the user resizes the window, the size will move in steps of sizeIncrement().width() pixels horizontally and sizeIncrement.height() pixels vertically, with baseSize() as the basis. Preferred widget sizes are for non-negative integers i and j:
Note that while you can set the size increment for all widgets, it only affects windows.
By default, this property contains a size with zero width and height.
|
readwrite |
the default layout behavior of the widget
If there is a QLayout that manages this widget's children, the size policy specified by that layout is used. If there is no such QLayout, the result of this function is used.
The default policy is Preferred/Preferred, which means that the widget can be freely resized, but prefers to be the size sizeHint() returns. Button-like widgets set the size policy to specify that they may stretch horizontally, but are fixed vertically. The same applies to lineedit controls (such as QLineEdit, QSpinBox or an editable QComboBox) and other horizontally orientated widgets (such as QProgressBar). QToolButton's are normally square, so they allow growth in both directions. Widgets that support different directions (such as QSlider, QScrollBar or QHeader) specify stretching in the respective direction only. Widgets that can provide scroll bars (usually subclasses of QScrollArea) tend to specify that they can use additional space, and that they can make do with less than sizeHint().
Definition at line 93 of file qwidget.h.
Referenced by QWidgetItem::controlTypes(), QDefaultItemEditorFactory::createEditor(), QSplitterPrivate::doResize(), QWidgetItem::expandingDirections(), QSplitterLayoutStruct::getWidgetSize(), QBoxLayoutItem::hStretch(), QGridBox::hStretch(), QWidgetItem::isEmpty(), QLabel::minimumSizeHint(), QMacStyle::pixelMetric(), QToolBarAreaLayoutItem::realSizeHint(), QWidgetItem::setGeometry(), QAbstractSlider::setOrientation(), QProgressBar::setOrientation(), QSplitter::setOrientation(), QSplitter::setStretchFactor(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QWidgetItem::sizeHint(), QStackedLayout::sizeHint(), QScrollAreaPrivate::updateScrollBars(), QBoxLayoutItem::vStretch(), QGridBox::vStretch(), and QFormLayoutItem::vStretch().
|
readwrite |
the widget's style sheet
The style sheet contains a textual description of customizations to the widget's style, as described in the \l{Qt Style Sheets} document.
Since Qt 4.5, Qt style sheets fully supports \macos.
Definition at line 93 of file qwidget.h.
Referenced by setStyleSheet().
|
readwrite |
whether tablet tracking is enabled for the widget
If tablet tracking is disabled (the default), the widget only receives tablet move events when the stylus is in contact with the tablet, or at least one stylus button is pressed, while the stylus is being moved.
If tablet tracking is enabled, the widget receives tablet move events even while hovering in proximity. This is useful for monitoring position as well as the auxiliary properties such as rotation and tilt, and providing feedback in the UI.
|
readwrite |
whether updates are enabled
An updates enabled widget receives paint events and has a system background; a disabled widget does not. This also implies that calling update() and repaint() has no effect if updates are disabled.
By default, this property is true
.
setUpdatesEnabled() is normally used to disable updates for a short period of time, for instance to avoid screen flicker during large changes. In Qt, widgets normally do not generate screen flicker, but on X11 the server might erase regions on the screen when widgets get hidden before they can be replaced by other widgets. Disabling updates solves this.
Example:
Disabling a widget implicitly disables all its children. Enabling a widget enables all child widgets except top-level widgets or those that have been explicitly disabled. Re-enabling updates implicitly calls update() on the widget.
Definition at line 93 of file qwidget.h.
Referenced by QWidgetRepaintManager::markDirty(), QWidgetPrivate::moveRect(), QOpenGLWidget::paintEvent(), scroll(), scroll(), QComboBox::showPopup(), and QWidgetRepaintManager::sync().
|
readwrite |
whether the widget is visible
Calling setVisible(true) or show() sets the widget to visible status if all its parent widgets up to the window are visible. If an ancestor is not visible, the widget won't become visible until all its ancestors are shown. If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown. If the widget has not been resized yet, Qt will adjust the widget's size to a useful default using adjustSize().
Calling setVisible(false) or hide() hides a widget explicitly. An explicitly hidden widget will never become visible, even if all its ancestors become visible, unless you show it.
A widget receives show and hide events when its visibility status changes. Between a hide and a show event, there is no need to waste CPU cycles preparing or displaying information to the user. A video application, for example, might simply stop generating new frames.
A widget that happens to be obscured by other windows on the screen is considered to be visible. The same applies to iconified windows and windows that exist on another virtual desktop (on platforms that support this concept). A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again.
You almost never have to reimplement the setVisible() function. If you need to change some settings before a widget is shown, use showEvent() instead. If you need to do some delayed initialization use the Polish event delivered to the event() function.
Definition at line 93 of file qwidget.h.
Referenced by QMdi::ControllerWidget::setControlVisible(), QtPrivate::QColorPicker::setCrossVisible(), QCalendarWidget::setNavigationBarVisible(), QDial::setNotchesVisible(), QTabBar::setTabVisible(), QTabWidget::setTabVisible(), QProgressBar::setTextVisible(), QMenu::setToolTipsVisible(), setVisible(), QPrintPreviewDialog::setVisible(), QPrintPreviewWidget::setVisible(), QColorDialog::setVisible(), QDialog::setVisible(), QFileDialog::setVisible(), QFontDialog::setVisible(), QInputDialog::setVisible(), QWizard::setVisible(), QMenuBar::setVisible(), and QSizeGrip::setVisible().
|
read |
the width of the widget excluding any window frame
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and screen geometry.
Definition at line 93 of file qwidget.h.
Referenced by QRollEffect::QRollEffect(), QCalendarWidgetPrivate::_q_yearClicked(), allocHWFrame(), QWidgetAnimator::animate(), QMacStylePrivate::aquaSizeConstrain(), QMenuBar::changeEvent(), QQuickControlsTestUtils::clickButton(), QLayout::closestAcceptableSize(), QSizeGripPrivate::corner(), QWidgetResizeHandler::doResize(), QQuickControlsTestUtils::doubleClickButton(), QFontComboBox::event(), QWizard::event(), QMdiSubWindow::event(), QMdiSubWindow::eventFilter(), QMainWindowLayoutState::fits(), frameSize(), QDockAreaLayout::gapRect(), QTabWidget::initStyleOption(), inputMethodQuery(), QMenu::keyPressEvent(), QMdiSubWindow::leaveEvent(), QStatusBarPrivate::messageRect(), QOpenGLWidget::metric(), minimumHeightForWidth(), QDialog::minimumSizeHint(), QMdiSubWindow::minimumSizeHint(), QMenuBar::minimumSizeHint(), QProgressBar::minimumSizeHint(), QColumnViewGrip::mouseDoubleClickEvent(), QToolBarPrivate::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QMdiSubWindow::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QMdiSubWindow::mousePressEvent(), QMdiSubWindow::mouseReleaseEvent(), move(), QRubberBand::move(), QColumnViewGrip::moveGrip(), QTabBar::moveTab(), QDial::notchSize(), QPagePreview::paintEvent(), QtPrivate::QColorLuminancePicker::paintEvent(), QMenu::paintEvent(), QMenuBar::paintEvent(), plaintextlayout::Window::paintEvent(), QWizardHeader::paintEvent(), SplitterHandle::paintEvent(), QMdiSubWindow::paintEvent(), QTipLabel::placeTip(), QMdi::IconTiler::rearrange(), QXcbSystemTrayBackingStore::recreateImage(), QQuickMenuPositioner::reposition(), QtPrivate::QColorPicker::resizeEvent(), QOpenGLWidget::resizeEvent(), QMdiSubWindow::resizeEvent(), saveGeometry(), QWhatsThisPrivate::say(), setFixedHeight(), QSplitter::setHandleWidth(), setMaximumHeight(), setMaximumSize(), setMinimumHeight(), setMinimumSize(), QWizardHeader::setup(), QComboBox::showPopup(), QCompleterPrivate::showPopup(), QDialog::sizeHint(), QMenuBar::sizeHint(), QMenuPrivate::updateActionRects(), QFocusFramePrivate::updateSize(), QScrollAreaPrivate::updateWidgetPosition(), QQuickControlsTestUtils::verifyButtonClickable(), and doc_src_coordsys::SnippetWrappers::wrapper4().
|
readwrite |
the file path associated with a widget
This property only makes sense for windows. It associates a file path with a window. If you set the file path, but have not set the window title, Qt sets the window title to the file name of the specified path, obtained using QFileInfo::fileName().
If the window title is set at any point, then the window title takes precedence and will be shown instead of the file path string.
Additionally, on \macos, this has an added benefit that it sets the \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon} for the window, assuming that the file path exists.
If no file path is set, this property contains an empty string.
By default, this property contains an empty string.
Definition at line 93 of file qwidget.h.
Referenced by setWindowFilePath().
|
readwrite |
the widget's icon
This property only makes sense for windows. If no icon has been set, windowIcon() returns the application icon (QApplication::windowIcon()).
Definition at line 93 of file qwidget.h.
Referenced by QMdi::ControlContainer::ControlContainer(), QMessageBox::about(), QWindowsVistaStyle::drawControl(), QMdiSubWindow::event(), QMdiArea::eventFilter(), QMdiAreaPrivate::setViewMode(), and QMdiSubWindow::setWidget().
|
readwrite |
the text to be displayed on the icon of a minimized window
This property only makes sense for windows. If no icon text has been set, this accessor returns an empty string. It is only implemented on the X11 platform, and only certain window managers use this window property.
Definition at line 93 of file qwidget.h.
Referenced by setWindowIconText().
|
readwrite |
which windows are blocked by the modal widget
This property only makes sense for windows. A modal widget prevents widgets in other windows from getting input. The value of this property controls which windows are blocked when the widget is visible. Changing this property while the window is visible has no effect; you must hide() the widget first, then show() it again.
By default, this property is Qt::NonModal.
Definition at line 93 of file qwidget.h.
Referenced by QDialog::open(), QMessageBox::setWindowModality(), and setWindowModality().
|
readwrite |
whether the document shown in the window has unsaved changes
A modified window is a window whose content has changed but has not been saved to disk. This flag will have different effects varied by the platform. On \macos the close button will have a modified look; on other platforms, the window title will have an '*' (asterisk).
The window title must contain a "[*]" placeholder, which indicates where the '*' should appear. Normally, it should appear right after the file name (e.g., "document1.txt[*] - Text Editor"). If the window isn't modified, the placeholder is simply removed.
Note that if a widget is set as modified, all its ancestors will also be set as modified. However, if you call {setWindowModified(false)}
on a widget, this will not propagate to its parent because other children of the parent might have been modified.
Definition at line 93 of file qwidget.h.
Referenced by QMdiSubWindow::eventFilter().
|
readwrite |
The level of opacity for the window.
The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent).
By default the value of this property is 1.0.
This feature is available on Embedded Linux, \macos, Windows, and X11 platforms that support the Composite extension.
Definition at line 93 of file qwidget.h.
Referenced by QComboBoxPrivate::updateViewContainerPaletteAndOpacity().
|
readwrite |
the window title (caption)
This property only makes sense for top-level widgets, such as windows and dialogs. If no caption has been set, the title is based of the \l windowFilePath. If neither of these is set, then the title is an empty string.
If you use the \l windowModified mechanism, the window title must contain a "[*]" placeholder, which indicates where the '*' should appear. Normally, it should appear right after the file name (e.g., "document1.txt[*] - Text Editor"). If the \l windowModified property is false
(the default), the placeholder is simply removed.
On some desktop platforms (including Windows and Unix), the application name (from QGuiApplication::applicationDisplayName) is added at the end of the window title, if set. This is done by the QPA plugin, so it is shown to the user, but isn't part of the windowTitle string.
Definition at line 93 of file qwidget.h.
Referenced by QToolBar::changeEvent(), QMdiSubWindow::event(), QMdiSubWindow::eventFilter(), QMessageBox::keyPressEvent(), QMdiSubWindowPrivate::removeBaseWidget(), QToolBarAreaLayout::saveState(), QPrintDialogPrivate::setTabs(), QMdiSubWindow::setWidget(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setWindowTitle(), tabTextFor(), and QMdiSubWindowPrivate::updateWindowTitle().
|
read |
the x coordinate of the widget relative to its parent including any window frame
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property has a value of 0.
Definition at line 93 of file qwidget.h.
Referenced by QCalendarWidgetPrivate::_q_yearClicked(), QDialog::adjustPosition(), QWidgetPrivate::clipRegion(), Viewer::createImage(), QStatusBarPrivate::messageRect(), move(), QColumnViewGrip::moveGrip(), QPagePreview::paintEvent(), QMenuPrivate::popup(), repaint(), resize(), QRubberBand::resize(), QtPrivate::QColorPicker::resizeEvent(), QtPrivate::QColorPicker::setCol(), QDockWidget::setFloating(), and QFocusFramePrivate::updateSize().
|
read |
the y coordinate of the widget relative to its parent and including any window frame
See the \l{Window Geometry} documentation for an overview of geometry issues with windows.
By default, this property has a value of 0.
Definition at line 93 of file qwidget.h.
Referenced by QPrintDialogPrivate::_q_collapseOrExpandDialog(), QCalendarWidgetPrivate::_q_yearClicked(), QDialog::adjustPosition(), Viewer::createImage(), move(), QPagePreview::paintEvent(), QtPrivate::QColorLuminancePicker::paintEvent(), Widget::plusEqualOperator(), repaint(), resize(), QRubberBand::resize(), QtPrivate::QColorPicker::resizeEvent(), QtPrivate::QColorPicker::setCol(), QDockWidget::setFloating(), QCheckBox::setTristate(), and QFocusFramePrivate::updateSize().