
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
The following members of classQWidgetare part of the Qt compatibility layer. We advise against using them in new code.
| enum | BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin } |
| Qt::BackgroundMode | backgroundMode() const |
| QString | caption() const |
| QWidget * | childAt(int x, int y, bool includeThis) const |
| QWidget * | childAt(const QPoint & p, bool includeThis) const |
| bool | close(bool alsoDelete) |
| QColorGroup | colorGroup() const |
| void | constPolish() const |
| void | drawText(const QPoint & p, const QString & s) |
| void | drawText(int x, int y, const QString & s) |
| void | erase() |
| void | erase(int x, int y, int w, int h) |
| void | erase(const QRect & rect) |
| void | erase(const QRegion & rgn) |
| bool | hasMouse() const |
| const QPixmap * | icon() const |
| QString | iconText() const |
| void | iconify() |
| bool | isDesktop() const |
| bool | isDialog() const |
| bool | isInputMethodEnabled() const |
| bool | isPopup() const |
| bool | isShown() const |
| bool | isUpdatesEnabled() const |
| bool | isVisibleToTLW() const |
| bool | ownCursor() const |
| bool | ownFont() const |
| bool | ownPalette() const |
| QWidget * | parentWidget(bool sameWindow) const |
| void | polish() |
| void | recreate(QWidget * parent, Qt::WindowFlags f, const QPoint & p, bool showIt = false) |
| void | repaint(bool b) |
| void | repaint(int x, int y, int w, int h, bool b) |
| void | repaint(const QRect & r, bool b) |
| void | repaint(const QRegion & rgn, bool b) |
| void | reparent(QWidget * parent, Qt::WindowFlags f, const QPoint & p, bool showIt = false) |
| void | reparent(QWidget * parent, const QPoint & p, bool showIt = false) |
| void | setActiveWindow() |
| void | setBackgroundColor(const QColor & color) |
| void | setBackgroundMode(Qt::BackgroundMode widgetBackground, Qt::BackgroundMode paletteBackground = Qt::PaletteBackground) |
| void | setBackgroundPixmap(const QPixmap & pixmap) |
| void | setCaption(const QString & c) |
| void | setEraseColor(const QColor & color) |
| void | setErasePixmap(const QPixmap & pixmap) |
| void | setFont(const QFont & f, bool b) |
| void | setIcon(const QPixmap & i) |
| void | setIconText(const QString & it) |
| void | setInputMethodEnabled(bool enabled) |
| void | setKeyCompression(bool b) |
| void | setPalette(const QPalette & p, bool b) |
| void | setPaletteBackgroundColor(const QColor & color) |
| void | setPaletteBackgroundPixmap(const QPixmap & pixmap) |
| void | setPaletteForegroundColor(const QColor & color) |
| void | setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw) |
| QStyle * | setStyle(const QString & style) |
| void | unsetFont() |
| void | unsetPalette() |
| QRect | visibleRect() const |
| void | setShown(bool shown) |
| QWidgetMapper * | wmapper() |
| Constant | Value |
|---|---|
QWidget::WidgetOrigin | 0 |
QWidget::ParentOrigin | 1 |
QWidget::WindowOrigin | 2 |
QWidget::AncestorOrigin | 3 |
Returns the color role used for painting the widget's background.
UseQPalette(backgroundRole(()) instead.
See alsosetBackgroundMode().
UsewindowTitle() instead.
See alsosetCaption().
Use thechildAt() overload that doesn't have anincludeThis parameter.
For example, if you have code like
return widget->childAt(x, y, true);
you can rewrite it as
QWidget*child= widget->childAt(x, y,true);if (child)return child;if (widget->rect().contains(x, y))return widget;
Use the single point argument overload instead.
Closes the widget.
Use the no-argument overload instead.
UseQColorGroup(palette()) instead.
UseensurePolished() instead.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your drawing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your drawing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your erasing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your erasing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your erasing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
This is an overloaded function.
Clear the given region,rgn.
Drawing may only take place in aQPaintEvent. OverloadpaintEvent() to do your erasing and callupdate() to schedule a replaint whenever necessary. See alsoQPainter.
UsetestAttribute(Qt::WA_UnderMouse) instead.
Return's the widget's icon.
UsewindowIcon() instead.
See alsosetIcon().
UsewindowIconText() instead.
See alsosetIconText().
UseshowMinimized() instead.
UsewindowType() ==Qt::Desktop instead.
UsewindowType() ==Qt::Dialog instead.
UsetestAttribute(Qt::WA_InputMethodEnabled) instead.
UsewindowType() ==Qt::Popup instead.
Use !isHidden() instead (notice the exclamation mark), or useisVisible() to check whether the widget is visible.
Use theupdatesEnabled property instead.
UseisVisible() instead.
UsetestAttribute(Qt::WA_SetCursor) instead.
UsetestAttribute(Qt::WA_SetFont) instead.
UsetestAttribute(Qt::WA_SetPalette) instead.
Use the no-argument overload instead.
UseensurePolished() instead.
UsesetParent() to change the parent or the widget's widget flags; usemove() to move the widget, and useshow() to show the widget.
The boolean parameterb is ignored. Use the no-argument overload instead.
The boolean parameterb is ignored. Use the four-argument overload instead.
The boolean parameterb is ignored. Use the single rect-argument overload instead.
The boolean parameterb is ignored. Use the single region-argument overload instead.
UsesetParent() to change the parent or the widget's widget flags; usemove() to move the widget, and useshow() to show the widget.
UsesetParent() to change the parent; usemove() to move the widget, and useshow() to show the widget.
UseactivateWindow() instead.
See alsoisActiveWindow().
Use the palette instead.
For example, if you have code like
widget->setBackgroundColor(color);
you can rewrite it as
QPalette palette;palette.setColor(widget->backgroundRole(), color);widget->setPalette(palette);
Sets the color role used for painting the widget's background to background modewidgetBackground. ThepaletteBackground mode parameter is ignored.
See alsobackgroundMode().
Use the palette instead.
For example, if you have code like
widget->setBackgroundPixmap(pixmap);
you can rewrite it as
QPalette palette;palette.setBrush(widget->backgroundRole(),QBrush(pixmap));widget->setPalette(palette);
UsesetWindowTitle() instead.
See alsocaption().
Use the palette instead.
For example, if you have code like
widget->setEraseColor(color);
you can rewrite it as
QPalette palette;palette.setColor(widget->backgroundRole(), color);widget->setPalette(palette);
Use the palette instead.
For example, if you have code like
widget->setErasePixmap(pixmap);
you can rewrite it as
QPalette palette;palette.setBrush(widget->backgroundRole(),QBrush(pixmap));widget->setPalette(palette);
Use the single-argument overload instead.
UsesetWindowIcon() instead.
See alsoicon().
UsesetWindowIconText() instead.
See alsoiconText().
UsesetAttribute(Qt::WA_InputMethodEnabled,enabled) instead.
See alsoisInputMethodEnabled().
UsesetAttribute(Qt::WA_KeyCompression, b) instead.
Use the single-argument overload instead.
Use the palette directly.
For example, if you have code like
widget->setPaletteBackgroundColor(color);
you can rewrite it as
QPalette palette;palette.setColor(widget->backgroundRole(), color);widget->setPalette(palette);
Use the palette directly.
For example, if you have code like
widget->setPaletteBackgroundPixmap(pixmap);
you can rewrite it as
QPalette palette;palette.setBrush(widget->backgroundRole(),QBrush(pixmap));widget->setPalette(palette);
Use the palette directly.
For example, if you have code like
widget->setPaletteForegroundColor(color);
you can rewrite it as
QPalette palette;palette.setColor(widget->foregroundRole(), color);widget->setPalette(palette);
[slot]void QWidget::setShown(bool shown)UsesetVisible(shown) instead.
See alsoisShown().
Use thesizePolicy property andheightForWidth() function instead.
This is an overloaded function.
Sets the widget's GUI style tostyle using theQStyleFactory.
UsesetFont(QFont()) instead.
UsesetPalette(QPalette()) instead.
UsevisibleRegion() instead.
[static]QWidgetMapper * QWidget::wmapper()The widget mapper is no longer part of the public API.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.