以下成员源于类 QWidget are 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 () |
| 常量 | 值 |
|---|---|
QWidget::WidgetOrigin
|
0
|
QWidget::ParentOrigin
|
1
|
QWidget::WindowOrigin
|
2
|
QWidget::AncestorOrigin
|
3
|
Returns the color role used for painting the widget's background.
使用 QPalette ( backgroundRole (()) instead.
另请参阅 setBackgroundMode ().
使用 windowTitle () 代替。
另请参阅 setCaption ().
使用 childAt () overload that doesn't have an includeThis 参数。
例如,若有代码像
return widget->childAt(x, y, true);
可以把它重写成
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.
使用 QColorGroup ( palette ()) instead.
使用 ensurePolished () 代替。
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your drawing and call update () to schedule a replaint whenever necessary. See also QPainter .
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your drawing and call update () to schedule a replaint whenever necessary. See also QPainter .
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your erasing and call update () to schedule a replaint whenever necessary. See also QPainter .
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your erasing and call update () to schedule a replaint whenever necessary. See also QPainter .
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your erasing and call update () to schedule a replaint whenever necessary. See also QPainter .
这是重载函数。
Clear the given region, rgn .
Drawing may only take place in a QPaintEvent . Overload paintEvent () to do your erasing and call update () to schedule a replaint whenever necessary. See also QPainter .
使用 testAttribute ( Qt::WA_UnderMouse ) 代替。
Return's the widget's icon.
使用 windowIcon () 代替。
另请参阅 setIcon ().
使用 windowIconText () 代替。
另请参阅 setIconText ().
使用 showMinimized () 代替。
使用 windowType () == Qt::Desktop 代替。
使用 windowType () == Qt::Dialog 代替。
使用 testAttribute ( Qt::WA_InputMethodEnabled ) 代替。
使用 windowType () == Qt::Popup 代替。
Use ! isHidden () instead (notice the exclamation mark), or use isVisible () to check whether the widget is visible.
使用 updatesEnabled 特性代替。
使用 isVisible () 代替。
使用 testAttribute ( Qt::WA_SetCursor ) 代替。
使用 testAttribute ( Qt::WA_SetFont ) 代替。
使用 testAttribute ( Qt::WA_SetPalette ) 代替。
Use the no-argument overload instead.
使用 ensurePolished () 代替。
使用 setParent () to change the parent or the widget's widget flags; use move () to move the widget, and use show () to show the widget.
The boolean parameter b is ignored. Use the no-argument overload instead.
The boolean parameter b is ignored. Use the four-argument overload instead.
The boolean parameter b is ignored. Use the single rect-argument overload instead.
The boolean parameter b is ignored. Use the single region-argument overload instead.
使用 setParent () to change the parent or the widget's widget flags; use move () to move the widget, and use show () to show the widget.
使用 setParent () to change the parent; use move () to move the widget, and use show () to show the widget.
使用 activateWindow () 代替。
另请参阅 isActiveWindow ().
Use the palette instead.
例如,若有代码像
widget->setBackgroundColor(color);
可以把它重写成
QPalette palette; palette.setColor(widget->backgroundRole(), color); widget->setPalette(palette);
Sets the color role used for painting the widget's background to background mode widgetBackground 。 paletteBackground mode parameter is ignored.
另请参阅 backgroundMode ().
Use the palette instead.
例如,若有代码像
widget->setBackgroundPixmap(pixmap);
可以把它重写成
QPalette palette; palette.setBrush(widget->backgroundRole(), QBrush(pixmap)); widget->setPalette(palette);
使用 setWindowTitle () 代替。
另请参阅 caption ().
Use the palette instead.
例如,若有代码像
widget->setEraseColor(color);
可以把它重写成
QPalette palette; palette.setColor(widget->backgroundRole(), color); widget->setPalette(palette);
Use the palette instead.
例如,若有代码像
widget->setErasePixmap(pixmap);
可以把它重写成
QPalette palette; palette.setBrush(widget->backgroundRole(), QBrush(pixmap)); widget->setPalette(palette);
Use the single-argument overload instead.
使用 setWindowIcon () 代替。
另请参阅 icon ().
使用 setWindowIconText () 代替。
另请参阅 iconText ().
使用 setAttribute ( Qt::WA_InputMethodEnabled , enabled ) 代替。
另请参阅 isInputMethodEnabled ().
使用 setAttribute ( Qt::WA_KeyCompression , b) instead.
Use the single-argument overload instead.
Use the palette directly.
例如,若有代码像
widget->setPaletteBackgroundColor(color);
可以把它重写成
QPalette palette; palette.setColor(widget->backgroundRole(), color); widget->setPalette(palette);
Use the palette directly.
例如,若有代码像
widget->setPaletteBackgroundPixmap(pixmap);
可以把它重写成
QPalette palette; palette.setBrush(widget->backgroundRole(), QBrush(pixmap)); widget->setPalette(palette);
Use the palette directly.
例如,若有代码像
widget->setPaletteForegroundColor(color);
可以把它重写成
QPalette palette; palette.setColor(widget->foregroundRole(), color); widget->setPalette(palette);
[slot]
void
QWidget::
setShown
(
bool
shown
)
使用 setVisible ( shown ) 代替。
另请参阅 isShown ().
使用 sizePolicy 特性和 heightForWidth () 函数代替。
这是重载函数。
将小部件 GUI 样式设为 style 使用 QStyleFactory .
使用 setFont (QFont()) instead.
使用 setPalette (QPalette()) instead.
使用 visibleRegion () 代替。
[static]
QWidgetMapper
* QWidget::
wmapper
()
The widget mapper is no longer part of the public API.