Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QWidget

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

Direct Known Subclasses:
  QAbstractButton, QAbstractSlider, QAbstractSpinBox, QCalendarWidget, QComboBox, QDesktopWidget, QDialog, QDialogButtonBox, QDockWidget, QFocusFrame, QFrame, QGLWidget, QGroupBox, QLineEdit, QMainWindow, QMdiSubWindow, QMenu, QMenuBar, QProgressBar, QRubberBand, QSizeGrip, QSplashScreen, QSplitterHandle, QStatusBar, QSvgWidget, QTabBar, QTabWidget, QToolBar, QWizardPage, QWorkspace

    public class QWidget

extends QObject
implements QPaintDeviceInterface

The `QWidget` class is the base class of all user interface objects.

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 isn't 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 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:

1. `QWidget *parent = 0` is the parent of the new widget. If it is 0 (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).
2. `Qt::WindowFlags f = 0` (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.

`QWidget` 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`.

### Top-Level and Child Widgets

A widget without a parent widget is always an independent window (top-level widget). For these widgets, `setWindowTitle` and `setWindowIcon` set the title bar and icon respectively.

Non-window widgets are child widgets, and are displayed within their parent widgets. Most widgets in Qt are mainly useful as child widgets. For example, it is possible to display a button as a top-level window, but most people prefer to put their buttons inside other widgets, such as `QDialog`.

The above diagram shows a `QGroupBox` widget being used to hold various child widgets in a layout provided by `QGridLayout`. The `QLabel` child widgets have been outlined to indicate their full sizes.

If you want to use a `QWidget` to hold child widgets you will usually want to add a layout to the parent `QWidget`. See Layout Classes for more information about these.

### Composite Widgets

When a widgets is used as a container to group a number of child widgets, it is known as a composite widget. These can be created by constructing a widget with the required visual properties - a `QFrame`, for example - and adding child widgets to it, usually managed by a layout. The above diagram shows such a composite widget that was created using Qt Designer.

Composite widgets can also be created by subclassing a standard widget, such as `QWidget` or `QFrame`, and adding the necessary layout and child widgets in the constructor of the subclass. Many of the examples provided with Qt use this approach, and it is also covered in the Qt Tutorial.

### Custom Widgets and Painting

Since `QWidget` is a subclass of `QPaintDevice`, subclasses can be used to display custom content that is composed using a series of painting operations with an instance of the `QPainter` class. This approach contrasts with the canvas-style approach used by the Graphics View Framework where items are added to a scene by the application and are rendered by the framework itself.

Each widget performs all painting operations from within its `paintEvent` function. This is called whenever the widget needs to be redrawn, either as a result of some external change or when requested by the application.

The Analog Clock example shows how a simple widget can handle paint events.

### Size Hints and Size Policies

When implementing a new widget, it is almost always useful to reimplement `sizeHint` to provide a reasonable default size for the widget and to set the correct size policy with `setSizePolicy`.

By default, composite widgets which do not provide a size hint will be sized according to the space requirements of their child widgets.

The size policy lets you supply good default behavior for the layout management system, so that other widgets can contain and manage yours easily. The default size policy indicates that the size hint represents the preferred size of the widget, and this is often good enough for many widgets.

### Events

Widgets respond to events that are typically caused by user actions. Qt delivers events to widgets by calling specific event handler functions with instances of `QEvent` subclasses containing information about each event.

If your widget only contains child widgets, you probably do not need to implement any event handlers. If you want to detect a mouse click in a child widget call the child's `underMouse` function inside the widget's `mousePressEvent`.

The Scribble example implements a wider set of events to handle mouse movement, button presses, and window resizing.

You will need to supply the behavior and content for your own widgets, but here is a brief overview of the events that are relevant to `QWidget`, starting with the most common ones:

- `paintEvent` is called whenever the widget needs to be repainted. Every widget which displays custom content must implement it. Painting using a `QPainter` can only take place in a `paintEvent` or a function called by a `paintEvent`.
- `resizeEvent` is called when the widget has been resized.
- `mousePressEvent` is called when a mouse button is pressed when the mouse is inside it, or when it has grabbed the mouse using `grabMouse`.
- `mouseReleaseEvent` is called when a mouse button is released. A widget receives mouse release events when it has received the corresponding mouse press event. This means that if the user presses the mouse inside your widget, then drags the mouse to somewhere else before releasing the mouse button, your widget receives the release event. There is one exception: if a popup menu appears while the mouse button is held down, this popup immediately steals the mouse events.
- `mouseDoubleClickEvent` is called when the user double clicks in the widget. If the user double-clicks, the widget receives a mouse press event, a mouse release event and finally this event instead of a second mouse press event. (Some mouse move events may also be received if the user doesn't hold the mouse steady during this operation.) It is not possible to distinguish a click from a double click until the second click arrives. (This is one reason why most GUI books recommend that double clicks be an extension of single clicks, rather than trigger a different action.)

Widgets that accept keyboard input need to reimplement a few more event handlers:

- `keyPressEvent` is called whenever a key is pressed, and again when a key has been held down long enough for it to auto-repeat. Note that the Tab and Shift+Tab keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement QWidget::event().
- `focusInEvent` is called when the widget gains keyboard focus (assuming you have called `setFocusPolicy`). Well written widgets indicate that they own the keyboard focus in a clear but discreet way.
- `focusOutEvent` is called when the widget loses keyboard focus.

Some widgets will also need to reimplement some of the less common event handlers:

- `mouseMoveEvent` is called whenever the mouse moves while a button is held down. This can be useful during drag and drop operations. If you call `setMouseTracking`(true), you get mouse move events even when no buttons are held down. (See also the guide to Drag and Drop.)
- `keyReleaseEvent` is called whenever a key is released, and also while it is held down if the key is auto-repeating. In that case the widget receives a pair of key release and key press events for every repeat. Note that the Tab and Shift+Tab keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement QWidget::event().
- `wheelEvent` is called whenever the user turns the mouse wheel while the widget has the focus.
- `enterEvent` is called when the mouse enters the widget's screen space. (This excludes screen space owned by any children of the widget.)
- `leaveEvent` is called when the mouse leaves the widget's screen space. Note that if the mouse enters a child widget it will not cause a `leaveEvent`.
- `moveEvent` is called when the widget has been moved relative to its parent.
- `closeEvent` is called when the user closes the widget (or when `close` is called).

There are also some rather obscure events described in the QEvent::Type documentation. You need to reimplement `event` directly to handle these. The default implementation of `event` handles Tab and Shift+Tab (to move the keyboard focus), and passes on most other events to one of the more specialized handlers above.

Events and the mechanism used to deliver them are covered in the Events and Event Filters document.

### Groups of Functions and Properties

Context | Functions and Properties
--- | ---
Window functions | `show`, `hide`, `raise`, `lower`, `close`.
Top-level windows | `windowModified`, `windowTitle`, `windowIcon`, `windowIconText`, `isActiveWindow`, `activateWindow`, minimized, `showMinimized`, maximized, `showMaximized`, `fullScreen`, `showFullScreen`, `showNormal`.
Window contents | `update`, `repaint`, `scroll`.
Geometry | pos, `x`, `y`, rect, size, `width`, `height`, `move`, `resize`, `sizePolicy`, `sizeHint`, `minimumSizeHint`, `updateGeometry`, `layout`, `frameGeometry`, geometry, `childrenRect`, `childrenRegion`, `adjustSize`, `mapFromGlobal`, `mapToGlobal`, `mapFromParent`, `mapToParent`, `maximumSize`, `minimumSize`, `sizeIncrement`, `baseSize`, `setFixedSize`
Mode | visible, `isVisibleTo`, enabled, `isEnabledTo`, modal, `isWindow`, `mouseTracking`, `updatesEnabled`, `visibleRegion`.
Look and feel | `style`, `setStyle`, `styleSheet`, cursor, font, palette, `backgroundRole`, `setBackgroundRole`, `fontInfo`, `fontMetrics`.
Keyboard focus functions | focus, `focusPolicy`, `setFocus`, `clearFocus`, `setTabOrder`, `setFocusProxy`, `focusNextChild`, `focusPreviousChild`.
Mouse and keyboard grabbing | `grabMouse`, `releaseMouse`, `grabKeyboard`, `releaseKeyboard`, `mouseGrabber`, `keyboardGrabber`.
Event handlers | `event`, `mousePressEvent`, `mouseReleaseEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `keyPressEvent`, `keyReleaseEvent`, `focusInEvent`, `focusOutEvent`, `wheelEvent`, `enterEvent`, `leaveEvent`, `paintEvent`, `moveEvent`, `resizeEvent`, `closeEvent`, `dragEnterEvent`, `dragMoveEvent`, `dragLeaveEvent`, `dropEvent`, `childEvent`, `showEvent`, `hideEvent`, `customEvent`. `changeEvent`,
System functions | `parentWidget`, `window`, `setParent`, `winId`, find(), `metric`.
Interactive help | `setToolTip`, `setWhatsThis`

### Widget Style Sheets

In addition to the standard widget styles for each platform, widgets can also be styled according to rules specified in a style sheet. This feature enables you to customize the appearance of specific widgets to provide visual cues to users about their purpose; for example, a button could be styled in a particular way to indicate that it performs a destructive action.

The use of widgets style sheets is described in more detail in Qt Style Sheets.

### Transparency and Double Buffering

From Qt 4.0, `QWidget` automatically double-buffers its painting, so there's no need to write double-buffering code in `paintEvent` to avoid flicker. Additionally, it became possible for widgets to propagate their contents to children, in order to enable transparency effects, by setting the Qt::WA_ContentsPropagated widget attribute - this is now deprecated in Qt 4.1.

In Qt 4.1, the contents of parent widgets are propagated by default to each of their children. Custom widgets can be written to take advantage of this feature by only updating irregular regions (to create non-rectangular child widgets), or by using painting with colors that have less than the full alpha component. The following diagram shows how attributes and properties of a custom widget can be fine-tuned to achieve different effects.

In the above diagram, a semi-transparent rectangular child widget with an area removed is constructed and added to a parent widget (a `QLabel` showing a pixmap) then different properties and widget attributes are set to achieve different effects:

- The left widget has no additional properties or widget attributes set. This default state suits most custom widgets that use transparency or are irregularly-shaped, and that do not paint over their entire area with an opaque brush.
- The center widget has the `autoFillBackground` property set. This property is used with custom widgets that rely on the widget to supply a default background, and do not paint over their entire area with an opaque brush.
- The right widget has the Qt::WA_OpaquePaintEvent widget attribute set. This indicates that the widget will paint over its entire area with opaque colors. The widget's area will initially be uninitialized (represented in the diagram by a red diagonal grid pattern that shines through the overpainted area). This is useful for widgets that need to paint their own specialized contents quickly and that do not need a default filled background.

For rapidly updating custom widgets with simple background colors, such as real-time plotting or graphing widgets, it is better to define a suitable background color (using `setBackgroundRole` with the QPalette::Window role), set the `autoFillBackground` property, and only implement the necessary drawing functionality in the widget's `paintEvent`.

For rapidly updating custom widgets that constantly paint over their entire areas with opaque content, such as video streaming widgets, it is better to set the widget's Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead associated with repainting the widget's background.

If a widget has both the Qt::WA_OpaquePaintEvent widget attribute and the `autoFillBackground` property set, the Qt::WA_OpaquePaintEvent attribute takes precedence. You should choose just one of these depending on your requirements.

In Qt 4.1, the contents of parent widgets are also propagated to standard Qt widgets. This can lead to some unexpected results if the parent widget is decorated in a non-standard way, as shown in the diagram below.

The scope for customizing the painting behavior of standard Qt widgets, without resorting to subclassing, is slightly less than that possible for custom widgets. Usually, the desired appearance of a standard widget can be achieved by setting its `autoFillBackground` property.

See Also:
  `QEvent`, `QPainter`, `QGridLayout`, `QBoxLayout`

Nested Class Summary
`static class` | `QWidget.RenderFlag` This enum describes how to render the widget when calling QWidget.:render().
`static class` | `QWidget.RenderFlags` This QFlag class provides flags for the int enum.

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>`

Field Summary
`QSignalEmitter.Signal1<QPoint>` | `customContextMenuRequested` This signal is emitted when the widget's `contextMenuPolicy` is Qt::CustomContextMenu, and the user has requested a context menu on the widget.

Constructor Summary
`QWidget()` Equivalent to `QWidget`(0, 0).
`QWidget(QWidget parent)` Equivalent to `QWidget`(`parent`, 0).
`QWidget(QWidget parent, Qt.WindowFlags f)` Constructs a widget which is a child of `parent`, with widget flags set to `f`.

Method Summary
`boolean` | `acceptDrops()` Returns whether drop events are enabled for this widget.
`java.lang.String` | `accessibleDescription()` Returns the widget's description as seen by assistive technologies.
`java.lang.String` | `accessibleName()` Returns the widget's name as seen by assistive technologies.
`protected void` | `actionEvent(QActionEvent arg__1)` This event handler is called with the given `arg__1` whenever the widget's actions are changed.
`java.util.List<QAction>` | `actions()` Returns the (possibly empty) list of this widget's actions.
`void` | `activateWindow()` Sets the top-level widget containing this widget to be the active window.
`void` | `addAction(QAction action)` Appends the action `action` to this widget's list of actions.
`void` | `addActions(java.util.List<QAction> actions)` Appends the actions `actions` to this widget's list of actions.
`void` | `adjustSize()` Adjusts the size of the widget to fit the contents.
`boolean` | `autoFillBackground()` Returns whether the widget background is filled automatically.
`QPalette.ColorRole` | `backgroundRole()` Returns the background role of the widget.
`QSize` | `baseSize()` Returns the base size of the widget.
`protected void` | `changeEvent(QEvent arg__1)` This event handler can be reimplemented to handle state changes.
`QWidget` | `childAt(int x, int y)` Returns the visible child widget at the position (`x`, `y`) in the widget's coordinate system.
`QWidget` | `childAt(QPoint p)` Returns the visible child widget at point `p` in the widget's own coordinate system.
`QRect` | `childrenRect()` Returns the bounding rectangle of the widget's children.
`QRegion` | `childrenRegion()` Returns the combined region occupied by the widget's children.
`void` | `clearFocus()` Takes keyboard input focus from the widget.
`void` | `clearMask()` Removes any mask set by `setMask`.
`boolean` | `close()` Closes this widget.
`protected void` | `closeEvent(QCloseEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive widget close events.
`QRect` | `contentsRect()` Returns the area inside the widget's margins.
`protected void` | `contextMenuEvent(QContextMenuEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive widget context menu events.
`Qt.ContextMenuPolicy` | `contextMenuPolicy()` Returns how the widget shows a context menu.
`void` | `createWinId()`
`QCursor` | `cursor()` Returns the cursor shape for this widget.
`int` | `depth()` Returns the bit depth (number of bit planes) of the paint device.
`protected void` | `destroy()` Equivalent to destroy(true, true).
`protected void` | `destroy(boolean destroyWindow)` Equivalent to destroy(`destroyWindow`, true).
`protected void` | `destroy(boolean destroyWindow, boolean destroySubWindows)` Frees up window system resources.
`int` | `devType()` This function is reimplemented for internal reasons.
`protected void` | `dragEnterEvent(QDragEnterEvent arg__1)` This event handler is called when a drag is in progress and the mouse enters this widget.
`protected void` | `dragLeaveEvent(QDragLeaveEvent arg__1)` This event handler is called when a drag is in progress and the mouse leaves this widget.
`protected void` | `dragMoveEvent(QDragMoveEvent arg__1)` This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus.
`protected void` | `dropEvent(QDropEvent arg__1)` This event handler is called when the drag is dropped on this widget.
`void` | `ensurePolished()` Ensures that the widget has been polished by `QStyle` (i.e., has a proper font and palette).
`protected void` | `enterEvent(QEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the `arg__1` parameter.
`boolean` | `event(QEvent arg__1)` This is the main event handler; it handles event `arg__1`.
`protected void` | `focusInEvent(QFocusEvent arg__1)` This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
`protected boolean` | `focusNextChild()` Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't.
`protected boolean` | `focusNextPrevChild(boolean 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.
`protected void` | `focusOutEvent(QFocusEvent arg__1)` This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget.
`Qt.FocusPolicy` | `focusPolicy()` Returns the way the widget accepts keyboard focus.
`protected boolean` | `focusPreviousChild()` Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't.
`QWidget` | `focusProxy()` Returns the focus proxy, or 0 if there is no focus proxy.
`QWidget` | `focusWidget()` Returns the last child of this widget that `setFocus` had been called on.
`QFont` | `font()` Returns the font currently set for the widget.
`QFontInfo` | `fontInfo()` Returns the font info for the widget's current font.
`QFontMetrics` | `fontMetrics()` Returns the font metrics for the widget's current font.
`QPalette.ColorRole` | `foregroundRole()` Returns the foreground role.
`QRect` | `frameGeometry()` Returns geometry of the widget relative to its parent including any window frame.
`QSize` | `frameSize()` Returns the size of the widget including any window frame.
`static QWidget` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QWidget instance pointed to by nativePointer
`QRect` | `geometry()` Returns the geometry of the widget relative to its parent and excluding the window frame.
`QContentsMargins` | `getContentsMargins()` Returns the widget's contents margins.
`void` | `grabKeyboard()` Grabs the keyboard input.
`void` | `grabMouse()` Grabs the mouse input.
`void` | `grabMouse(QCursor arg__1)` Grabs the mouse input and changes the cursor shape.
`int` | `grabShortcut(QKeySequence key)` Equivalent to `grabShortcut`(`key`, Qt::WindowShortcut).
`int` | `grabShortcut(QKeySequence key, Qt.ShortcutContext context)` Adds a shortcut to Qt's shortcut system that watches for the given `key` sequence in the given `context`.
`boolean` | `hasFocus()` Returns whether this widget (or its focus proxy) has the keyboard input focus.
`boolean` | `hasMouseTracking()` Returns whether mouse tracking is enabled for the widget.
`int` | `height()` Returns the height of the widget excluding any window frame.
`int` | `heightForWidth(int arg__1)` Returns the preferred height for this widget, given the width `arg__1`.
`int` | `heightMM()` Returns the height of the paint device in millimeters.
`void` | `hide()` Hides the widget.
`protected void` | `hideEvent(QHideEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget hide events.
`QInputContext` | `inputContext()` This function returns the `QInputContext` for this widget.
`protected void` | `inputMethodEvent(QInputMethodEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive Input Method composition events.
`java.lang.Object` | `inputMethodQuery(Qt.InputMethodQuery arg__1)` This method is only relevant for input widgets.
`void` | `insertAction(QAction before, QAction action)` Inserts the action `action` to this widget's list of actions, before the action `before`.
`void` | `insertActions(QAction before, java.util.List<QAction> actions)` Inserts the actions `actions` to this widget's list of actions, before the action `before`.
`boolean` | `isActiveWindow()` Returns whether this widget's window is the active window.
`boolean` | `isAncestorOf(QWidget child)` 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.
`boolean` | `isEnabled()` Returns whether the widget is enabled.
`boolean` | `isEnabledTo(QWidget arg__1)` Returns true if this widget would become enabled if `arg__1` is enabled; otherwise returns false.
`boolean` | `isFullScreen()` Returns whether the widget is full screen.
`boolean` | `isHidden()` Returns true if the widget is hidden, otherwise returns false.
`boolean` | `isLeftToRight()`
`boolean` | `isMaximized()` Returns whether this widget is maximized.
`boolean` | `isMinimized()` Returns whether this widget is minimized (iconified).
`boolean` | `isModal()` Returns whether the widget is a modal widget.
`boolean` | `isRightToLeft()`
`boolean` | `isVisible()` Returns whether the widget is visible.
`boolean` | `isVisibleTo(QWidget arg__1)` Returns true if this widget would become visible if `arg__1` is shown; otherwise returns false.
`boolean` | `isWindow()` Returns true if the widget is an independent window, otherwise returns false.
`boolean` | `isWindowModified()` Returns whether the document shown in the window has unsaved changes.
`static QWidget` | `keyboardGrabber()` Returns the widget that is currently grabbing the keyboard input.
`protected void` | `keyPressEvent(QKeyEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive key press events for the widget.
`protected void` | `keyReleaseEvent(QKeyEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive key release events for the widget.
`QLayout` | `layout()` Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed.
`Qt.LayoutDirection` | `layoutDirection()` Returns the layout direction for this widget.
`protected void` | `leaveEvent(QEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the `arg__1` parameter.
`QLocale` | `locale()` Returns the widget's locale.
`int` | `logicalDpiX()` Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes.
`int` | `logicalDpiY()` Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes.
`void` | `lower()` Lowers the widget to the bottom of the parent widget's stack.
`QPoint` | `mapFrom(QWidget arg__1, QPoint arg__2)` Translates the widget coordinate `arg__2` from the coordinate system of `arg__1` to this widget's coordinate system.
`QPoint` | `mapFromGlobal(QPoint arg__1)` Translates the global screen coordinate `arg__1` to widget coordinates.
`QPoint` | `mapFromParent(QPoint arg__1)` Translates the parent widget coordinate `arg__1` to widget coordinates.
`QPoint` | `mapTo(QWidget arg__1, QPoint arg__2)` Translates the widget coordinate `arg__2` to the coordinate system of `arg__1`.
`QPoint` | `mapToGlobal(QPoint arg__1)` Translates the widget coordinate `arg__1` to global screen coordinates.
`QPoint` | `mapToParent(QPoint arg__1)` Translates the widget coordinate `arg__1` to a coordinate in the parent widget.
`QRegion` | `mask()` Returns the mask currently set on a widget.
`int` | `maximumHeight()` Returns the widget's maximum height.
`QSize` | `maximumSize()` Returns the widget's maximum size.
`int` | `maximumWidth()` Returns the widget's maximum width.
`int` | `metric(QPaintDevice.PaintDeviceMetric arg__1)` Internal implementation of the virtual QPaintDevice::metric() function.
`int` | `minimumHeight()` Returns the widget's minimum height.
`QSize` | `minimumSize()` Returns the widget's minimum size.
`QSize` | `minimumSizeHint()` Returns the recommended minimum size for the widget.
`int` | `minimumWidth()` Returns the widget's minimum width.
`protected void` | `mouseDoubleClickEvent(QMouseEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse double click events for the widget.
`static QWidget` | `mouseGrabber()` Returns the widget that is currently grabbing the mouse input.
`protected void` | `mouseMoveEvent(QMouseEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse move events for the widget.
`protected void` | `mousePressEvent(QMouseEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse press events for the widget.
`protected void` | `mouseReleaseEvent(QMouseEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse release events for the widget.
`void` | `move(int x, int y)` Sets the position of the widget within its parent widget.
`void` | `move(QPoint arg__1)` Sets the position of the widget within its parent widget to `arg__1`.
`protected void` | `moveEvent(QMoveEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget move events which are passed in the `arg__1` parameter.
`QWidget` | `nextInFocusChain()` Returns the next widget in this widget's focus chain.
`QRect` | `normalGeometry()` Returns the geometry of the widget as it will appear when shown as a normal (not maximized or fullscreen) toplevel widget.
`int` | `numColors()` Returns the number of different colors available for the paint device.
`void` | `overrideWindowFlags(Qt.WindowFlags type)` Sets the window flags for the widget to `type`, without telling the window system.
`void` | `overrideWindowFlags(Qt.WindowType... type)` Sets the window flags for the widget to `type`, without telling the window system.
`void` | `overrideWindowState(Qt.WindowState... state)`
`void` | `overrideWindowState(Qt.WindowStates state)`
`QPaintEngine` | `paintEngine()` Returns the widget's paint engine.
`protected void` | `paintEvent(QPaintEvent arg__1)` This event handler can be reimplemented in a subclass to receive paint events which are passed in the `arg__1` parameter.
`boolean` | `paintingActive()` Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.
`QPalette` | `palette()` Returns the widget's palette.
`QWidget` | `parentWidget()` Returns the parent of this widget, or 0 if it does not have any parent widget.
`int` | `physicalDpiX()` Returns the horizontal resolution of the device in dots per inch.
`int` | `physicalDpiY()` Returns the horizontal resolution of the device in dots per inch.
`QPoint` | `pos()` Returns the position of the widget within its parent widget.
`void` | `raise()` Raises this widget to the top of the parent widget's stack.
`QRect` | `rect()` Returns the internal geometry of the widget excluding any window frame.
`void` | `releaseKeyboard()` Releases the keyboard grab.
`void` | `releaseMouse()` Releases the mouse grab.
`void` | `releaseShortcut(int id)` Removes the shortcut with the given `id` from Qt's shortcut system.
`void` | `removeAction(QAction action)` Removes the action `action` from this widget's list of actions.
`void` | `render(QPaintDeviceInterface target)` Equivalent to render(`target`, QPoint(), QRegion(), RenderFlags( DrawWindowBackground | DrawChildren )).
`void` | `render(QPaintDeviceInterface target, QPoint targetOffset)` Equivalent to render(`target`, `targetOffset`, QRegion(), RenderFlags( DrawWindowBackground | DrawChildren )).
`void` | `render(QPaintDeviceInterface target, QPoint targetOffset, QRegion sourceRegion)` Equivalent to render(`target`, `targetOffset`, `sourceRegion`, RenderFlags( DrawWindowBackground | DrawChildren )).
`void` | `render(QPaintDeviceInterface target, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlag... renderFlags)` Renders the `sourceRegion` of this widget into the `target` using `renderFlags` to determine how to render.
`void` | `render(QPaintDeviceInterface target, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlags renderFlags)` Renders the `sourceRegion` of this widget into the `target` using `renderFlags` to determine how to render.
`void` | `repaint()` Repaints the widget directly by calling `paintEvent` immediately, unless updates are disabled or the widget is hidden.
`void` | `repaint(int x, int y, int w, int h)` This version repaints a rectangle (`x`, `y`, `w`, `h`) inside the widget.
`void` | `repaint(QRect arg__1)` This version repaints a rectangle `arg__1` inside the widget.
`void` | `repaint(QRegion arg__1)` This version repaints a region `arg__1` inside the widget.
`protected void` | `resetInputContext()` This function can be called on the widget that currently has focus to reset the input method operating on it.
`void` | `resize(int w, int h)` Sets the size of the widget excluding any window frame.
`void` | `resize(QSize arg__1)` Sets the size of the widget excluding any window frame to `arg__1`.
`protected void` | `resizeEvent(QResizeEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the `arg__1` parameter.
`boolean` | `restoreGeometry(QByteArray geometry)` Restores the geometry and state top-level widgets stored in the byte array `geometry`.
`QByteArray` | `saveGeometry()` Saves the current geometry and state for top-level widgets.
`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, QRect arg__3)` This version only scrolls `arg__3` and does not move the children of the widget.
`void` | `setAcceptDrops(boolean on)` Sets whether drop events are enabled for this widget to `on`.
`void` | `setAccessibleDescription(java.lang.String description)` Sets the widget's description as seen by assistive technologies to `description`.
`void` | `setAccessibleName(java.lang.String name)` Sets the widget's name as seen by assistive technologies to `name`.
`void` | `setAttribute(Qt.WidgetAttribute arg__1)` Equivalent to `setAttribute`(`arg__1`, true).
`void` | `setAttribute(Qt.WidgetAttribute arg__1, boolean on)` Sets the attribute `arg__1` on this widget if `on` is true; otherwise clears the attribute.
`void` | `setAutoFillBackground(boolean enabled)` Sets whether the widget background is filled automatically to `enabled`.
`void` | `setBackgroundRole(QPalette.ColorRole arg__1)` Sets the background role of the widget to `arg__1`.
`void` | `setBaseSize(int basew, int baseh)` Sets the base size of the widget.
`void` | `setBaseSize(QSize arg__1)` Sets the base size of the widget to `arg__1`.
`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(QContentsMargins margins)` Sets the `margins` around the contents of the widget.
`void` | `setContextMenuPolicy(Qt.ContextMenuPolicy policy)` Sets how the widget shows a context menu to `policy`.
`void` | `setCursor(QCursor arg__1)` Sets the cursor shape for this widget to `arg__1`.
`void` | `setDisabled(boolean arg__1)` Disables widget input events if `arg__1` is true; otherwise enables input events.
`void` | `setEnabled(boolean arg__1)` Sets whether the widget is enabled to `arg__1`.
`void` | `setFixedHeight(int h)` Sets both the minimum and maximum heights of the widget to `h` without changing the widths.
`void` | `setFixedSize(int w, int h)` Sets the width of the widget to `w` and the height to `h`.
`void` | `setFixedSize(QSize arg__1)` Sets both the minimum and maximum sizes of the widget to `arg__1`, thereby preventing it from ever growing or shrinking.
`void` | `setFixedWidth(int w)` Sets both the minimum and maximum width of the widget to `w` without changing the heights.
`void` | `setFocus()` Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window.
`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 active window.
`void` | `setFocusPolicy(Qt.FocusPolicy policy)` Sets the way the widget accepts keyboard focus to `policy`.
`void` | `setFocusProxy(QWidget arg__1)` Sets the widget's focus proxy to widget `arg__1`.
`void` | `setFont(QFont arg__1)` Sets the font currently set for the widget to `arg__1`.
`void` | `setForegroundRole(QPalette.ColorRole arg__1)` Sets the foreground role of the widget to `arg__1`.
`void` | `setGeometry(int x, int y, int w, int h)` Sets the geometry of the widget relative to its parent and excluding the window frame.
`void` | `setGeometry(QRect arg__1)` Sets the geometry of the widget relative to its parent and excluding the window frame to `arg__1`.
`void` | `setHidden(boolean hidden)` Convenience function, equivalent to `setVisible`(!`hidden`).
`void` | `setInputContext(QInputContext arg__1)` This function sets the input context `arg__1` on this widget.
`void` | `setLayout(QLayout arg__1)` Sets the layout manager for this widget to `arg__1`.
`void` | `setLayoutDirection(Qt.LayoutDirection direction)` Sets the layout direction for this widget to `direction`.
`void` | `setLocale(QLocale locale)` Sets the widget's locale to `locale`.
`void` | `setMask(QBitmap arg__1)` Causes only the pixels of the widget for which `arg__1` has a corresponding 1 bit to be visible.
`void` | `setMask(QRegion arg__1)` Causes only the parts of the widget which overlap `arg__1` to be visible.
`void` | `setMaximumHeight(int maxh)` Sets the widget's maximum height to `maxh`.
`void` | `setMaximumSize(int maxw, int maxh)` Sets the widget's maximum size.
`void` | `setMaximumSize(QSize arg__1)` Sets the widget's maximum size to `arg__1`.
`void` | `setMaximumWidth(int maxw)` Sets the widget's maximum width to `maxw`.
`void` | `setMinimumHeight(int minh)` Sets the widget's minimum height to `minh`.
`void` | `setMinimumSize(int minw, int minh)` Sets the widget's minimum size.
`void` | `setMinimumSize(QSize arg__1)` Sets the widget's minimum size to `arg__1`.
`void` | `setMinimumWidth(int minw)` Sets the widget's minimum width to `minw`.
`void` | `setMouseTracking(boolean enable)` Sets whether mouse tracking is enabled for the widget to `enable`.
`void` | `setPalette(QPalette arg__1)` Sets the widget's palette to `arg__1`.
`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 function also takes widget flags, `f` as an argument.
`void` | `setParent(QWidget parent, Qt.WindowType... f)` This function also takes widget flags, `f` as an argument.
`void` | `setShortcutAutoRepeat(int id)` Equivalent to `setShortcutAutoRepeat`(`id`, true).
`void` | `setShortcutAutoRepeat(int id, boolean enable)` If `enable` is true, auto repeat of the shortcut with the given `id` is enabled; otherwise it is disabled.
`void` | `setShortcutEnabled(int id)` Equivalent to `setShortcutEnabled`(`id`, true).
`void` | `setShortcutEnabled(int id, boolean enable)` If `enable` is true, the shortcut with the given `id` is enabled; otherwise the shortcut is disabled.
`void` | `setSizeIncrement(int w, int h)` Sets the size increment of the widget.
`void` | `setSizeIncrement(QSize arg__1)` Sets the size increment of the widget to `arg__1`.
`void` | `setSizePolicy(QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical)` Sets the default layout behavior of the widget.
`void` | `setSizePolicy(QSizePolicy arg__1)` Sets the default layout behavior of the widget to `arg__1`.
`void` | `setStatusTip(java.lang.String arg__1)` Sets the widget's status tip to `arg__1`.
`void` | `setStyle(QStyle arg__1)` Sets the widget's GUI style to `arg__1`.
`void` | `setStyleSheet(java.lang.String styleSheet)` Sets the widget's style sheet to `styleSheet`.
`static void` | `setTabOrder(QWidget arg__1, QWidget arg__2)` Moves the `arg__2` widget around the ring of focus widgets so that keyboard focus moves from the `arg__1` widget to the `arg__2` widget when the Tab key is pressed.
`void` | `setToolTip(java.lang.String arg__1)` Sets the widget's tooltip to `arg__1`.
`void` | `setUpdatesEnabled(boolean enable)` Sets whether updates are enabled to `enable`.
`void` | `setVisible(boolean visible)` Sets whether the widget is visible to `visible`.
`void` | `setWhatsThis(java.lang.String arg__1)` Sets the widget's What's This help text.
`void` | `setWindowFlags(Qt.WindowFlags type)` 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).
`void` | `setWindowFlags(Qt.WindowType... type)` 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).
`void` | `setWindowIcon(QIcon icon)` Sets the widget's icon to `icon`.
`void` | `setWindowIconText(java.lang.String arg__1)` Sets the widget's icon text to `arg__1`.
`void` | `setWindowModality(Qt.WindowModality windowModality)` Sets which windows are blocked by the modal widget to `windowModality`.
`void` | `setWindowModified(boolean arg__1)` Sets whether the document shown in the window has unsaved changes to `arg__1`.
`void` | `setWindowOpacity(double level)` Sets The level of opacity for the window.
`void` | `setWindowRole(java.lang.String arg__1)` Sets the window's role to `arg__1`.
`void` | `setWindowState(Qt.WindowState... state)` Sets the window state to `state`.
`void` | `setWindowState(Qt.WindowStates state)` Sets the window state to `state`.
`void` | `setWindowTitle(java.lang.String arg__1)` Sets the window title (caption) to `arg__1`.
`void` | `show()` Shows the widget and its child widgets.
`protected void` | `showEvent(QShowEvent arg__1)` This event handler can be reimplemented in a subclass to receive widget show events which are passed in the `arg__1` parameter.
`void` | `showFullScreen()` Shows the widget in full-screen mode.
`void` | `showMaximized()` Shows the widget maximized.
`void` | `showMinimized()` Shows the widget minimized, as an icon.
`void` | `showNormal()` Restores the widget after it has been maximized or minimized.
`QSize` | `size()` Returns the size of the widget excluding any window frame.
`QSize` | `sizeHint()` Returns the recommended size for the widget.
`QSize` | `sizeIncrement()` Returns the size increment of the widget.
`QSizePolicy` | `sizePolicy()` Returns the default layout behavior of the widget.
`void` | `stackUnder(QWidget arg__1)` Places the widget under `arg__1` in the parent widget's stack.
`java.lang.String` | `statusTip()` Returns the widget's status tip.
`QStyle` | `style()` Returns the widget's style object, i.e., the style in which the widget is drawn.
`java.lang.String` | `styleSheet()` Returns the widget's style sheet.
`protected void` | `tabletEvent(QTabletEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive tablet events for the widget.
`boolean` | `testAttribute(Qt.WidgetAttribute arg__1)` Returns true if attribute `arg__1` is set on this widget; otherwise returns false.
`java.lang.String` | `toolTip()` Returns the widget's tooltip.
`boolean` | `underMouse()` Returns true if the widget is under the mouse cursor; otherwise returns false.
`void` | `unsetCursor()` Resets the cursor shape for this widget.
`void` | `unsetLayoutDirection()` Resets the layout direction for this widget.
`void` | `unsetLocale()` Resets the widget's locale.
`void` | `update()` Updates the widget unless updates are disabled or the widget is hidden.
`void` | `update(int x, int y, int w, int h)` This version updates a rectangle (`x`, `y`, `w`, `h`) inside the widget.
`void` | `update(QRect arg__1)` This version updates a rectangle `arg__1` inside the widget.
`void` | `update(QRegion arg__1)` This version repaints a region `arg__1` inside the widget.
`void` | `updateGeometry()` Notifies the layout system that this widget has changed and may need to change geometry.
`protected void` | `updateMicroFocus()` Updates the widget's micro focus.
`boolean` | `updatesEnabled()` Returns whether updates are enabled.
`QRegion` | `visibleRegion()` Returns the unobscured region where paint events can occur.
`java.lang.String` | `whatsThis()` Returns the widget's What's This help text..
`protected void` | `wheelEvent(QWheelEvent arg__1)` This event handler, for event `arg__1`, can be reimplemented in a subclass to receive wheel events for the widget.
`int` | `width()` Returns the width of the widget excluding any window frame.
`int` | `widthMM()` Returns the width of the paint device in millimeters.
`QWidget` | `window()` Returns the window for this widget, i.e. the next ancestor widget that has (or could have) a window-system frame.
`Qt.WindowFlags` | `windowFlags()` 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).
`QIcon` | `windowIcon()` Returns the widget's icon.
`java.lang.String` | `windowIconText()` Returns the widget's icon text.
`Qt.WindowModality` | `windowModality()` Returns which windows are blocked by the modal widget.
`double` | `windowOpacity()` Returns The level of opacity for the window..
`java.lang.String` | `windowRole()` Returns the window's role, or an empty string.
`Qt.WindowStates` | `windowState()` Returns the current window state.
`java.lang.String` | `windowTitle()` Returns the window title (caption).
`Qt.WindowType` | `windowType()` Returns the window type of this widget.
`long` | `winId()` Returns the window system identifier of the widget.
`int` | `x()` Returns the x coordinate of the widget relative to its parent including any window frame.
`int` | `y()` Returns the y coordinate of the widget relative to its parent and including any window frame.

Methods inherited from class com.trolltech.qt.core.QObject
`blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`disconnect, disconnect, signalSender`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### customContextMenuRequested

    public final QSignalEmitter.Signal1<QPoint> customContextMenuRequested

  This signal is emitted when the widget's `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 viewport() .

  Compatible Slot Signatures:
    `void mySlot(com.trolltech.qt.core.QPoint pos)`
    `void mySlot()`
  See Also:
    `mapToGlobal`, `QMenu`, `contextMenuPolicy`

Constructor Detail

### QWidget

    public QWidget(QWidget parent)

  Equivalent to `QWidget`(`parent`, 0).

### QWidget

    public QWidget()

  Equivalent to `QWidget`(0, 0).

### QWidget

    public QWidget(QWidget parent,
                   Qt.WindowFlags f)

  Constructs a widget which is a child of `parent`, with widget flags set to `f`.

  If `parent` is 0, 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 0). To customize the frame, use a value composed from the bitwise OR of any of the 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.

  See Also:
    `windowFlags`

Method Detail

### acceptDrops

    public final boolean acceptDrops()

  Returns 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 (`QWidget::`(`windowType` == Qt::Desktop)), this may fail if another application is using the desktop; you can call `acceptDrops` to test if this occurs.

  Warning: Do not modify this property in a Drag&Drop event handler.

  See Also:
    `setAcceptDrops`

### accessibleDescription

    public final java.lang.String accessibleDescription()

  Returns the widget's description as seen by assistive technologies.

  See Also:
    `setAccessibleDescription`, `QAccessibleInterface::text`

### accessibleName

    public final java.lang.String accessibleName()

  Returns the widget's name as seen by assistive technologies.

  It is be used by accessible clients to identify, find, or announce the widget for accessible clients.

  See Also:
    `setAccessibleName`, `QAccessibleInterface::text`

### actions

    public final java.util.List<QAction> actions()

  Returns the (possibly empty) list of this widget's actions.

  See Also:
    `contextMenuPolicy`, `insertAction`, `removeAction`

### activateWindow

    public final void 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 do not allow an application to interrupt what the user is currently doing in another application.

  See Also:
    `isActiveWindow`, `window`, `show`

### addAction

    public final void addAction(QAction action)

  Appends the action `action` to this widget's list of actions.

  All QWidgets have a list of `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.

  See Also:
    `removeAction`, `insertAction`, `actions`, `QMenu`

### addActions

    public final void addActions(java.util.List<QAction> actions)

  Appends the actions `actions` to this widget's list of actions.

  See Also:
    `removeAction`, `QMenu`, `addAction`

### adjustSize

    public final void adjustSize()

  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 >= 0); otherwise sets the size to the children rectangle that covers all child widgets (the union of all child widget rectangles). For top-level widgets, the screen size is also taken into account.

  See Also:
    `sizeHint`, `childrenRect`

### autoFillBackground

    public final boolean autoFillBackground()

  Returns whether the widget background is filled automatically.

  If enabled, this will cause Qt to fill the background using the widget's background role before invoking the paint event. The background role is defined by the widget's palette.

  In addition, Windows are always filled with QPalette::Window, unless the WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.

  Warning: Do not set this property when using Qt Style Sheets. When using style sheets, the widget is always filled with the "background" property. The "border-radius" property may be used to clip the background.

  See Also:
    `setAutoFillBackground`, `Qt::WA_OpaquePaintEvent`, `Qt::WA_NoSystemBackground`

### backgroundRole

    public final QPalette.ColorRole backgroundRole()

  Returns the background role of the widget.

  The background role defines the brush from the widget's palette that is used to render the background.

  If no explicit background role is set, the widget inherts its parent widget's background role.

  See Also:
    `setBackgroundRole`, `foregroundRole`

### baseSize

    public final QSize baseSize()

  Returns the base size of the widget.

  The base size is used to calculate a proper widget size if the widget defines `sizeIncrement`.

  See Also:
    `setBaseSize`, `setSizeIncrement`

### childAt

    public final QWidget childAt(QPoint p)

  Returns the visible child widget at point `p` in the widget's own coordinate system.

### childAt

    public final QWidget childAt(int x,
                                 int y)

  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 0.

### childrenRect

    public final QRect childrenRect()

  Returns the bounding rectangle of the widget's children.

  Hidden children are excluded.

  See Also:
    `childrenRegion`, `geometry`

### childrenRegion

    public final QRegion childrenRegion()

  Returns the combined region occupied by the widget's children.

  Hidden children are excluded.

  See Also:
    `childrenRect`, `geometry`, `mask`

### clearFocus

    public final void clearFocus()

  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 lose 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`, `QApplication::focusWidget`

### clearMask

    public final void clearMask()

  Removes any mask set by `setMask`.

  See Also:
    `setMask`

### close

    public final boolean close()

  Closes this widget. Returns true if the widget was closed; otherwise returns false.

  First it sends the widget a `QCloseEvent`. The widget is hidden if it accepts the close event. If it 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 `QApplication::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.

### contentsRect

    public final QRect contentsRect()

  Returns the area inside the widget's margins.

  See Also:
    `setContentsMargins`, `getContentsMargins`

### contextMenuPolicy

    public final Qt.ContextMenuPolicy contextMenuPolicy()

  Returns 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.

  See Also:
    `setContextMenuPolicy`, `contextMenuEvent`, `customContextMenuRequested`, `actions`

### createWinId

    public final void createWinId()

### cursor

    public final QCursor cursor()

  Returns the cursor shape for this widget.

  The mouse cursor will assume this shape when it's over this widget. See the list of predefined cursor objects for a range of useful shapes.

  An editor widget might use an I-beam cursor:

          setCursor(Qt::IBeamCursor);

  If no cursor has been set, or after a call to `unsetCursor`, the parent's cursor is used.

  See Also:
    `setCursor`, `QApplication::setOverrideCursor`

### depth

    public final int depth()

  Returns the bit depth (number of bit planes) of the paint device.

  Specified by:
    `depth` in interface `QPaintDeviceInterface`

### destroy

    protected final void destroy(boolean destroyWindow)

  Equivalent to destroy(`destroyWindow`, true).

### destroy

    protected final void destroy()

  Equivalent to destroy(true, true).

### destroy

    protected final void destroy(boolean destroyWindow,
                                 boolean destroySubWindows)

  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.

### ensurePolished

    public final void ensurePolished()

  Ensures that the widget has been polished by `QStyle` (i.e., has 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`).

  See Also:
    `event`

### focusNextChild

    protected final boolean focusNextChild()

  Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't.

  See Also:
    `focusPreviousChild`

### focusPolicy

    public final Qt.FocusPolicy focusPolicy()

  Returns 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).

  See Also:
    `setFocusPolicy`, `focusInEvent`, `focusOutEvent`, `keyPressEvent`, `keyReleaseEvent`, `enabled`

### focusPreviousChild

    protected final boolean focusPreviousChild()

  Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't.

  See Also:
    `focusNextChild`

### focusProxy

    public final QWidget focusProxy()

  Returns the focus proxy, or 0 if there is no focus proxy.

  See Also:
    `setFocusProxy`

### focusWidget

    public final QWidget focusWidget()

  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.

### font

    public final QFont font()

  Returns the font currently set for the widget.

  The `fontInfo` function reports the actual font that is being used by the widget.

  As long as no special font has been set, or after `setFont`(`QFont`) is called, this is either a special font for the widget class, the parent's font or (if this widget is a top level widget), the default application font.

  This code fragment sets a 12 point helvetica bold font:

          QFont font("Helvetica", 12, QFont::Bold);
          setFont(font);

  Note that when a child widget is given a different font to that of its parent widget, it will still inherit the parent's font properties unless these have been set explicitly on the child's font. For example, if the parent's font is bold, the child widget's font will be bold as well if not specified otherwise like this:

          QFont font;
          font.setBold(false);
          setFont(font);

  In addition to setting the font, `setFont` informs all children about the change.

  Warning: Do not use this function in conjunction with Qt Style Sheets. The font of a widget can be customized using the "font" style sheet property.

  See Also:
    `setFont`, `fontInfo`, `fontMetrics`

### fontInfo

    public final QFontInfo fontInfo()

  Returns the font info for the widget's current font. Equivalent to QFontInto(widget->`font`).

  See Also:
    `font`, `fontMetrics`, `setFont`

### fontMetrics

    public final QFontMetrics fontMetrics()

  Returns the font metrics for the widget's current font. Equivalent to `QFontMetrics`(widget->`font`).

  See Also:
    `font`, `fontInfo`, `setFont`

### foregroundRole

    public final QPalette.ColorRole foregroundRole()

  Returns the foreground role.

  The foreground role defines the color from the widget's 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.

  See Also:
    `setForegroundRole`, `backgroundRole`

### frameGeometry

    public final QRect frameGeometry()

  Returns geometry of the widget relative to its parent including any window frame.

  See the Window Geometry documentation for an overview of geometry issues with windows.

  See Also:
    `geometry`, `x`, `y`, `pos`

### frameSize

    public final QSize frameSize()

  Returns the size of the widget including any window frame.

### geometry

    public final QRect geometry()

  Returns 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`.

  Warning: Calling `setGeometry` inside `resizeEvent` or `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `setGeometry`, `frameGeometry`, `rect`, `move`, `resize`, `moveEvent`, `resizeEvent`, `minimumSize`, `maximumSize`

### grabKeyboard

    public final void 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.

  See Also:
    `releaseKeyboard`, `grabMouse`, `releaseMouse`, `focusWidget`

### grabMouse

    public final void 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.

  Warning: Bugs in mouse-grabbing applications very often lock the terminal. Use this function with extreme caution, and consider using the `-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.

  Note that only visible widgets can grab mouse input. If `isVisible` returns false for a widget, that widget cannot call `grabMouse`.

  `focusWidget`

  See Also:
    `releaseMouse`, `grabKeyboard`, `releaseKeyboard`, `grabKeyboard`

### grabMouse

    public final void grabMouse(QCursor arg__1)

  Grabs the mouse input and changes the cursor shape.

  The cursor will assume shape `arg__1` (for as long as the mouse focus is grabbed) and this widget will be the only one to receive mouse events until `releaseMouse` is called().

  Warning: Grabbing the mouse might lock the terminal.

  See Also:
    `releaseMouse`, `grabKeyboard`, `releaseKeyboard`, `setCursor`

### grabShortcut

    public final int grabShortcut(QKeySequence key)

  Equivalent to `grabShortcut`(`key`, Qt::WindowShortcut).

### grabShortcut

    public final int grabShortcut(QKeySequence key,
                                  Qt.ShortcutContext context)

  Adds a shortcut to Qt's shortcut system that watches for the given `key` sequence in the given `context`. If the `context` is not `OnApplication`, the shortcut is local to this widget; otherwise it applies to the application as a whole.

  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.

  Warning: You should not normally need to use this function; instead create `QAction`s with the shortcut key sequences you require (if you also want equivalent menu options and toolbar buttons), or create `QShortcut`s if you just need key sequences. Both `QAction` and `QShortcut` handle all the event filtering for you, and provide signals which are triggered when the user triggers the key sequence, so are much easier to use than this low-level function.

  See Also:
    `releaseShortcut`, `setShortcutEnabled`

### hasFocus

    public final boolean hasFocus()

  Returns whether this widget (or its focus proxy) has the keyboard input focus.

  Effectively equivalent to `QApplication::focusWidget() == this`.

  See Also:
    `setFocus`, `clearFocus`, `setFocusPolicy`, `QApplication::focusWidget`

### hasMouseTracking

    public final boolean hasMouseTracking()

  Returns 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.

  See Also:
    `mouseMoveEvent`

### height

    public final int height()

  Returns the height of the widget excluding any window frame.

  See the Window Geometry documentation for an overview of window geometry.

  Specified by:
    `height` in interface `QPaintDeviceInterface`
  See Also:
    geometry, width, size

### heightMM

    public final int heightMM()

  Returns the height of the paint device in millimeters.

  Specified by:
    `heightMM` in interface `QPaintDeviceInterface`
  See Also:
    `height`

### hide

    public final void hide()

  Hides the widget. This function is equivalent to `setVisible`(false).

  Note: If you are working with `QDialog` or its subclasses and you invoke the `show` function after this function, the dialog will be displayed in its original position.

  See Also:
    `hideEvent`, `isHidden`, `show`, `setVisible`, `isVisible`, `close`

### inputContext

    public final QInputContext inputContext()

  This function returns the `QInputContext` for this widget. By default the input context is inherited from the widgets parent. For toplevels it is inherited from `QApplication`.

  You can override this and set a special input context for this widget by using the `setInputContext` method.

  See Also:
    `setInputContext`

### insertAction

    public final void insertAction(QAction before,
                                   QAction action)

  Inserts the action `action` to this widget's list of actions, before the action `before`. It appends the action if `before` is 0 or `before` is not a valid action for this widget.

  A `QWidget` should only have one of each action.

  See Also:
    `removeAction`, `addAction`, `QMenu`, `contextMenuPolicy`, `actions`

### insertActions

    public final void insertActions(QAction before,
                                    java.util.List<QAction> actions)

  Inserts the actions `actions` to this widget's list of actions, before the action `before`. It appends the action if `before` is 0 or `before` is not a valid action for this widget.

  A `QWidget` can have at most one of each action.

  See Also:
    `removeAction`, `QMenu`, `insertAction`, `contextMenuPolicy`

### isActiveWindow

    public final boolean isActiveWindow()

  Returns 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.

  See Also:
    `activateWindow`, `QApplication::activeWindow`

### isAncestorOf

    public final boolean isAncestorOf(QWidget child)

  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.

### isEnabled

    public final boolean isEnabled()

  Returns whether the widget is enabled.

  An enabled widget handles keyboard and mouse events; a disabled widget does not.

  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.

  See Also:
    `isEnabledTo`, `QKeyEvent`, `QMouseEvent`, `changeEvent`

### isEnabledTo

    public final boolean isEnabledTo(QWidget arg__1)

  Returns true if this widget would become enabled if `arg__1` is enabled; otherwise returns false.

  This is the case if neither the widget itself nor every parent up to but excluding `arg__1` has been explicitly disabled.

  `isEnabledTo`(0) is equivalent to `isEnabled`.

  See Also:
    `setEnabled`, `enabled`

### isFullScreen

    public final boolean isFullScreen()

  Returns whether the widget is full screen.

  See Also:
    `windowState`, `minimized`, `maximized`

### isHidden

    public final boolean isHidden()

  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 visiblity, 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 they were created as independent windows or as children of visible widgets, or if `hide` or `setVisible`(false) was called.

### isLeftToRight

    public final boolean isLeftToRight()

### isMaximized

    public final boolean isMaximized()

  Returns whether this widget is maximized.

  This property is only relevant for windows.

  Note that due to limitations in some window-systems, this does not always report the expected results (e.g. if the user on X11 maximizes the window via the window manager, Qt has no way of distinguishing this from any other resize). This is expected to improve as window manager protocols evolve.

  See Also:
    `windowState`, `showMaximized`, `visible`, `show`, `hide`, `showNormal`, `minimized`

### isMinimized

    public final boolean isMinimized()

  Returns whether this widget is minimized (iconified).

  This property is only relevant for windows.

  See Also:
    `showMinimized`, `visible`, `show`, `hide`, `showNormal`, `maximized`

### isModal

    public final boolean isModal()

  Returns 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.

  See Also:
    `isWindow`, `windowModality`, `QDialog`

### isRightToLeft

    public final boolean isRightToLeft()

### isVisible

    public final boolean isVisible()

  Returns 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.

  See Also:
    `show`, `hide`, `isHidden`, `isVisibleTo`, `isMinimized`, `showEvent`, `hideEvent`

### isVisibleTo

    public final boolean isVisibleTo(QWidget arg__1)

  Returns true if this widget would become visible if `arg__1` is shown; otherwise returns false.

  The true case occurs if neither the widget itself nor any parent up to but excluding `arg__1` 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`.

  See Also:
    `show`, `hide`, `isVisible`

### isWindow

    public final boolean isWindow()

  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 window title.

  A window can have a 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.

  See Also:
    `window`, `isModal`, `parentWidget`

### isWindowModified

    public final boolean isWindowModified()

  Returns 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 Mac OS X 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.

  See Also:
    `windowTitle`, Application Example, `Example`, `Example`

### layout

    public final QLayout layout()

  Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed.

  The layout manager sets the geometry of the widget's children that have been added to the layout.

  See Also:
    `setLayout`, `sizePolicy`, Layout Classes

### layoutDirection

    public final Qt.LayoutDirection layoutDirection()

  Returns the layout direction for this widget.

  See Also:
    `setLayoutDirection`, `QApplication::layoutDirection`

### locale

    public final QLocale locale()

  Returns 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.

  See Also:
    `setLocale`, `QLocale`, `QLocale::setDefault`

### logicalDpiX

    public final int logicalDpiX()

  Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `widthMM`, but it varies on Windows.

  Note that if the `logicalDpiX` doesn't equal the `physicalDpiX`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `logicalDpiX` in interface `QPaintDeviceInterface`
  See Also:
    `logicalDpiY`, `physicalDpiX`

### logicalDpiY

    public final int logicalDpiY()

  Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `heightMM`, but it varies on Windows.

  Note that if the `logicalDpiY` doesn't equal the `physicalDpiY`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `logicalDpiY` in interface `QPaintDeviceInterface`
  See Also:
    `logicalDpiX`, `physicalDpiY`

### lower

    public final void lower()

  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.

  See Also:
    `raise`, `stackUnder`

### mapFrom

    public final QPoint mapFrom(QWidget arg__1,
                                QPoint arg__2)

  Translates the widget coordinate `arg__2` from the coordinate system of `arg__1` to this widget's coordinate system. The `arg__1` must not be 0 and must be a parent of the calling widget.

  See Also:
    `mapTo`, `mapFromParent`, `mapFromGlobal`, `underMouse`

### mapFromGlobal

    public final QPoint mapFromGlobal(QPoint arg__1)

  Translates the global screen coordinate `arg__1` to widget coordinates.

  See Also:
    `mapToGlobal`, `mapFrom`, `mapFromParent`

### mapFromParent

    public final QPoint mapFromParent(QPoint arg__1)

  Translates the parent widget coordinate `arg__1` to widget coordinates.

  Same as `mapFromGlobal` if the widget has no parent.

  See Also:
    `mapToParent`, `mapFrom`, `mapFromGlobal`, `underMouse`

### mapTo

    public final QPoint mapTo(QWidget arg__1,
                              QPoint arg__2)

  Translates the widget coordinate `arg__2` to the coordinate system of `arg__1`. The `arg__1` must not be 0 and must be a parent of the calling widget.

  See Also:
    `mapFrom`, `mapToParent`, `mapToGlobal`, `underMouse`

### mapToGlobal

    public final QPoint mapToGlobal(QPoint arg__1)

  Translates the widget coordinate `arg__1` to global screen coordinates. For example, `mapToGlobal(QPoint(0,0))` would give the global coordinates of the top-left pixel of the widget.

  See Also:
    `mapFromGlobal`, `mapTo`, `mapToParent`

### mapToParent

    public final QPoint mapToParent(QPoint arg__1)

  Translates the widget coordinate `arg__1` to a coordinate in the parent widget.

  Same as `mapToGlobal` if the widget has no parent.

  See Also:
    `mapFromParent`, `mapTo`, `mapToGlobal`, `underMouse`

### mask

    public final QRegion mask()

  Returns the mask currently set on a widget. If no mask is set the return value will be an empty region.

  See Also:
    `setMask`, `clearMask`, `QRegion::isEmpty`, Shaped Clock Example

### maximumHeight

    public final int maximumHeight()

  Returns the widget's maximum height.

  This property corresponds to `maximumSize`.`height`. It is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed height is 16777215.

  See Also:
    `setMaximumHeight`, `maximumSize`, `maximumWidth`

### maximumSize

    public final QSize maximumSize()

  Returns the widget's maximum size.

  The widget cannot be resized to a larger size than the maximum widget size.

  The property is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed size is `QSize`(16777215, 16777215).

  See Also:
    `setMaximumSize`, `maximumWidth`, `maximumHeight`, `minimumSize`, `sizeIncrement`

### maximumWidth

    public final int maximumWidth()

  Returns the widget's maximum width.

  This property corresponds to `maximumSize`.`width`. It is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed width is 16777215.

  See Also:
    `setMaximumWidth`, `maximumSize`, `maximumHeight`

### minimumHeight

    public final int minimumHeight()

  Returns the widget's minimum height.

  This property corresponds to `minimumSize`.`height`.

  See Also:
    `setMinimumHeight`, `minimumSize`, `minimumWidth`

### minimumSize

    public final QSize minimumSize()

  Returns 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 `QSize`(0, 0).

  See Also:
    `setMinimumSize`, `minimumWidth`, `minimumHeight`, `maximumSize`, `sizeIncrement`

### minimumWidth

    public final int minimumWidth()

  Returns the widget's minimum width.

  This property corresponds to `minimumSize`.`width`.

  See Also:
    `setMinimumWidth`, `minimumSize`, `minimumHeight`

### move

    public final void move(QPoint arg__1)

  Sets the position of the widget within its parent widget to `arg__1`.

  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.

  Warning: Calling `move` or `setGeometry` inside `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, size, `x`, `y`

### move

    public final void move(int x,
                           int y)

  Sets 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.

  Warning: Calling `move` or `setGeometry` inside `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, size, `x`, `y`

### nextInFocusChain

    public final QWidget nextInFocusChain()

  Returns the next widget in this widget's focus chain.

### normalGeometry

    public final QRect normalGeometry()

  Returns the geometry of the widget as it will appear when shown as a normal (not maximized or fullscreen) toplevel widget.

  For child widgets this property always holds an empty rect.

  See Also:
    `QWidget::windowState`, `QWidget::geometry`

### numColors

    public final int numColors()

  Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.

  Specified by:
    `numColors` in interface `QPaintDeviceInterface`

### overrideWindowFlags

    public final void overrideWindowFlags(Qt.WindowType... type)

  Sets the window flags for the widget to `type`, without telling the window system.

  Warning: Do not call this function unless you really know what you're doing.

  See Also:
    `setWindowFlags`

### overrideWindowFlags

    public final void overrideWindowFlags(Qt.WindowFlags type)

  Sets the window flags for the widget to `type`, without telling the window system.

  Warning: Do not call this function unless you really know what you're doing.

  See Also:
    `setWindowFlags`

### overrideWindowState

    public final void overrideWindowState(Qt.WindowState... state)

### overrideWindowState

    public final void overrideWindowState(Qt.WindowStates state)

### paintingActive

    public final boolean paintingActive()

  Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

  Specified by:
    `paintingActive` in interface `QPaintDeviceInterface`
  See Also:
    `QPainter::isActive`

### palette

    public final QPalette palette()

  Returns the widget's palette.

  As long as no special palette has been set, this is either a special palette for the widget class, the parent's palette or (if this widget is a top level widget), the default application palette.

  Note: The palette's background color will only have an effect on the appearance of the widget if the `autoFillBackground` property is set.

  Warning: Do not use this function in conjunction with Qt Style Sheets. When using style sheets, the palette of a widget can be customized using the "color", "background-color", "selection-color", "selection-background-color" and "alternate-background-color".

  See Also:
    `setPalette`, `QApplication::palette`

### parentWidget

    public final QWidget parentWidget()

  Returns the parent of this widget, or 0 if it does not have any parent widget.

### physicalDpiX

    public final int physicalDpiX()

  Returns the horizontal resolution of the device in dots per inch.

  Note that if the `physicalDpiX` doesn't equal the `logicalDpiX`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `physicalDpiX` in interface `QPaintDeviceInterface`
  See Also:
    `physicalDpiY`, `logicalDpiX`

### physicalDpiY

    public final int physicalDpiY()

  Returns the horizontal resolution of the device in dots per inch.

  Note that if the `physicalDpiY` doesn't equal the `logicalDpiY`, the corresponding `QPaintEngine` must handle the resolution mapping.

  Specified by:
    `physicalDpiY` in interface `QPaintDeviceInterface`
  See Also:
    `physicalDpiX`, `logicalDpiY`

### pos

    public final QPoint pos()

  Returns 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.

  Warning: Calling `move` or `setGeometry` inside `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, size, `x`, `y`

### raise

    public final void raise()

  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.

  See Also:
    `lower`, `stackUnder`

### rect

    public final QRect rect()

  Returns the internal geometry of the widget excluding any window frame.

  The rect property equals `QRect`(0, 0, `width`, `height`).

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    size

### releaseKeyboard

    public final void releaseKeyboard()

  Releases the keyboard grab.

  See Also:
    `grabKeyboard`, `grabMouse`, `releaseMouse`

### releaseMouse

    public final void releaseMouse()

  Releases the mouse grab.

  See Also:
    `grabMouse`, `grabKeyboard`, `releaseKeyboard`

### releaseShortcut

    public final void 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).

  Warning: You should not normally need to use this function since Qt's shortcut system removes shortcuts automatically when their parent widget is destroyed. It is best to use `QAction` or `QShortcut` to handle shortcuts, since they are easier to use than this low-level function. Note also that this is an expensive operation.

  See Also:
    `grabShortcut`, `setShortcutEnabled`

### removeAction

    public final void removeAction(QAction action)

  Removes the action `action` from this widget's list of actions.

  See Also:
    `insertAction`, `actions`, `insertAction`

### render

    public final void render(QPaintDeviceInterface target,
                             QPoint targetOffset,
                             QRegion sourceRegion,
                             QWidget.RenderFlag... renderFlags)

  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:

          QPixmap pixmap(widget->size());
          widget->render(&pixmap);

  If `sourceRegion` is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget.

  Note: Make sure to call QPainter::end() for the given `target`'s active painter (if any) before rendering. For example:

          QPainter painter(this);
          ...
          painter.end();
          myWidget->render(this);

### render

    public final void render(QPaintDeviceInterface target,
                             QPoint targetOffset,
                             QRegion sourceRegion)

  Equivalent to render(`target`, `targetOffset`, `sourceRegion`, RenderFlags( DrawWindowBackground | DrawChildren )).

### render

    public final void render(QPaintDeviceInterface target,
                             QPoint targetOffset)

  Equivalent to render(`target`, `targetOffset`, QRegion(), RenderFlags( DrawWindowBackground | DrawChildren )).

### render

    public final void render(QPaintDeviceInterface target)

  Equivalent to render(`target`, QPoint(), QRegion(), RenderFlags( DrawWindowBackground | DrawChildren )).

### render

    public final void render(QPaintDeviceInterface target,
                             QPoint targetOffset,
                             QRegion sourceRegion,
                             QWidget.RenderFlags renderFlags)

  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:

          QPixmap pixmap(widget->size());
          widget->render(&pixmap);

  If `sourceRegion` is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget.

  Note: Make sure to call QPainter::end() for the given `target`'s active painter (if any) before rendering. For example:

          QPainter painter(this);
          ...
          painter.end();
          myWidget->render(this);

### repaint

    public final void repaint(QRegion arg__1)

  This version repaints a region `arg__1` inside the widget.

### repaint

    public final void repaint(QRect arg__1)

  This version repaints a rectangle `arg__1` inside the widget.

### repaint

    public final void repaint(int x,
                              int y,
                              int w,
                              int h)

  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`.

### repaint

    public final void repaint()

  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.

  Warning: If you call `repaint` in a function which may itself be called from `paintEvent`, you may get infinite recursion. The `update` function never causes recursion.

  See Also:
    `update`, `paintEvent`, `setUpdatesEnabled`

### resetInputContext

    protected final void resetInputContext()

  This function can be called on the widget that currently has focus to reset the input method operating on it.

  See Also:
    `QInputContext`, `QInputContext::reset`

### resize

    public final void resize(QSize arg__1)

  Sets the size of the widget excluding any window frame to `arg__1`.

  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`.

  Warning: Calling `resize` or `setGeometry` inside `resizeEvent` can lead to infinite recursion.

  Note that setting size to `QSize`(0, 0) will cause the widget to not appear on screen. This also applies to windows.

  See Also:
    pos, geometry, `minimumSize`, `maximumSize`, `resizeEvent`

### resize

    public final void resize(int w,
                             int h)

  Sets 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`.

  Warning: Calling `resize` or `setGeometry` inside `resizeEvent` can lead to infinite recursion.

  Note that setting size to `QSize`(0, 0) will cause the widget to not appear on screen. This also applies to windows.

  See Also:
    pos, geometry, `minimumSize`, `maximumSize`, `resizeEvent`

### restoreGeometry

    public final boolean restoreGeometry(QByteArray geometry)

  Restores the geometry and state 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 the available screen geometry.

  To restore geometry saved using `QSettings`, you can use code like this:

          QSettings settings("MyCompany", "MyApp");
          myWidget->restoreGeometry(settings.value("myWidget/geometry").toByteArray());

  See the Window Geometry documentation for an overview of geometry issues with windows.

  See Also:
    `saveGeometry`, `QSettings`

### saveGeometry

    public final QByteArray saveGeometry()

  Saves the current geometry and state for top-level widgets.

  To save the geometry when the window closes, you can implement a close event like this:

          void MyWidget::closeEvent(QCloseEvent *event)
          {
              QSettings settings("MyCompany", "MyApp");
              settings.setValue("geometry", saveGeometry());
              QWidget::closeEvent(event);
          }

  See the Window Geometry documentation for an overview of geometry issues with windows.

  See Also:
    `restoreGeometry`

### scroll

    public final void scroll(int dx,
                             int dy,
                             QRect arg__3)

  This version only scrolls `arg__3` and does not move the children of the widget.

  If `arg__3` is empty or invalid, the result is undefined.

  See Also:
    `QScrollArea`, `bitBlt`

### scroll

    public final void 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 `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.

  See Also:
    Transparency and Double Buffering

### setAcceptDrops

    public final void setAcceptDrops(boolean on)

  Sets whether drop events are enabled for this widget to `on`.

  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 (`QWidget::`(`windowType` == Qt::Desktop)), this may fail if another application is using the desktop; you can call `acceptDrops` to test if this occurs.

  Warning: Do not modify this property in a Drag&Drop event handler.

  See Also:
    `acceptDrops`

### setAccessibleDescription

    public final void setAccessibleDescription(java.lang.String description)

  Sets the widget's description as seen by assistive technologies to `description`.

  See Also:
    `accessibleDescription`, `QAccessibleInterface::text`

### setAccessibleName

    public final void setAccessibleName(java.lang.String name)

  Sets the widget's name as seen by assistive technologies to `name`.

  It is be used by accessible clients to identify, find, or announce the widget for accessible clients.

  See Also:
    `accessibleName`, `QAccessibleInterface::text`

### setAttribute

    public final void setAttribute(Qt.WidgetAttribute arg__1)

  Equivalent to `setAttribute`(`arg__1`, true).

### setAttribute

    public final void setAttribute(Qt.WidgetAttribute arg__1,
                                   boolean on)

  Sets the attribute `arg__1` on this widget if `on` is true; otherwise clears the attribute.

  See Also:
    `testAttribute`

### setAutoFillBackground

    public final void setAutoFillBackground(boolean enabled)

  Sets whether the widget background is filled automatically to `enabled`.

  If enabled, this will cause Qt to fill the background using the widget's background role before invoking the paint event. The background role is defined by the widget's palette.

  In addition, Windows are always filled with QPalette::Window, unless the WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.

  Warning: Do not set this property when using Qt Style Sheets. When using style sheets, the widget is always filled with the "background" property. The "border-radius" property may be used to clip the background.

  See Also:
    `autoFillBackground`, `Qt::WA_OpaquePaintEvent`, `Qt::WA_NoSystemBackground`

### setBackgroundRole

    public final void setBackgroundRole(QPalette.ColorRole arg__1)

  Sets the background role of the widget to `arg__1`.

  The background role defines the brush from the widget's palette that is used to render the background.

  If `arg__1` is QPalette::NoRole, then the widget inherits its parent's background role.

  See Also:
    `backgroundRole`, `foregroundRole`

### setBaseSize

    public final void setBaseSize(QSize arg__1)

  Sets the base size of the widget to `arg__1`.

  The base size is used to calculate a proper widget size if the widget defines `sizeIncrement`.

  See Also:
    `setSizeIncrement`

### setBaseSize

    public final void setBaseSize(int basew,
                                  int baseh)

  Sets the base size of the widget.

  The base size is used to calculate a proper widget size if the widget defines `sizeIncrement`.

  See Also:
    `baseSize`, `setSizeIncrement`

### setContentsMargins

    public final 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`. 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`.

  See Also:
    `contentsRect`, `getContentsMargins`

### setContextMenuPolicy

    public final void setContextMenuPolicy(Qt.ContextMenuPolicy policy)

  Sets how the widget shows a context menu to `policy`.

  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.

  See Also:
    `contextMenuPolicy`, `contextMenuEvent`, `customContextMenuRequested`, `actions`

### setCursor

    public final void setCursor(QCursor arg__1)

  Sets the cursor shape for this widget to `arg__1`.

  The mouse cursor will assume this shape when it's over this widget. See the list of predefined cursor objects for a range of useful shapes.

  An editor widget might use an I-beam cursor:

          setCursor(Qt::IBeamCursor);

  If no cursor has been set, or after a call to `unsetCursor`, the parent's cursor is used.

  See Also:
    `cursor`, `QApplication::setOverrideCursor`

### setDisabled

    public final void setDisabled(boolean arg__1)

  Disables widget input events if `arg__1` is true; otherwise enables input events.

  See the enabled documentation for more information.

  See Also:
    `isEnabledTo`, `QKeyEvent`, `QMouseEvent`, `changeEvent`

### setEnabled

    public final void setEnabled(boolean arg__1)

  Sets whether the widget is enabled to `arg__1`.

  An enabled widget handles keyboard and mouse events; a disabled widget does not.

  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.

  See Also:
    `isEnabledTo`, `QKeyEvent`, `QMouseEvent`, `changeEvent`

### setFixedHeight

    public final void setFixedHeight(int h)

  Sets both the minimum and maximum heights of the widget to `h` without changing the widths. Provided for convenience.

  See Also:
    `sizeHint`, `minimumSize`, `maximumSize`, `setFixedSize`

### setFixedSize

    public final void setFixedSize(QSize arg__1)

  Sets both the minimum and maximum sizes of the widget to `arg__1`, thereby preventing it from ever growing or shrinking.

  This will override the default size constraints set by `QLayout`.

  Alternatively, if you want the widget to have a fixed size based on its contents, you can call QLayout::setSizeConstraint(QLayout::SetFixedSize);

  See Also:
    `maximumSize`, `minimumSize`

### setFixedSize

    public final void setFixedSize(int w,
                                   int h)

  Sets the width of the widget to `w` and the height to `h`.

### setFixedWidth

    public final void setFixedWidth(int w)

  Sets both the minimum and maximum width of the widget to `w` without changing the heights. Provided for convenience.

  See Also:
    `sizeHint`, `minimumSize`, `maximumSize`, `setFixedSize`

### setFocus

    public final 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 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.

  First, a focus out event is sent to the focus widget (if any) to tell it that it is about to lose the focus. Then a focus in event is sent to this widget 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.

  Warning: If you call `setFocus` in a function which may itself be called from `focusOutEvent` or `focusInEvent`, you may get an infinite recursion.

  `setFocusPolicy` QApplication::focusWidget() `grabKeyboard` `grabMouse`, {Keyboard Focus}

  See Also:
    `hasFocus`, `clearFocus`, `focusInEvent`, `focusOutEvent`

### setFocus

    public final void setFocus()

  Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window.

  See Also:
    `hasFocus`

### setFocusPolicy

    public final void setFocusPolicy(Qt.FocusPolicy policy)

  Sets the way the widget accepts keyboard focus to `policy`.

  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).

  See Also:
    `focusPolicy`, `focusInEvent`, `focusOutEvent`, `keyPressEvent`, `keyReleaseEvent`, `enabled`

### setFocusProxy

    public final void setFocusProxy(QWidget arg__1)

  Sets the widget's focus proxy to widget `arg__1`. If `arg__1` is 0, 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.

  See Also:
    `focusProxy`

### setFont

    public final void setFont(QFont arg__1)

  Sets the font currently set for the widget to `arg__1`.

  The `fontInfo` function reports the actual font that is being used by the widget.

  As long as no special font has been set, or after `setFont`(`QFont`) is called, this is either a special font for the widget class, the parent's font or (if this widget is a top level widget), the default application font.

  This code fragment sets a 12 point helvetica bold font:

          QFont font("Helvetica", 12, QFont::Bold);
          setFont(font);

  Note that when a child widget is given a different font to that of its parent widget, it will still inherit the parent's font properties unless these have been set explicitly on the child's font. For example, if the parent's font is bold, the child widget's font will be bold as well if not specified otherwise like this:

          QFont font;
          font.setBold(false);
          setFont(font);

  In addition to setting the font, `setFont` informs all children about the change.

  Warning: Do not use this function in conjunction with Qt Style Sheets. The font of a widget can be customized using the "font" style sheet property.

  See Also:
    `fontInfo`, `fontMetrics`

### setForegroundRole

    public final void setForegroundRole(QPalette.ColorRole arg__1)

  Sets the foreground role of the widget to `arg__1`.

  The foreground role defines the color from the widget's palette that is used to draw the foreground.

  If `arg__1` is QPalette::NoRole, the widget uses a foreground role that contrasts with the background role.

  See Also:
    `foregroundRole`, `backgroundRole`

### setGeometry

    public final void setGeometry(QRect arg__1)

  Sets the geometry of the widget relative to its parent and excluding the window frame to `arg__1`.

  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`.

  Warning: Calling `setGeometry` inside `resizeEvent` or `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, `rect`, `move`, `resize`, `moveEvent`, `resizeEvent`, `minimumSize`, `maximumSize`

### setGeometry

    public final void setGeometry(int x,
                                  int y,
                                  int w,
                                  int h)

  Sets 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`.

  Warning: Calling `setGeometry` inside `resizeEvent` or `moveEvent` can lead to infinite recursion.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `geometry`, `frameGeometry`, `rect`, `move`, `resize`, `moveEvent`, `resizeEvent`, `minimumSize`, `maximumSize`

### setHidden

    public final void setHidden(boolean hidden)

  Convenience function, equivalent to `setVisible`(!`hidden`).

  See Also:
    `isHidden`

### setInputContext

    public final void setInputContext(QInputContext arg__1)

  This function sets the input context `arg__1` on this widget.

  See Also:
    `inputContext`

### setLayout

    public final void setLayout(QLayout arg__1)

  Sets the layout manager for this widget to `arg__1`.

  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.

  Example:

              QVBoxLayout *layout = new QVBoxLayout;
              layout->addWidget(lcd);
              layout->addWidget(slider);
              setLayout(layout);

  An alternative to calling this function is to pass this widget to the layout's constructor.

  The `QWidget` will take ownership of `arg__1`.

  See Also:
    `layout`, Layout Classes

### setLayoutDirection

    public final void setLayoutDirection(Qt.LayoutDirection direction)

  Sets the layout direction for this widget to `direction`.

  See Also:
    `QApplication::layoutDirection`

### setLocale

    public final void setLocale(QLocale locale)

  Sets the widget's locale to `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.

  See Also:
    `locale`, `QLocale`, `QLocale::setDefault`

### setMask

    public final void setMask(QRegion arg__1)

  Causes only the parts of the widget which overlap `arg__1` 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.

  See Also:
    `windowOpacity`

### setMask

    public final void setMask(QBitmap arg__1)

  Causes only the pixels of the widget for which `arg__1` 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:

              QLabel topLevelLabel;
              QPixmap pixmap(":/images/tux.png");
              topLevelLabel.setPixmap(pixmap);
              topLevelLabel.setMask(pixmap.mask());

  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.

  See Also:
    `mask`, `clearMask`, `windowOpacity`, Shaped Clock Example

### setMaximumHeight

    public final void setMaximumHeight(int maxh)

  Sets the widget's maximum height to `maxh`.

  This property corresponds to `maximumSize`.`height`. It is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed height is 16777215.

  See Also:
    `maximumHeight`, `maximumSize`, `maximumWidth`

### setMaximumSize

    public final void setMaximumSize(int maxw,
                                     int maxh)

  Sets the widget's maximum size.

  The widget cannot be resized to a larger size than the maximum widget size.

  The property is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed size is `QSize`(16777215, 16777215).

  See Also:
    `maximumWidth`, `maximumHeight`, `minimumSize`, `sizeIncrement`

### setMaximumSize

    public final void setMaximumSize(QSize arg__1)

  Sets the widget's maximum size to `arg__1`.

  The widget cannot be resized to a larger size than the maximum widget size.

  The property is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed size is `QSize`(16777215, 16777215).

  See Also:
    `maximumSize`, `maximumWidth`, `maximumHeight`, `minimumSize`, `sizeIncrement`

### setMaximumWidth

    public final void setMaximumWidth(int maxw)

  Sets the widget's maximum width to `maxw`.

  This property corresponds to `maximumSize`.`width`. It is limited by the QWIDGETSIZE_MAX macro, i.e. the largest allowed width is 16777215.

  See Also:
    `maximumWidth`, `maximumSize`, `maximumHeight`

### setMinimumHeight

    public final void setMinimumHeight(int minh)

  Sets the widget's minimum height to `minh`.

  This property corresponds to `minimumSize`.`height`.

  See Also:
    `minimumHeight`, `minimumSize`, `minimumWidth`

### setMinimumSize

    public final void setMinimumSize(int minw,
                                     int minh)

  Sets 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 `QSize`(0, 0).

  See Also:
    `minimumSize`, `minimumWidth`, `minimumHeight`, `maximumSize`, `sizeIncrement`

### setMinimumSize

    public final void setMinimumSize(QSize arg__1)

  Sets the widget's minimum size to `arg__1`.

  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 `QSize`(0, 0).

  See Also:
    `minimumWidth`, `minimumHeight`, `maximumSize`, `sizeIncrement`

### setMinimumWidth

    public final void setMinimumWidth(int minw)

  Sets the widget's minimum width to `minw`.

  This property corresponds to `minimumSize`.`width`.

  See Also:
    `minimumWidth`, `minimumSize`, `minimumHeight`

### setMouseTracking

    public final void setMouseTracking(boolean enable)

  Sets whether mouse tracking is enabled for the widget to `enable`.

  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.

  See Also:
    `hasMouseTracking`, `mouseMoveEvent`

### setPalette

    public final void setPalette(QPalette arg__1)

  Sets the widget's palette to `arg__1`.

  As long as no special palette has been set, this is either a special palette for the widget class, the parent's palette or (if this widget is a top level widget), the default application palette.

  Note: The palette's background color will only have an effect on the appearance of the widget if the `autoFillBackground` property is set.

  Warning: Do not use this function in conjunction with Qt Style Sheets. When using style sheets, the palette of a widget can be customized using the "color", "background-color", "selection-color", "selection-background-color" and "alternate-background-color".

  See Also:
    `QApplication::palette`

### setParent

    public final void setParent(QWidget parent)

  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 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.

  Note: The widget becomes invisible as part of changing its parent, even if it was previously visible. You must call `show` to make the widget visible again.

  Warning: It is very unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use `QStackedWidget`.

  See Also:
    `setWindowFlags`

### setParent

    public final void setParent(QWidget parent,
                                Qt.WindowType... f)

  This function also takes widget flags, `f` as an argument.

### setParent

    public final void setParent(QWidget parent,
                                Qt.WindowFlags f)

  This function also takes widget flags, `f` as an argument.

### setShortcutAutoRepeat

    public final void setShortcutAutoRepeat(int id)

  Equivalent to `setShortcutAutoRepeat`(`id`, true).

### setShortcutAutoRepeat

    public final void setShortcutAutoRepeat(int id,
                                            boolean enable)

  If `enable` is true, auto repeat of the shortcut with the given `id` is enabled; otherwise it is disabled.

  See Also:
    `grabShortcut`, `releaseShortcut`

### setShortcutEnabled

    public final void setShortcutEnabled(int id)

  Equivalent to `setShortcutEnabled`(`id`, true).

### setShortcutEnabled

    public final void setShortcutEnabled(int id,
                                         boolean enable)

  If `enable` is true, the shortcut with the given `id` is enabled; otherwise the shortcut is disabled.

  Warning: You should not normally need to use this function since Qt's shortcut system enables/disables shortcuts automatically as widgets become hidden/visible and gain or lose focus. It is best to use `QAction` or `QShortcut` to handle shortcuts, since they are easier to use than this low-level function.

  See Also:
    `grabShortcut`, `releaseShortcut`

### setSizeIncrement

    public final void setSizeIncrement(int w,
                                       int h)

  Sets 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:

          width = baseSize().width() + i * sizeIncrement().width();
          height = baseSize().height() + j * sizeIncrement().height();

  Note that while you can set the size increment for all widgets, it only affects windows.

  Warning: The size increment has no effect under Windows, and may be disregarded by the window manager on X.

  See Also:
    `sizeIncrement`, size, `minimumSize`, `maximumSize`

### setSizeIncrement

    public final void setSizeIncrement(QSize arg__1)

  Sets the size increment of the widget to `arg__1`.

  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:

          width = baseSize().width() + i * sizeIncrement().width();
          height = baseSize().height() + j * sizeIncrement().height();

  Note that while you can set the size increment for all widgets, it only affects windows.

  Warning: The size increment has no effect under Windows, and may be disregarded by the window manager on X.

  See Also:
    size, `minimumSize`, `maximumSize`

### setSizePolicy

    public final void setSizePolicy(QSizePolicy arg__1)

  Sets the default layout behavior of the widget to `arg__1`.

  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`.

  See Also:
    `sizeHint`, `QLayout`, `QSizePolicy`, `updateGeometry`

### setSizePolicy

    public final void setSizePolicy(QSizePolicy.Policy horizontal,
                                    QSizePolicy.Policy vertical)

  Sets 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`.

  See Also:
    `sizePolicy`, `sizeHint`, `QLayout`, `QSizePolicy`, `updateGeometry`

### setStatusTip

    public final void setStatusTip(java.lang.String arg__1)

  Sets the widget's status tip to `arg__1`.

  See Also:
    `statusTip`, `toolTip`, `whatsThis`

### setStyle

    public final void setStyle(QStyle arg__1)

  Sets the widget's GUI style to `arg__1`. 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.

  Warning: This function is particularly useful for demonstration purposes, where you want to show Qt's styling capabilities. Real applications should avoid it and use one consistent GUI style instead.

  See Also:
    `style`, `QStyle`, `QApplication::style`, `QApplication::setStyle`

### setStyleSheet

    public final void setStyleSheet(java.lang.String styleSheet)

  Sets the widget's style sheet to `styleSheet`.

  The style sheet contains a textual description of customizations to the widget's style, as described in the Qt Style Sheets document.

  Note: Qt style sheets are currently not supported for QMacStyle (the default style on Mac OS X). We plan to address this in some future release.

  See Also:
    `setStyle`, `QApplication::styleSheet`, Qt Style Sheets

### setToolTip

    public final void setToolTip(java.lang.String arg__1)

  Sets the widget's tooltip to `arg__1`.

  Note that by default tooltips are only shown for widgets that are children of the active window. You can change this behavior by setting the attribute Qt::WA_AlwaysShowToolTips on the window, not on the widget with the tooltip.

  If you want to control a tooltip's behavior, you can intercept the `event` function and catch the QEvent::ToolTip event (e.g., if you want to customize the area for which the tooltip should be shown).

  See Also:
    `toolTip`, `QToolTip`, `statusTip`, `whatsThis`

### setUpdatesEnabled

    public final void setUpdatesEnabled(boolean enable)

  Sets whether updates are enabled to `enable`.

  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.

  `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:

          setUpdatesEnabled(false);
          bigVisualChanges();
          setUpdatesEnabled(true);

  Disabling a widget implicitly disables all its children. Enabling respectively enables all child widgets unless they have been explicitly disabled. Re-enabling updates implicitly calls `update` on the widget.

  See Also:
    `updatesEnabled`, `paintEvent`

### setWhatsThis

    public final void setWhatsThis(java.lang.String arg__1)

  Sets the widget's What's This help text. to `arg__1`.

  See Also:
    `whatsThis`, `QWhatsThis`, `QWidget::toolTip`, `QWidget::statusTip`

### setWindowFlags

    public final void setWindowFlags(Qt.WindowType... type)

  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.

  Note: This function calls `setParent` when changing the flags for a window, and the side effects documented in `setParent` also apply.

  See Also:
    `windowFlags`, `windowType`, `Flags Example`

### setWindowFlags

    public final void setWindowFlags(Qt.WindowFlags type)

  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.

  Note: This function calls `setParent` when changing the flags for a window, and the side effects documented in `setParent` also apply.

  See Also:
    `windowFlags`, `windowType`, `Flags Example`

### setWindowIcon

    public final void setWindowIcon(QIcon icon)

  Sets the widget's icon to `icon`.

  This property only makes sense for windows. If no icon has been set, `windowIcon` returns the application icon (QApplication::windowIcon()).

  See Also:
    `windowIconText`, `windowTitle`

### setWindowIconText

    public final void setWindowIconText(java.lang.String arg__1)

  Sets the widget's icon text to `arg__1`.

  This property only makes sense for windows. If no icon text has been set, this functions returns an empty string.

  See Also:
    `windowIconText`, `windowIcon`, `windowTitle`

### setWindowModality

    public final void setWindowModality(Qt.WindowModality windowModality)

  Sets which windows are blocked by the modal widget to `windowModality`.

  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.

  See Also:
    `windowModality`, `isWindow`, `QWidget::modal`, `QDialog`

### setWindowModified

    public final void setWindowModified(boolean arg__1)

  Sets whether the document shown in the window has unsaved changes to `arg__1`.

  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 Mac OS X 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.

  See Also:
    `isWindowModified`, `windowTitle`, Application Example, `Example`, `Example`

### setWindowOpacity

    public final void setWindowOpacity(double level)

  Sets The level of opacity for the window. to `level`.

  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 Mac OS X, X11 platforms that support the Composite extension, and Windows 2000 and later.

  Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.

  Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows.

  See Also:
    `windowOpacity`, `setMask`

### setWindowRole

    public final void setWindowRole(java.lang.String arg__1)

  Sets the window's role to `arg__1`. This only makes sense for windows on X11.

  See Also:
    `windowRole`

### setWindowState

    public final void setWindowState(Qt.WindowState... state)

  Sets the window state to `state`. 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:

          w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);

  In order to restore and activate a minimized window (while preserving its maximized and/or full-screen state), use the following:

          w->setWindowState(w->windowState() & ~Qt::WindowMinimized | Qt::WindowActive);

  Note: On some window systems Qt::WindowActive is not immediate, and may be ignored in certain cases.

  When the window state changes, the widget receives a `changeEvent` of type QEvent::WindowStateChange.

  See Also:
    `Qt::WindowState`, `windowState`

### setWindowState

    public final void setWindowState(Qt.WindowStates state)

  Sets the window state to `state`. 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:

          w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);

  In order to restore and activate a minimized window (while preserving its maximized and/or full-screen state), use the following:

          w->setWindowState(w->windowState() & ~Qt::WindowMinimized | Qt::WindowActive);

  Note: On some window systems Qt::WindowActive is not immediate, and may be ignored in certain cases.

  When the window state changes, the widget receives a `changeEvent` of type QEvent::WindowStateChange.

  See Also:
    `Qt::WindowState`, `windowState`

### setWindowTitle

    public final void setWindowTitle(java.lang.String arg__1)

  Sets the window title (caption) to `arg__1`.

  This property only makes sense for windows. If no caption has been set, the title is an empty string.

  If you use the `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 `windowModified` property is false (the default), the placeholder is simply removed.

  See Also:
    `windowTitle`, `windowIcon`, `windowIconText`, `windowModified`

### show

    public final void show()

  Shows the widget and its child widgets. This function is equivalent to `setVisible`(true).

  See Also:
    `showEvent`, `hide`, `setVisible`, `showMinimized`, `showMaximized`, `showNormal`, `isVisible`

### showFullScreen

    public final void showFullScreen()

  Shows the widget in full-screen mode.

  Calling this function only affects windows.

  To return from full-screen mode, call `showNormal`.

  Full-screen mode works fine under Windows, but has certain problems under X. These problems are due to limitations of the ICCCM protocol that specifies the communication between X11 clients and the window manager. ICCCM simply does not understand the concept of non-decorated full-screen windows. Therefore, the best we can do is to request a borderless window and place and resize it to fill the entire screen. Depending on the window manager, this may or may not work. The borderless window is requested using MOTIF hints, which are at least partially supported by virtually all modern window managers.

  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.

  See Also:
    `showNormal`, `showMaximized`, `show`, `hide`, `isVisible`

### showMaximized

    public final void showMaximized()

  Shows the widget maximized.

  Calling this function only affects windows.

  On X11, this function may not work properly with certain window managers. See Window Geometry for an explanation.

  See Also:
    `setWindowState`, `showNormal`, `showMinimized`, `show`, `hide`, `isVisible`

### showMinimized

    public final void showMinimized()

  Shows the widget minimized, as an icon.

  Calling this function only affects windows.

  See Also:
    `showNormal`, `showMaximized`, `show`, `hide`, `isVisible`, `isMinimized`

### showNormal

    public final void showNormal()

  Restores the widget after it has been maximized or minimized.

  Calling this function only affects windows.

  See Also:
    `setWindowState`, `showMinimized`, `showMaximized`, `show`, `hide`, `isVisible`

### size

    public final QSize size()

  Returns 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`.

  Warning: Calling `resize` or `setGeometry` inside `resizeEvent` can lead to infinite recursion.

  Note that setting size to `QSize`(0, 0) will cause the widget to not appear on screen. This also applies to windows.

  See Also:
    pos, geometry, `minimumSize`, `maximumSize`, `resizeEvent`

### sizeIncrement

    public final QSize sizeIncrement()

  Returns 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:

          width = baseSize().width() + i * sizeIncrement().width();
          height = baseSize().height() + j * sizeIncrement().height();

  Note that while you can set the size increment for all widgets, it only affects windows.

  Warning: The size increment has no effect under Windows, and may be disregarded by the window manager on X.

  See Also:
    `setSizeIncrement`, size, `minimumSize`, `maximumSize`

### sizePolicy

    public final QSizePolicy sizePolicy()

  Returns 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`.

  See Also:
    `setSizePolicy`, `sizeHint`, `QLayout`, `QSizePolicy`, `updateGeometry`

### stackUnder

    public final void stackUnder(QWidget arg__1)

  Places the widget under `arg__1` in the parent widget's stack.

  To make this work, the widget itself and `arg__1` must be siblings.

  See Also:
    `raise`, `lower`

### statusTip

    public final java.lang.String statusTip()

  Returns the widget's status tip.

  See Also:
    `setStatusTip`, `toolTip`, `whatsThis`

### style

    public final QStyle style()

  Returns the widget's style object, i.e., the style in which the widget is drawn.

### styleSheet

    public final java.lang.String styleSheet()

  Returns the widget's style sheet.

  The style sheet contains a textual description of customizations to the widget's style, as described in the Qt Style Sheets document.

  Note: Qt style sheets are currently not supported for QMacStyle (the default style on Mac OS X). We plan to address this in some future release.

  See Also:
    `setStyleSheet`, `setStyle`, `QApplication::styleSheet`, Qt Style Sheets

### testAttribute

    public final boolean testAttribute(Qt.WidgetAttribute arg__1)

  Returns true if attribute `arg__1` is set on this widget; otherwise returns false.

  See Also:
    `setAttribute`

### toolTip

    public final java.lang.String toolTip()

  Returns the widget's tooltip.

  Note that by default tooltips are only shown for widgets that are children of the active window. You can change this behavior by setting the attribute Qt::WA_AlwaysShowToolTips on the window, not on the widget with the tooltip.

  If you want to control a tooltip's behavior, you can intercept the `event` function and catch the QEvent::ToolTip event (e.g., if you want to customize the area for which the tooltip should be shown).

  See Also:
    `setToolTip`, `QToolTip`, `statusTip`, `whatsThis`

### underMouse

    public final boolean underMouse()

  Returns true if the widget is under the mouse cursor; otherwise returns false.

  This value is not updated properly during drag and drop operations.

  See Also:
    `enterEvent`, `leaveEvent`

### unsetCursor

    public final void unsetCursor()

  Resets the cursor shape for this widget.

  The mouse cursor will assume this shape when it's over this widget. See the list of predefined cursor objects for a range of useful shapes.

  An editor widget might use an I-beam cursor:

          setCursor(Qt::IBeamCursor);

  If no cursor has been set, or after a call to `unsetCursor`, the parent's cursor is used.

  See Also:
    `QApplication::setOverrideCursor`

### unsetLayoutDirection

    public final void unsetLayoutDirection()

  Resets the layout direction for this widget.

  See Also:
    `QApplication::layoutDirection`

### unsetLocale

    public final void unsetLocale()

  Resets 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.

  See Also:
    `QLocale`, `QLocale::setDefault`

### update

    public final void update()

  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.

  See Also:
    `repaint`, `paintEvent`, `setUpdatesEnabled`, Analog Clock Example

### update

    public final void update(QRegion arg__1)

  This version repaints a region `arg__1` inside the widget.

### update

    public final void update(int x,
                             int y,
                             int w,
                             int h)

  This version updates a rectangle (`x`, `y`, `w`, `h`) inside the widget.

### update

    public final void update(QRect arg__1)

  This version updates a rectangle `arg__1` inside the widget.

### updateGeometry

    public final void 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.

### updateMicroFocus

    protected final void updateMicroFocus()

  Updates the widget's micro focus.

  See Also:
    `QInputContext`

### updatesEnabled

    public final boolean updatesEnabled()

  Returns 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.

  `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:

          setUpdatesEnabled(false);
          bigVisualChanges();
          setUpdatesEnabled(true);

  Disabling a widget implicitly disables all its children. Enabling respectively enables all child widgets unless they have been explicitly disabled. Re-enabling updates implicitly calls `update` on the widget.

  See Also:
    `setUpdatesEnabled`, `paintEvent`

### visibleRegion

    public final QRegion visibleRegion()

  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.

### whatsThis

    public final java.lang.String whatsThis()

  Returns the widget's What's This help text..

  See Also:
    `setWhatsThis`, `QWhatsThis`, `QWidget::toolTip`, `QWidget::statusTip`

### width

    public final int width()

  Returns the width of the widget excluding any window frame.

  See the Window Geometry documentation for an overview of window geometry.

  Specified by:
    `width` in interface `QPaintDeviceInterface`
  See Also:
    geometry, height, size

### widthMM

    public final int widthMM()

  Returns the width of the paint device in millimeters.

  Specified by:
    `widthMM` in interface `QPaintDeviceInterface`
  See Also:
    `width`

### winId

    public final long winId()

  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.

  See Also:
    `find`

### window

    public final QWidget window()

  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:

          aWidget->window()->setWindowTitle("New Window Title");

  See Also:
    `isWindow`

### windowFlags

    public final Qt.WindowFlags windowFlags()

  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.

  Note: This function calls `setParent` when changing the flags for a window, and the side effects documented in `setParent` also apply.

  See Also:
    `setWindowFlags`, `windowType`, `Flags Example`

### windowIcon

    public final QIcon windowIcon()

  Returns the widget's icon.

  This property only makes sense for windows. If no icon has been set, `windowIcon` returns the application icon (QApplication::windowIcon()).

  See Also:
    `setWindowIcon`, `windowIconText`, `windowTitle`

### windowIconText

    public final java.lang.String windowIconText()

  Returns the widget's icon text.

  This property only makes sense for windows. If no icon text has been set, this functions returns an empty string.

  See Also:
    `setWindowIconText`, `windowIcon`, `windowTitle`

### windowModality

    public final Qt.WindowModality windowModality()

  Returns 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.

  See Also:
    `setWindowModality`, `isWindow`, `QWidget::modal`, `QDialog`

### windowOpacity

    public final double windowOpacity()

  Returns 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 Mac OS X, X11 platforms that support the Composite extension, and Windows 2000 and later.

  Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.

  Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows.

  See Also:
    `setWindowOpacity`, `setMask`

### windowRole

    public final java.lang.String windowRole()

  Returns the window's role, or an empty string.

  See Also:
    `setWindowRole`, `windowIcon`, `windowTitle`

### windowState

    public final Qt.WindowStates windowState()

  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.

  See Also:
    `Qt::WindowState`, `setWindowState`

### windowTitle

    public final java.lang.String windowTitle()

  Returns the window title (caption).

  This property only makes sense for windows. If no caption has been set, the title is an empty string.

  If you use the `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 `windowModified` property is false (the default), the placeholder is simply removed.

  See Also:
    `setWindowTitle`, `windowIcon`, `windowIconText`, `windowModified`

### windowType

    public final Qt.WindowType windowType()

  Returns the window type of this widget. This is identical to `windowFlags` & Qt::WindowType_Mask.

  See Also:
    `windowFlags`

### x

    public final int x()

  Returns the x coordinate of the widget relative to its parent including any window frame.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, y, pos

### y

    public final int y()

  Returns the y coordinate of the widget relative to its parent and including any window frame.

  See the Window Geometry documentation for an overview of window geometry.

  See Also:
    `frameGeometry`, x, pos

### actionEvent

    protected void actionEvent(QActionEvent arg__1)

  This event handler is called with the given `arg__1` whenever the widget's actions are changed.

  See Also:
    `addAction`, `insertAction`, `removeAction`, `actions`, `QActionEvent`

### changeEvent

    protected void changeEvent(QEvent arg__1)

  This event handler can be reimplemented to handle state changes.

  The state being changed in this event can be retrieved through event `arg__1`.

  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.

### closeEvent

    protected void closeEvent(QCloseEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive widget close events.

  See Also:
    `event`, `hide`, `close`, `QCloseEvent`, Application Example

### contextMenuEvent

    protected void contextMenuEvent(QContextMenuEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive widget context menu events.

  The handler is called when the widget's `contextMenuPolicy` is Qt::DefaultContextMenu.

  The default implementation ignores the context event. See the `QContextMenuEvent` documentation for more details.

  See Also:
    `event`, `QContextMenuEvent`, `customContextMenuRequested`

### devType

    public int devType()

  This function is reimplemented for internal reasons.

  Specified by:
    `devType` in interface `QPaintDeviceInterface`

### dragEnterEvent

    protected void dragEnterEvent(QDragEnterEvent arg__1)

  This event handler is called when a drag is in progress and the mouse enters this widget. The event is passed in the `arg__1` parameter.

  If the event is ignored, the widget won't receive any drag move events.

  See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

  See Also:
    `QDrag`, `QDragEnterEvent`

### dragLeaveEvent

    protected void dragLeaveEvent(QDragLeaveEvent arg__1)

  This event handler is called when a drag is in progress and the mouse leaves this widget. The event is passed in the `arg__1` parameter.

  See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

  See Also:
    `QDrag`, `QDragLeaveEvent`

### dragMoveEvent

    protected void dragMoveEvent(QDragMoveEvent arg__1)

  This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus. The event is passed in the `arg__1` parameter.

  See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

  See Also:
    `QDrag`, `QDragMoveEvent`

### dropEvent

    protected void dropEvent(QDropEvent arg__1)

  This event handler is called when the drag is dropped on this widget. The event is passed in the `arg__1` parameter.

  See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

  See Also:
    `QDrag`, `QDropEvent`

### enterEvent

    protected void enterEvent(QEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the `arg__1` parameter.

  An event is sent to the widget when the mouse cursor enters the widget.

  See Also:
    `leaveEvent`, `mouseMoveEvent`, `event`

### event

    public boolean event(QEvent arg__1)

  This is the main event handler; it handles event `arg__1`. 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 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 `QEvent::accepted`), any further processing such as event propagation to the parent widget stops.

  Overrides:
    `event` in class `QObject`
  See Also:
    `closeEvent`, `focusInEvent`, `focusOutEvent`, `enterEvent`, `keyPressEvent`, `keyReleaseEvent`, `leaveEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `mousePressEvent`, `mouseReleaseEvent`, `moveEvent`, `paintEvent`, `resizeEvent`, `QObject::event`, `QObject::timerEvent`

### focusInEvent

    protected void focusInEvent(QFocusEvent arg__1)

  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 `arg__1` 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`).

  See Also:
    `focusOutEvent`, `setFocusPolicy`, `keyPressEvent`, `keyReleaseEvent`, `event`, `QFocusEvent`

### focusNextPrevChild

    protected boolean focusNextPrevChild(boolean 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.

  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.

  See Also:
    `focusNextChild`, `focusPreviousChild`

### focusOutEvent

    protected void focusOutEvent(QFocusEvent arg__1)

  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 `arg__1` 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`).

  See Also:
    `focusInEvent`, `setFocusPolicy`, `keyPressEvent`, `keyReleaseEvent`, `event`, `QFocusEvent`

### heightForWidth

    public int heightForWidth(int arg__1)

  Returns the preferred height for this widget, given the width `arg__1`.

  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.

### hideEvent

    protected void hideEvent(QHideEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the `arg__1` 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`.

  See Also:
    `visible`, `event`, `QHideEvent`

### inputMethodEvent

    protected void inputMethodEvent(QInputMethodEvent arg__1)

  This event handler, for event `arg__1`, 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 `QInputMethodEvent` documentation for more details.

  See Also:
    `event`, `QInputMethodEvent`

### inputMethodQuery

    public java.lang.Object inputMethodQuery(Qt.InputMethodQuery arg__1)

  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.

  `arg__1` specifies which property is queried.

  See Also:
    `inputMethodEvent`, `QInputMethodEvent`, `QInputContext`

### keyPressEvent

    protected void keyPressEvent(QKeyEvent arg__1)

  This event handler, for event `arg__1`, 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 ignore() the event if you do not understand it, so that the widget's parent can interpret it.

  The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.

  See Also:
    `keyReleaseEvent`, `QKeyEvent::ignore`, `setFocusPolicy`, `focusInEvent`, `focusOutEvent`, `event`, `QKeyEvent`, Tetrix Example

### keyReleaseEvent

    protected void keyReleaseEvent(QKeyEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive key release events for the widget.

  A widget must accept focus initially and have focus in order to receive a key release event.

  If you reimplement this handler, it is very important that you ignore() the release if you do not understand it, so that the widget's parent can interpret it.

  The default implementation ignores the event.

  See Also:
    `keyPressEvent`, `QKeyEvent::ignore`, `setFocusPolicy`, `focusInEvent`, `focusOutEvent`, `event`, `QKeyEvent`

### leaveEvent

    protected void leaveEvent(QEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the `arg__1` parameter.

  A leave event is sent to the widget when the mouse cursor leaves the widget.

  See Also:
    `enterEvent`, `mouseMoveEvent`, `event`

### metric

    public int metric(QPaintDevice.PaintDeviceMetric arg__1)

  Internal implementation of the virtual QPaintDevice::metric() function.

  `arg__1` is the metric to get.

  Specified by:
    `metric` in interface `QPaintDeviceInterface`
  See Also:
    `PaintDeviceMetric`

### minimumSizeHint

    public QSize minimumSizeHint()

  Returns 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`.

  `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.

  See Also:
    `QSize::isValid`, `resize`, `setMinimumSize`, `sizePolicy`

### mouseDoubleClickEvent

    protected void mouseDoubleClickEvent(QMouseEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse double click events for the widget.

  The default implementation generates a normal mouse press event.

  Note that the widgets gets a `mousePressEvent` and a `mouseReleaseEvent` before the `mouseDoubleClickEvent`.

  See Also:
    `mousePressEvent`, `mouseReleaseEvent`, `mouseMoveEvent`, `event`, `QMouseEvent`

### mouseMoveEvent

    protected void mouseMoveEvent(QMouseEvent arg__1)

  This event handler, for event `arg__1`, 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.

  See Also:
    `setMouseTracking`, `mousePressEvent`, `mouseReleaseEvent`, `mouseDoubleClickEvent`, `event`, `QMouseEvent`, `Example`

### mousePressEvent

    protected void mousePressEvent(QMouseEvent arg__1)

  This event handler, for event `arg__1`, 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.

  See Also:
    `mouseReleaseEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `event`, `QMouseEvent`, `Example`

### mouseReleaseEvent

    protected void mouseReleaseEvent(QMouseEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive mouse release events for the widget.

  See Also:
    `mousePressEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `event`, `QMouseEvent`, `Example`

### moveEvent

    protected void moveEvent(QMoveEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget move events which are passed in the `arg__1` parameter. When the widget receives this event, it is already at the new position.

  The old position is accessible through QMoveEvent::oldPos().

  See Also:
    `resizeEvent`, `event`, `move`, `QMoveEvent`

### paintEngine

    public QPaintEngine paintEngine()

  Returns the widget's paint engine.

  Specified by:
    `paintEngine` in interface `QPaintDeviceInterface`

### paintEvent

    protected void paintEvent(QPaintEvent arg__1)

  This event handler can be reimplemented in a subclass to receive paint events which are passed in the `arg__1` parameter.

  A paint event is a request to repaint all or part of the widget. It can happen as a result of `repaint` or `update`, or because the widget was obscured and has now been uncovered, or for many other reasons.

  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()). `repaint` 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 that you're painting on the widget's background.

  The background can be set using `setBackgroundRole` and `setPalette`.

  From Qt 4.0, `QWidget` automatically double-buffers its painting, so there's no need to write double-buffering code in `paintEvent` to avoid flicker.

  Note: Under X11 it is possible to toggle the global double buffering by calling `qt_x11_set_global_double_buffer()`. Example usage:

          ...
          extern void qt_x11_set_global_double_buffer(bool);
          qt_x11_set_global_double_buffer(false);
          ...

  Note: In general, one should refrain from calling `update` or `repaint` inside of `paintEvent`. For example, calling `update` or `repaint` on children inside a `paintEvent` results in undefined behavior; the child may or may not get a paint event.

  See Also:
    `event`, `repaint`, `update`, `QPainter`, `QPixmap`, `QPaintEvent`, Analog Clock Example

### resizeEvent

    protected void resizeEvent(QResizeEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the `arg__1` 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.

  See Also:
    `moveEvent`, `event`, `resize`, `QResizeEvent`, `paintEvent`, `Example`

### setVisible

    public void setVisible(boolean visible)

  Sets whether the widget is visible to `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.

  See Also:
    `show`, `hide`, `isHidden`, `isVisibleTo`, `isMinimized`, `showEvent`, `hideEvent`

### showEvent

    protected void showEvent(QShowEvent arg__1)

  This event handler can be reimplemented in a subclass to receive widget show events which are passed in the `arg__1` 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`.

  See Also:
    `visible`, `event`, `QShowEvent`

### sizeHint

    public QSize sizeHint()

  Returns 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.

  See Also:
    `QSize::isValid`, `minimumSizeHint`, `sizePolicy`, `setMinimumSize`, `updateGeometry`

### tabletEvent

    protected void tabletEvent(QTabletEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive tablet events for the widget.

  If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

  The default implementation ignores the event.

  See Also:
    `QTabletEvent::ignore`, `QTabletEvent::accept`, `event`, `QTabletEvent`

### wheelEvent

    protected void wheelEvent(QWheelEvent arg__1)

  This event handler, for event `arg__1`, can be reimplemented in a subclass to receive wheel events for the widget.

  If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

  The default implementation ignores the event.

  See Also:
    `QWheelEvent::ignore`, `QWheelEvent::accept`, `event`, `QWheelEvent`

### keyboardGrabber

    public static QWidget keyboardGrabber()

  Returns the widget that is currently grabbing the keyboard input.

  If no widget in this application is currently grabbing the keyboard, 0 is returned.

  See Also:
    `grabMouse`, `mouseGrabber`

### mouseGrabber

    public static QWidget mouseGrabber()

  Returns the widget that is currently grabbing the mouse input.

  If no widget in this application is currently grabbing the mouse, 0 is returned.

  See Also:
    `grabMouse`, `keyboardGrabber`

### setTabOrder

    public static void setTabOrder(QWidget arg__1,
                                   QWidget arg__2)

  Moves the `arg__2` widget around the ring of focus widgets so that keyboard focus moves from the `arg__1` widget to the `arg__2` widget when the Tab key is pressed.

  Note that since the tab order of the `arg__2` widget is changed, you should order a chain like this:

          setTabOrder(a, b); // a to b
          setTabOrder(b, c); // a to b to c
          setTabOrder(c, d); // a to b to c to d

  not like this:

          // WRONG
          setTabOrder(c, d); // c to d
          setTabOrder(a, b); // a to b AND c to d
          setTabOrder(b, c); // a to b to c, but not c to d

  If `arg__1` or `arg__2` has a focus proxy, `setTabOrder` correctly substitutes the proxy.

  See Also:
    `setFocusPolicy`, `setFocusProxy`, Keyboard Focus

### fromNativePointer

    public static QWidget fromNativePointer(QNativePointer nativePointer)

  This function returns the QWidget instance pointed to by nativePointer

  Parameters:
    `nativePointer` - the QNativePointer of which object should be returned.

### getContentsMargins

    public final QContentsMargins getContentsMargins()

  Returns the widget's contents margins.

### setContentsMargins

    public final void setContentsMargins(QContentsMargins margins)

  Sets the `margins` around the contents of the widget. 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().

Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD