The QWidget class is the base class of all user interface objects. More...
#include <qwidget.h>
Inherits QObject and QPaintDevice.
Inherited by QButton, QComboBox, QDialog, QFrame, QGLWidget, QLineEdit, QMainWindow, QNPWidget, QScrollBar, QSemiModal, QSlider, QStatusBar, QTabBar, QToolBar, QWindow and QXtWidget.
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 without a parent, called a top-level widget, is a window with a frame and a title bar (though it is also possible to create top level widgets without such decoration). A widget with a parent is a child window in its parent. You usually cannot distinguish a child widget from its parent visually.
QWidget has many member functions, but some of them have little direct functionality - for example it has a font but never uses it itself. There are many subclasses which provide real functionality, as diverse as QPushButton, QListBox and QTabDialog.
Groups of functions:
Every widget's constructor accepts two or three standard arguments:
QWidget *parent = 0 is the parent of the new widget.
If it is 0 (the default), the new widget will be a top-level window.
If not, it will be a child of parent, and be constrained by parent's geometry.
const char *name = 0 is the widget name of the new
widget. The widget name is little used at the moment - the
dumpObjectTree() debugging function uses it, and you can access it using
name(). It will become more important when our visual GUI builder is
ready (you can name a a widget in the builder, and connect() to it by
name in your code).
WFlags f = 0 (where available) sets the widget flags; the default is good for almost
all widgets, but to get e.g. top-level widgets without a window
system frame you must use special flags.
The tictac/tictac.cpp example program is good example of a simple widget. It contains a few event handlers (as all widgets must), a few custom routines that are peculiar to it (as all useful widgets must), and has a few children and connections. Everything it does is done in response to an event: This is by far the most common way to design GUI applications.
You will need to supply the content for your widgets yourself, but here is a brief run-down of the events, starting with the most common ones:
If your widget only contains child widgets, you probably do not need to implement any event handlers (except resizeEvent() for custom layout management).
Widgets that accept keyboard input need to reimplement a few more event handlers:
Some widgets will need to reimplement some more obscure event handlers, too:
There are also some really obscure events. They are listed in qevent.h and you need to reimplement event() to handle them. The default implementation of event() handles Tab and shift-Tab (to move the keyboard focus), and passes on every other event to one of the more specialized handlers above.
When writing a widget, there are a few more things to look out for. In the constructor, be sure to set up your member variables early on, before there's any chance that you might receive an event.
It is often a good idea to reimplement sizeHint(), so users of your class can set up layout management more easily. If you do, consider offering size management using autoMinimumSize() too.
If your widget is a top-level window, setCaption() and setIcon() set the title bar and icon respectively.
See also: QEvent, QPainter, QGridLayout and QBoxLayout.
Examples: tictac/tictac.cpp life/life.cpp dclock/dclock.cpp forever/forever.cpp desktop/desktop.cpp connect/connect.cpp tooltip/tooltip.cpp hello/hello.cpp xform/xform.cpp aclock/aclock.cpp menu/menu.cpp pref/pref.cpp progress/progress.cpp layout/layout.cpp qmag/qmag.cpp showimg/showimg.cpp biff/biff.cpp widgets/widgets.cpp
Constructs a widget which is a child of parent, with the name name and widget flags set to f.
If parent is 0, the new widget becomes a top-level window. If parent is another widget, this widget becomes a child window inside parent.
The name is sent to the QObject constructor.
The widget flags argument f is normally 0, but it can be set to
customize the window frame of a top-level widget (i.e. parent must be
zero). To customize the frame, set the WStyle_Customize flag OR'ed with
any of these flags:
WStyle_NormalBorder gives the window a normal border. Cannot
be combined with WStyle_DialogBorder or WStyle_NoBorder.
WStyle_DialogBorder gives the window a thin dialog border.
Cannot be combined with WStyle_NormalBorder or WStyle_NoBorder.
WStyle_NoBorder gives a borderless window. Note that the
user cannot move or resize a borderless window via the window system.
Cannot be combined with WStyle_NormalBorder or WStyle_DialogBorder.
WStyle_Title gives the window a title bar.
WStyle_SysMenu adds a window system menu.
WStyle_Minimize adds a minimize button.
WStyle_Maximize adds a maximize button.
WStyle_MinMax is equal to (WStyle_Minimize | WStyle_Maximize)
.
WStyle_Tool makes the window a tool window, usually
combined with WStyle_NoBorder. A tool window is a small window that
lives for a short time and it is typically used for creating popup
windows.
Note that X11 does not necessarily support all style flag combinations. X11 window managers live their own lives and can only take hints. Win32 supports all style flags.
Example:
QLabel *toolTip = new QLabel( 0, "myToolTip",
WStyle_Customize | WStyle_NoBorder |
WStyle_Tool );
The widget flags are defined in qwindowdefs.h (which is included by qwidget.h).
Destroys the widget.
All children of this widget are deleted first. The application exits if this widget is (was) the main widget.
Returns TRUE if drop events are enabled for this widget.
See also: setAcceptDrops().
[virtual]Adjusts the size of the widget to fit the contents.
Uses sizeHint() if valid (i.e if the size hint's width and height are equal to or greater than 0), otherwise sets the size to the children rectangle (the union of all child widget geometries).
See also: sizeHint() and childrenRect().
Examples: movies/main.cpp
Reimplemented in QMessageBox.
Returns the background color of this widget.
The background color is independent of the color group.
Setting a new palette overwrites the background color.
See also: setBackgroundColor(), foregroundColor(), colorGroup() and palette().
Examples: grapher/grapher.cpp xform/xform.cpp widgets/widgets.cpp
[virtual protected]This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
See also: event(), hide(), close() and QCloseEvent.
Reimplemented in QDialog.
Returns the current color group of the widget palette.
The color group is determined by the state of the widget.
A disabled widget returns the QPalette::disabled() color group, a widget in focus returns the QPalette::active() color group and a normal widget returns the QPalette::normal() color group.
See also: palette() and setPalette().
Examples: life/life.cpp
[protected]For internal use only.
[protected]Creates a new widget window if window is null, otherwise sets the widget's window to window.
Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter makes only sense if window is a valid window.
Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).
The QWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.
Returns the widget cursor.
See also: setCursor().
[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.
Writes str at position x,y.
The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.
This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.
See also: setFont(), foregroundColor() and QPainter::drawText().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from enabled().
Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls repaint(TRUE).
See also: setEnabled(), isEnabled(), repaint() and update().
Reimplemented in QSpinBox and QButton.
[virtual protected]This event handler can be reimplemented in a subclass to receive widget enter events.
An event is sent to the widget when the mouse cursor enters the widget.
The default implementation does nothing.
See also: leaveEvent(), mouseMoveEvent() and event().
Reimplemented in QToolButton.
Erases the specified area (x,y,w,h) in the widget without generating a paint event.
If w is negative, it is replaced with width() - x.
If h is negative, it is replaced width height() - y.
Child widgets are not affected.
See also: repaint().
Examples: connect/connect.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 erases the entire widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]This is the main event handler. You may reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press/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().
This function returns TRUE if it is able to pass the event over to someone, or FALSE if nobody wanted the event.
See also: closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event() and QObject::timerEvent().
Reimplemented from QObject.
[protected]For internal use only.
[static]Returns a pointer to the widget with window identifer/handle id.
The window identifier type depends by the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, a null pointer is returned.
See also: wmapper() and id().
[protected]Returns a pointer to the focus data for this widget's top-level widget.
Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).
This information is useful for implementing advanced versions of focusNextPrevChild().
[virtual protected]This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget must accept focus initially in order to receive focus events.
The default implementation calls repaint() since the widget's color group changes from normal to active. You may want to call repaint(FALSE) to reduce flicker in any reimplementation.
As a special case to support applications not utilizing focus, Top-level widgets that have NoFocus policy will receive focus events and gain keyboard events, but the repaint is not done by default.
See also: focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event() and QFocusEvent.
Reimplemented in QSlider, QPushButton, QListBox, QButton, QMultiLineEdit, QListView, QLineEdit and QComboBox.
[virtual protected]Finds a new widget to give the keyboard focus to, as appropriate for
Tab/shift-Tab#backgidget::backgroundColorChange ( const QColor & oldBackgroundColor ) [virtual protected]
This virtual function is called from setBackgroundColor(). oldBackgroundColor is the previous background color; you can get the new background color from backgroundColor().
Reimplement this function if your widget needs to know when its background color changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundColor(), backgroundColor(), setPalette(), repaint() and update().
Returns the mode most recently set by setBackgroundMode(). The default is PaletteBackground
Returns the background pixmap, or null if no background pixmap has not been set. If the widget has been made empty, this function will return a pixmap which isNull() rather than a null pointer.
See also: setBackgroundPixmap() and setBackgroundMode().
[virtual protected]This virtual function is called from setBackgroundPixmap(). oldBackgroundPixmap is the previous background pixmap; you can get the new background pixmap from backgroundPixmap().
Reimplement this function if your widget needs to know when its background pixmap changes. You will almost certainly need to update the widget using either repaint(TRUE) or update().
The default implementation calls update().
See also: setBackgroundPixmap(), backgroundPixmap(), repaint() and update().
Returns the widget caption, or null if no caption has been set.
See also: setCaption(), icon() and iconText().
Returns the bounding rectangle of the widget's children.
Examples: widgets/widgets.cpp
Takes keyboard input focus from the widget.
If the widget has active focus, a focus out event is sent to this widget to tell it that it is about to loose the focus.
This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().
See also: hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy() and QApplication::focusWidget().
Removes any mask set by setMask().
See also: setMask().
[protected]For internal use only.
[virtual]Closes this widget. Returns TRUE if the widget was closed, otherwise FALSE.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. The default implementation of QWidget::closeEvent() accepts the close event.
If forceKill is TRUE, the widget is deleted whether it accepts the close event or not.
The application is terminated when the main widget is closed.
The QApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.
See also: closeEvent(), QCloseEvent, hide(), QApplication::quit() and QApplication::setMainWidget().
Examples: application/application.cpp
[virtual protected]This event handler can be reimplemented in a subclass to receive widget close events.