Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQWidget Class Reference

The TQWidget class is the base class of all user interface objects. More...

#include <qwidget.h>

Inherits TQObject and TQPaintDevice.

Inherited by TQAxWidget, TQButton, TQFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, TQDockArea, TQGLWidget, TQHeader, TQMainWindow, TQMotifWidget, TQNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, TQSplashScreen, TQStatusBar, TQTabBar, TQTabWidget, TQWorkspace, and TQXtWidget.

List of all member functions.

Public Members

Public Slots

Static Public Members

Properties

Protected Members


Detailed Description

The TQWidget 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 top-level widget. Usually, top-level widgets are windows with a frame and a title bar (although it is also possible to create top-level widgets without such decoration if suitable widget flags are used). In TQt, TQMainWindow and the various subclasses of TQDialog are the most common top-level windows.

A widget without a parent widget is always a top-level widget.

Non-top-level widgets are child widgets. These are child windows in their parent widgets. You cannot usually distinguish a child widget from its parent visually. Most other widgets in TQt are useful only as child widgets. (It is possible to make, say, a button into a top-level widget, but most people prefer to put their buttons inside other widgets, e.g. TQDialog.)

If you want to use a TQWidget to hold child widgets you will probably want to add a layout to the parent TQWidget. (See Layouts.)

TQWidget has many member functions, but some of them have little direct functionality: for example, TQWidget has a font property, but never uses this itself. There are many subclasses which provide real functionality, such as TQPushButton, TQListBox and TQTabDialog, etc.

Groups of functions:

Context Functions
Window functions show(), hide(), raise(), lower(), close().
Top level windows caption(), setCaption(), icon(), setIcon(), iconText(), setIconText(), isActiveWindow(), setActiveWindow(), showMinimized(). showMaximized(), showFullScreen(), showNormal().
Window contents update(), repaint(), erase(), scroll(), updateMask().
Geometry pos(), size(), rect(), x(), y(), width(), height(), sizePolicy(), setSizePolicy(), sizeHint(), updateGeometry(), layout(), move(), resize(), setGeometry(), frameGeometry(), geometry(), childrenRect(), adjustSize(), mapFromGlobal(), mapFromParent() mapToGlobal(), mapToParent(), maximumSize(), minimumSize(), sizeIncrement(), setMaximumSize(), setMinimumSize(), setSizeIncrement(), setBaseSize(), setFixedSize()
Mode isVisible(), isVisibleTo(), isMinimized(), isDesktop(), isEnabled(), isEnabledTo(), isModal(), isPopup(), isTopLevel(), setEnabled(), hasMouseTracking(), setMouseTracking(), isUpdatesEnabled(), setUpdatesEnabled(), clipRegion().
Look and feel style(), setStyle(), cursor(), setCursor() font(), setFont(), palette(), setPalette(), backgroundMode(), setBackgroundMode(), colorGroup(), fontMetrics(), fontInfo().
Keyboard focus
functions
isFocusEnabled(), setFocusPolicy(), focusPolicy(), hasFocus(), setFocus(), clearFocus(), setTabOrder(), setFocusProxy().
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().
Change handlers enabledChange(), fontChange(), paletteChange(), styleChange(), windowActivationChange().
System functions parentWidget(), topLevelWidget(), reparent(), polish(), winId(), find(), metric().
What's this help customWhatsThis()
Internal kernel
functions
focusNextPrevChild(), wmapper(), clearWFlags(), getWFlags(), setWFlags(), testWFlags().

Every widget's constructor accepts two or three standard arguments:

  1. TQWidget *parent = 0 is the parent of the new widget. If it is 0 (the default), the new widget will be a top-level window. If not, it will be a child of parent, and be constrained by parent's geometry (unless you specify WType_TopLevel as widget flag).
  2. const char *name = 0 is the widget name of the new widget. You can access it using name(). The widget name is little used by programmers but is quite useful with GUI builders such as TQt Designer (you can name a widget in TQt Designer, and connect() to it using the name in your code). The dumpObjectTree() debugging function also uses it.
  3. WFlags f = 0 (where available) sets the widget flags; the default is suitable for almost all widgets, but to get, for example, a top-level widget without a window system frame, you must use special flags.

The tictac/tictac.cpp example program is good example of a simple widget. It contains a few event handlers (as all widgets must), a few custom routines that are specific to it (as all useful widgets do), and has a few children and connections. Everything it does is done in response to an event: this is by far the most common way to design GUI applications.

You will need to supply the content for your widgets yourself, but here is a brief run-down of the events, starting with the most common ones:

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

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

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

There are also some rather obscure events. They are listed in qevent.h and you need to reimplement event() to handle them. The default implementation of event() handles Tab and Shift+Tab (to move the keyboard focus), and passes on most other events to one of the more specialized handlers above.

When implementing a widget, there are a few more things to consider.

See also TQEvent, TQPainter, TQGridLayout, TQBoxLayout, and Abstract Widget Classes.


Member Type Documentation

TQWidget::BackgroundOrigin

This enum defines the origin used to draw a widget's background pixmap.

The pixmap is drawn using the:

TQWidget::FocusPolicy

This enum type defines the various policies a widget can have with respect to actquiring keyboard focus.


Member Function Documentation

explicit TQWidget::TQWidget ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Constructs a widget which is a child of parent, with the name name and widget flags set to f.

If parent is 0, the new widget becomes a top-level window. If parent is another widget, this widget becomes a child window inside parent. The new widget is deleted when its parent is deleted.

The name is sent to the TQObject constructor.

The widget flags argument, f, is normally 0, but it can be set to customize the window frame of a top-level widget (i.e. parent must be 0). To customize the frame, set the WStyle_Customize flag OR'ed with any of the TQt::WidgetFlags.

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 TQt may not be able to deliver all combinations of style flags on all systems. This is because on X11, TQt can only ask the window manager, and the window manager can override the application's settings. On Windows, TQt can set whatever flags you want.

Example:

    TQLabel *splashScreen = new TQLabel( 0, "mySplashScreen",
                                WStyle_Customize | WStyle_Splash );
    

TQWidget::~TQWidget ()

Destroys the widget.

All this widget's children are deleted first. The application exits if this widget is the main widget.

bool TQWidget::acceptDrops () const

Returns TRUE if drop events are enabled for this widget; otherwise returns FALSE. See the "acceptDrops" property for details.

void TQWidget::adjustSize () [virtual slot]

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 (the union of all child widget geometries).

See also sizeHint and childrenRect.

Example: xform/xform.cpp.

Reimplemented in TQMessageBox.

bool TQWidget::autoMask () const

Returns TRUE if the auto mask feature is enabled for the widget; otherwise returns FALSE. See the "autoMask" property for details.

const TQBrush & TQWidget::backgroundBrush () const

Returns the widget's background brush. See the "backgroundBrush" property for details.

const TQColor & TQWidget::backgroundColor () const

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use paletteBackgroundColor() or eraseColor() instead.

BackgroundMode TQWidget::backgroundMode () const

Returns the color role used for painting the background of the widget. See the "backgroundMode" property for details.

BackgroundOrigin TQWidget::backgroundOrigin () const

Returns the origin of the widget's background. See the "backgroundOrigin" property for details.

const TQPixmap * TQWidget::backgroundPixmap () const

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use paletteBackgroundPixmap() or erasePixmap() instead.

Examples: themes/metal.cpp and themes/wood.cpp.

TQSize TQWidget::baseSize () const

Returns the base size of the widget. See the "baseSize" property for details.

TQString TQWidget::caption () const

Returns the window caption (title). See the "caption" property for details.

TQWidget * TQWidget::childAt ( int x, int y, bool includeThis = FALSE ) const

Returns the visible child widget at pixel position (x, y) in the widget's own coordinate system.

If includeThis is TRUE, and there is no child visible at (x, y), the widget itself is returned.

TQWidget * TQWidget::childAt ( const TQPoint & p, bool includeThis = FALSE ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

If includeThis is TRUE, and there is no child visible at p, the widget itself is returned.

TQRect TQWidget::childrenRect () const

Returns the bounding rectangle of the widget's children. See the "childrenRect" property for details.

TQRegion TQWidget::childrenRegion () const

Returns the combined region occupied by the widget's children. See the "childrenRegion" property for details.

void TQWidget::clearFocus () [slot]

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 focus, setFocus(), focusInEvent(), focusOutEvent(), focusPolicy, and TQApplication::focusWidget().

void TQWidget::clearMask ()

Removes any mask set by setMask().

See also setMask().

void TQWidget::clearWFlags ( WFlags f ) [protected]

Clears the widget flags f.

Widget flags are a combination of TQt::WidgetFlags.

See also testWFlags(), getWFlags(), and setWFlags().

TQRegion TQWidget::clipRegion () const

Returns the unobscured region where paint events can occur.

For visible widgets, this is an approximation of the area not covered by other widgets; otherwise, this is an empty region.

The repaint() function calls this function if necessary, so in general you do not need to call it.

bool TQWidget::close () [slot]

Closes this widget. Returns TRUE if the widget was closed; otherwise returns FALSE.

First it sends the widget a TQCloseEvent. The widget is hidden if it accepts the close event. The default implementation of TQWidget::closeEvent() accepts the close event.

The TQApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.

Examples: dialog/mainwindow.cpp, mdi/application.cpp, popup/popup.cpp, and toplevel/options.ui.h.

bool TQWidget::close ( bool alsoDelete ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Closes this widget. Returns TRUE if the widget was closed; otherwise returns FALSE.

If alsoDelete is TRUE or the widget has the WDestructiveClose widget flag, the widget is also deleted. The widget can prevent itself from being closed by rejecting the TQCloseEvent it gets. A close events is delivered to the widget no matter if the widget is visible or not.

The TQApplication::lastWindowClosed() signal is emitted when the last visible top level widget is closed.

Note that closing the TQApplication::mainWidget() terminates the application.

See also closeEvent(), TQCloseEvent, hide(), TQApplication::quit(), TQApplication::setMainWidget(), and TQApplication::lastWindowClosed().

void TQWidget::closeEvent ( TQCloseEvent * e ) [virtual protected]

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

The default implementation calls e->accept(), which hides this widget. See the TQCloseEvent documentation for more details.

See also event(), hide(), close(), and TQCloseEvent.

Examples: action/application.cpp, application/application.cpp, chart/chartform.cpp, i18n/mywidget.cpp, mdi/application.cpp, popup/popup.cpp, and qwerty/qwerty.cpp.

const TQColorGroup & TQWidget::colorGroup () const

Returns the current color group of the widget palette. See the "colorGroup" property for details.

void TQWidget::constPolish () const [slot]

Ensures that the widget is properly initialized by calling polish().

Call constPolish() from functions like sizeHint() that depends on the widget being initialized, and that may be called before show().

Warning: Do not call constPolish() on a widget from inside that widget's constructor.

See also polish().

void TQWidget::contextMenuEvent ( TQContextMenuEvent * e ) [virtual protected]

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

The default implementation calls e->ignore(), which rejects the context event. See the TQContextMenuEvent documentation for more details.

See also event() and TQContextMenuEvent.

Example: menu/menu.cpp.

void TQWidget::create ( WId window = 0, bool initializeWindow = TRUE, bool destroyOldWindow = TRUE ) [virtual protected]

Creates a new widget window if window is 0, otherwise sets the widget's window to window.

Initializes the window (sets the geometry etc.) if initializeWindow is TRUE. If initializeWindow is FALSE, no initialization is performed. This parameter only makes sense if window is a valid window.

Destroys the old window if destroyOldWindow is TRUE. If destroyOldWindow is FALSE, you are responsible for destroying the window yourself (using platform native code).

The TQWidget constructor calls create(0,TRUE,TRUE) to create a window for this widget.

const TQCursor & TQWidget::cursor () const

Returns the cursor shape for this widget. See the "cursor" property for details.

bool TQWidget::customWhatsThis () const [virtual]

Returns TRUE if the widget wants to handle What's This help manually; otherwise returns FALSE. See the "customWhatsThis" property for details.

void TQWidget::destroy ( bool destroyWindow = TRUE, bool destroySubWindows = TRUE ) [virtual protected]

Frees up window system resources. Destroys the widget window if destroyWindow is TRUE.

destroy() calls itself recursively for all the child widgets, passing destroySubWindows for the destroyWindow parameter. To have more control over destruction of subwidgets, destroy subwidgets selectively first.

This function is usually called from the TQWidget destructor.

void TQWidget::dragEnterEvent ( TQDragEnterEvent * ) [virtual protected]

This event handler is called when a drag is in progress and the mouse enters this widget.

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

See also TQTextDrag, TQImageDrag, and TQDragEnterEvent.

Example: iconview/simple_dd/main.cpp.

void TQWidget::dragLeaveEvent ( TQDragLeaveEvent * ) [virtual protected]

This event handler is called when a drag is in progress and the mouse leaves this widget.

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

See also TQTextDrag, TQImageDrag, and TQDragLeaveEvent.

void TQWidget::dragMoveEvent ( TQDragMoveEvent * ) [virtual protected]

This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget.

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

See also TQTextDrag, TQImageDrag, and TQDragMoveEvent.

void TQWidget::drawText ( int x, int y, const TQString & str )

Draws the string str at position (x, y).

The y position is the base line position of the text. The text is drawn using the default font and the default foreground color.

This function is provided for convenience. You will generally get more flexible results and often higher speed by using a a painter instead.

See also font, foregroundColor(), and TQPainter::drawText().

void TQWidget::drawText ( const TQPoint & pos, const TQString & str )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Draws the string str at position pos.

void TQWidget::dropEvent ( TQDropEvent * ) [virtual protected]

This event handler is called when the drag is dropped on this widget.

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

See also TQTextDrag, TQImageDrag, and TQDropEvent.

Example: iconview/simple_dd/main.cpp.

void TQWidget::enabledChange ( bool oldEnabled ) [virtual protected]

This virtual function is called from setEnabled(). oldEnabled is the previous setting; you can get the new setting from isEnabled().

Reimplement this function if your widget needs to know when it becomes enabled or disabled. You will almost certainly need to update the widget using update().

The default implementation repaints the visible part of the widget.

See also enabled, enabled, repaint(), update(), and clipRegion().

void TQWidget::enterEvent ( TQEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget enter events.

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

See also leaveEvent(), mouseMoveEvent(), and event().

void TQWidget::erase ( int x, int y, int w, int h )

Erases the specified area (x, y, w, h) in the widget without generating a paint event.

If w is negative, it is replaced with width() - x. If h is negative, it is replaced width height() - y.

Child widgets are not affected.

See also repaint().

void TQWidget::erase ()

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This version erases the entire widget.

void TQWidget::erase ( const TQRect & r )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Erases the specified area r in the widget without generating a paint event.

void TQWidget::erase ( const TQRegion & reg )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Erases the area defined by reg, without generating a paint event.

Child widgets are not affected.

const TQColor & TQWidget::eraseColor () const

Returns the erase color of the widget.

See also setEraseColor(), setErasePixmap(), and backgroundColor().

const TQPixmap * TQWidget::erasePixmap () const

Returns the widget's erase pixmap.

See also setErasePixmap() and eraseColor().

bool TQWidget::event ( TQEvent * e ) [virtual protected]

This is the main event handler; it handles event e. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.

Key press 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().

This function returns TRUE if it is able to pass the event over to someone (i.e. someone wanted the event); otherwise returns FALSE.

See also closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), TQObject::event(), and TQObject::timerEvent().

Reimplemented from TQObject.

TQWidget * TQWidget::find ( WId id ) [static]

Returns a pointer to the widget with window identifer/handle id.

The window identifier type depends on the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, 0 is returned.

TQFocusData * TQWidget::focusData () [protected]

Returns the focus data for this widget's top-level widget.

Focus data always belongs to the top-level widget. The focus data list contains all the widgets in this top-level widget that can accept focus, in tab order. An iterator points to the current focus widget (focusWidget() returns a pointer to this widget).

This information is useful for implementing advanced versions of focusNextPrevChild().

void TQWidget::focusInEvent ( TQFocusEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.

A widget normally must setFocusPolicy() to something other than 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 toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

See also focusOutEvent(), focusPolicy, keyPressEvent(), keyReleaseEvent(), event(), and TQFocusEvent.

bool TQWidget::focusNextPrevChild ( bool next ) [virtual protected]

Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns TRUE if is can find a new widget and FALSE if it can't,

If next is TRUE, this function searches "forwards", if next is FALSE, it searches "backwards".

Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its "current active link" forwards or backwards, and call TQWidget::focusNextPrevChild() only when it reaches the last or first link on the "page".

Child widgets call focusNextPrevChild() on their parent widgets, but only the top-level widget decides where to redirect focus. By overriding this method for an object, you thus gain control of focus traversal for all child widgets.

Warning: TQScrollView uses it own logic for this function, which does the right thing in most cases. But if you are using a TQScrollView and want complete control of the focus chain you'll need to override TQScrollView::focusNextPrevChild() and your top-level widgets' focusNextPrevChild() functions.

See also focusData().

void TQWidget::focusOutEvent ( TQFocusEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget.

A widget normally must setFocusPolicy() to something other than 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 toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

See also focusInEvent(), focusPolicy, keyPressEvent(), keyReleaseEvent(), event(), and TQFocusEvent.

Example: qmag/qmag.cpp.

FocusPolicy TQWidget::focusPolicy () const

Returns the way the widget accepts keyboard focus. See the "focusPolicy" property for details.

TQWidget * TQWidget::focusProxy () const

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

See also setFocusProxy().

TQWidget * TQWidget::focusWidget () const

Returns the focus widget in this widget's window. This is not the same as TQApplication::focusWidget(), which returns the focus widget in the currently active window.

TQFont TQWidget::font () const

Returns the font currently set for the widget. See the "font" property for details.

void TQWidget::fontChange ( const TQFont & oldFont ) [virtual protected]

This virtual function is called from setFont(). oldFont is the previous font; you can get the new font from font().

Reimplement this function if your widget needs to know when its font changes. You will almost certainly need to update the widget using update().

The default implementation updates the widget including its geometry.

See also font, font, update(), and updateGeometry().

TQFontInfo TQWidget::fontInfo () const

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

See also font, fontMetrics(), and font.

TQFontMetrics TQWidget::fontMetrics () const

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

See also font, fontInfo(), and font.

Examples: drawdemo/drawdemo.cpp and qmag/qmag.cpp.

const TQColor & TQWidget::foregroundColor () const

Same as paletteForegroundColor()

TQRect TQWidget::frameGeometry () const

Returns geometry of the widget relative to its parent including any window frame. See the "frameGeometry" property for details.

TQSize TQWidget::frameSize () const

Returns the size of the widget including any window frame. See the "frameSize" property for details.

const TQRect & TQWidget::geometry () const

Returns the geometry of the widget relative to its parent and excluding the window frame. See the "geometry" property for details.

WFlags TQWidget::getWFlags () const [protected]

Returns the widget flags for this this widget.

Widget flags are a combination of TQt::WidgetFlags.

See also testWFlags(), setWFlags(), and clearWFlags().

void TQWidget::grabKeyboard ()

Grabs the keyboard input.

This widget reveives 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(), and focusWidget().

void TQWidget::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 TQt, as TQt grabs and releases it sensibly. In particular, TQt 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().

See also releaseMouse(), grabKeyboard(), releaseKeyboard(), grabKeyboard(), and focusWidget().

void TQWidget::grabMouse ( const TQCursor & cursor )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Grabs the mouse input and changes the cursor shape.

The cursor will assume shape cursor (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(), and cursor.

bool TQWidget::hasFocus () const

Returns TRUE if this widget (or its focus proxy) has the keyboard input focus; otherwise returns FALSE. See the "focus" property for details.

bool TQWidget::hasMouse () const

Returns TRUE if the widget is under the mouse cursor; otherwise returns FALSE. See the "underMouse" property for details.

bool TQWidget::hasMouseTracking () const

Returns TRUE if mouse tracking is enabled for the widget; otherwise returns FALSE. See the "mouseTracking" property for details.

int TQWidget::height () const

Returns the height of the widget excluding any window frame. See the "height" property for details.

int TQWidget::heightForWidth ( int w ) const [virtual]

Returns the preferred height for this widget, given the width w. The default implementation returns 0, indicating that the preferred height does not depend on the width.

Warning: Does not look at the widget's layout.

Reimplemented in TQMenuBar and TQTextEdit.

void TQWidget::hide () [virtual slot]

Hides the widget.

You almost never have to reimplement this function. If you need to do something after a widget is hidden, use hideEvent() instead.

See also hideEvent(), hidden, show(), showMinimized(), visible, and close().

Examples: mdi/application.cpp, popup/popup.cpp, progress/progress.cpp, scrollview/scrollview.cpp, webbrowser/mainwindow.ui.h, and xform/xform.cpp.

Reimplemented in TQMenuBar.

void TQWidget::hideEvent ( TQHideEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget hide events.

Hide events are sent to widgets immediately after they have been hidden.

See also event() and TQHideEvent.

Reimplemented in TQScrollBar.

const TQPixmap * TQWidget::icon () const

Returns the widget's icon. See the "icon" property for details.

TQString TQWidget::iconText () const

Returns the widget's icon text. See the "iconText" property for details.

void TQWidget::iconify () [slot]

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

void TQWidget::imComposeEvent ( TQIMEvent * e ) [virtual protected]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user has entered some text using an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the TQIMEvent documentation for more details.

See also event() and TQIMEvent.

void TQWidget::imEndEvent ( TQIMEvent * e ) [virtual protected]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user has finished inputting text via an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the TQIMEvent documentation for more details.

See also event() and TQIMEvent.

void TQWidget::imStartEvent ( TQIMEvent * e ) [virtual protected]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user begins entering text using an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the TQIMEvent documentation for more details.

See also event() and TQIMEvent.

bool TQWidget::isActiveWindow () const

Returns TRUE if this widget is the active window; otherwise returns FALSE. See the "isActiveWindow" property for details.

bool TQWidget::isDesktop () const

Returns TRUE if the widget is a desktop widget, i.e. represents the desktop; otherwise returns FALSE. See the "isDesktop" property for details.

bool TQWidget::isDialog () const

Returns TRUE if the widget is a dialog widget; otherwise returns FALSE. See the "isDialog" property for details.

bool TQWidget::isEnabled () const

Returns TRUE if the widget is enabled; otherwise returns FALSE. See the "enabled" property for details.

bool TQWidget::isEnabledTo ( TQWidget * ancestor ) const

Returns TRUE if this widget would become enabled if ancestor is enabled; otherwise returns FALSE.

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

isEnabledTo(0) is equivalent to isEnabled().

See also enabled and enabled.

bool TQWidget::isEnabledToTLW () const

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

This function is deprecated. It is equivalent to isEnabled()

bool TQWidget::isFocusEnabled () const

Returns TRUE if the widget accepts keyboard focus; otherwise returns FALSE. See the "focusEnabled" property for details.

bool TQWidget::isFullScreen () const

Returns TRUE if the widget is full screen; otherwise returns FALSE. See the "fullScreen" property for details.

bool TQWidget::isHidden () const

Returns TRUE if the widget is explicitly hidden; otherwise returns FALSE. See the "hidden" property for details.

bool TQWidget::isInputMethodEnabled () const

Returns enables or disables the use of input methods for this widget. See the "inputMethodEnabled" property for details.

bool TQWidget::isMaximized () const

Returns TRUE if this widget is maximized; otherwise returns FALSE. See the "maximized" property for details.

bool TQWidget::isMinimized () const

Returns TRUE if this widget is minimized (iconified); otherwise returns FALSE. See the "minimized" property for details.

bool TQWidget::isModal () const

Returns TRUE if the widget is a modal widget; otherwise returns FALSE. See the "isModal" property for details.

bool TQWidget::isPopup () const

Returns TRUE if the widget is a popup widget; otherwise returns FALSE. See the "isPopup" property for details.

bool TQWidget::isShown () const

Returns TRUE if the widget is shown; otherwise returns FALSE. See the "shown" property for details.

bool TQWidget::isTopLevel () const

Returns TRUE if the widget is a top-level widget; otherwise returns FALSE. See the "isTopLevel" property for details.

bool TQWidget::isUpdatesEnabled () const

Returns TRUE if updates are enabled; otherwise returns FALSE. See the "updatesEnabled" property for details.

bool TQWidget::isVisible () const

Returns TRUE if the widget is visible; otherwise returns FALSE. See the "visible" property for details.

bool TQWidget::isVisibleTo ( TQWidget * ancestor ) const

Returns TRUE if this widget would become visible if ancestor is shown; otherwise returns FALSE.

The TRUE case occurs if neither the widget itself nor any parent up to but excluding ancestor has been explicitly hidden.

This function will still return TRUE if the widget is obscured by other windows on the screen, but could be physically visible if it or they were to be moved.

isVisibleTo(0) is identical to isVisible().

See also show(), hide(), and visible.

bool TQWidget::isVisibleToTLW () const

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

This function is deprecated. It is equivalent to isVisible()

void TQWidget::keyPressEvent ( TQKeyEvent * e ) [virtual protected]

This event handler, for event e, 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 explicitly ignore the event if you do not understand it, so that the widget's parent can interpret it; otherwise, the event will be implicitly accepted. Although top-level widgets are able to choose whether to accept or ignore unknown events because they have no parent widgets that could otherwise handle them, it is good practice to explicitly ignore events to make widgets as reusable as possible.

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

See also keyReleaseEvent(), TQKeyEvent::ignore(), focusPolicy, focusInEvent(), focusOutEvent(), event(), and TQKeyEvent.

Example: picture/picture.cpp.

Reimplemented in TQLineEdit and TQTextEdit.

void TQWidget::keyReleaseEvent ( TQKeyEvent * e ) [virtual protected]

This event handler, for event e, 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(), TQKeyEvent::ignore(), focusPolicy, focusInEvent(), focusOutEvent(), event(), and TQKeyEvent.

TQWidget * TQWidget::keyboardGrabber () [static]

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() and mouseGrabber().

TQLayout * TQWidget::layout () const

Returns the layout engine that manages the geometry of this widget's children.

If the widget does not have a layout, layout() returns 0.

See also sizePolicy.

Examples: chart/optionsform.cpp and fonts/simple-qfont-demo/viewer.cpp.

void TQWidget::leaveEvent ( TQEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget leave events.

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

See also enterEvent(), mouseMoveEvent(), and event().

void TQWidget::lower () [slot]

Lowers the widget to the bottom of the parent widget's stack.

After this call the widget will be visually behind (and therefore obscured by) any overlapping sibling widgets.

See also raise() and stackUnder().

bool TQWidget::macEvent ( MSG * ) [virtual protected]

This special event handler can be reimplemented in a subclass to receive native Macintosh events.

In your reimplementation of this function, if you want to stop the event being handled by TQt, return TRUE. If you return FALSE, this native event is passed back to TQt, which translates the event into a TQt event and sends it to the widget.

Warning: This function is not portable.

See also TQApplication::macEventFilter().

TQPoint TQWidget::mapFrom ( TQWidget * parent, const TQPoint & pos ) const

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

See also mapTo(), mapFromParent(), mapFromGlobal(), and underMouse.

TQPoint TQWidget::mapFromGlobal ( const TQPoint & pos ) const

Translates the global screen coordinate pos to widget coordinates.

See also mapToGlobal(), mapFrom(), and mapFromParent().

TQPoint TQWidget::mapFromParent ( const TQPoint & pos ) const

Translates the parent widget coordinate pos to widget coordinates.

Same as mapFromGlobal() if the widget has no parent.

See also mapToParent(), mapFrom(), mapFromGlobal(), and underMouse.

TQPoint TQWidget::mapTo ( TQWidget * parent, const TQPoint & pos ) const

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

See also mapFrom(), mapToParent(), mapToGlobal(), and underMouse.

TQPoint TQWidget::mapToGlobal ( const TQPoint & pos ) const

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

See also mapFromGlobal(), mapTo(), and mapToParent().

Example: scribble/scribble.cpp.

TQPoint TQWidget::mapToParent ( const TQPoint & pos ) const

Translates the widget coordinate pos to a coordinate in the parent widget.

Same as mapToGlobal() if the widget has no parent.

See also mapFromParent(), mapTo(), mapToGlobal(), and underMouse.

int TQWidget::maximumHeight () const

Returns the widget's maximum height. See the "maximumHeight" property for details.

TQSize TQWidget::maximumSize () const

Returns the widget's maximum size. See the "maximumSize" property for details.

int TQWidget::maximumWidth () const

Returns the widget's maximum width. See the "maximumWidth" property for details.

int TQWidget::metric ( int m ) const [virtual protected]

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

Use the TQPaintDeviceMetrics class instead.

m is the metric to get.

TQRect TQWidget::microFocusHint () const

Returns the currently set micro focus hint for this widget. See the "microFocusHint" property for details.

int TQWidget::minimumHeight () const

Returns the widget's minimum height. See the "minimumHeight" property for details.

TQSize TQWidget::minimumSize () const

Returns the widget's minimum size. See the "minimumSize" property for details.

TQSize TQWidget::minimumSizeHint () const [virtual]

Returns the recommended minimum size for the widget. See the "minimumSizeHint" property for details.

Reimplemented in TQLineEdit.

int TQWidget::minimumWidth () const

Returns the widget's minimum width. See the "minimumWidth" property for details.

void TQWidget::mouseDoubleClickEvent ( TQMouseEvent * e ) [virtual protected]

This event handler, for event e, 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(), and TQMouseEvent.

TQWidget * TQWidget::mouseGrabber () [static]

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() and keyboardGrabber().

void TQWidget::mouseMoveEvent ( TQMouseEvent * e ) [virtual protected]

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

TQMouseEvent::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 TQt.

See also mouseTracking, mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), and TQMouseEvent.

Examples: aclock/aclock.cpp, drawlines/connect.cpp, iconview/simple_dd/main.cpp, life/life.cpp, popup/popup.cpp, qmag/qmag.cpp, and scribble/scribble.cpp.

Reimplemented in TQSizeGrip.

void TQWidget::mousePressEvent ( TQMouseEvent * e ) [virtual protected]

This event handler, for event e, 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(), and TQMouseEvent.

Examples: biff/biff.cpp, drawlines/connect.cpp, iconview/simple_dd/main.cpp, life/life.cpp, qmag/qmag.cpp, scribble/scribble.cpp, and tooltip/tooltip.cpp.

Reimplemented in TQSizeGrip.

void TQWidget::mouseReleaseEvent ( TQMouseEvent * e ) [virtual protected]

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

See also mouseDoubleClickEvent(), mouseMoveEvent(), event(), and TQMouseEvent.

Examples: drawlines/connect.cpp, hello/hello.cpp, popup/popup.cpp, qmag/qmag.cpp, scribble/scribble.cpp, showimg/showimg.cpp, and t14/cannon.cpp.

void TQWidget::move ( const TQPoint & ) [slot]

Sets the position of the widget within its parent widget. See the "pos" property for details.

void TQWidget::move ( int x, int y ) [virtual slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This corresponds to move( TQPoint(x, y) ).

void TQWidget::moveEvent ( TQMoveEvent * ) [virtual protected]

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

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

See also resizeEvent(), event(), pos, and TQMoveEvent.

bool TQWidget::ownCursor () const

Returns TRUE if the widget uses its own cursor; otherwise returns FALSE. See the "ownCursor" property for details.

bool TQWidget::ownFont () const

Returns TRUE if the widget uses its own font; otherwise returns FALSE. See the "ownFont" property for details.

bool TQWidget::ownPalette () const

Returns TRUE if the widget uses its own palette; otherwise returns FALSE. See the "ownPalette" property for details.

void TQWidget::paintEvent ( TQPaintEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive paint events.

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: TQPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. TQListView and TQCanvas do this, for example.

TQt 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, TQt merges these events into one event with a larger region (see TQRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.

When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and TQPaintEvent::erased() tells you whether the widget has been erased or not.

The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.

See also event(), repaint(), update(), TQPainter, TQPixmap, and TQPaintEvent.

Examples: drawlines/connect.cpp, forever/forever.cpp, qmag/qmag.cpp, scribble/scribble.cpp, splitter/splitter.cpp, t8/cannon.cpp, and t9/cannon.cpp.

Reimplemented in TQButton, TQFrame, TQGLWidget, TQSizeGrip, TQStatusBar, and TQTabBar.

const TQPalette & TQWidget::palette () const

Returns the widget's palette. See the "palette" property for details.

const TQColor & TQWidget::paletteBackgroundColor () const

Returns the background color of the widget. See the "paletteBackgroundColor" property for details.

const TQPixmap * TQWidget::paletteBackgroundPixmap () const

Returns the background pixmap of the widget. See the "paletteBackgroundPixmap" property for details.

void TQWidget::paletteChange ( const TQPalette & oldPalette ) [virtual protected]

This virtual function is called from setPalette(). oldPalette is the previous palette; you can get the new palette from palette().

Reimplement this function if your widget needs to know when its palette changes.

See also palette and palette.

const TQColor & TQWidget::paletteForegroundColor () const

Returns the foreground color of the widget. See the "paletteForegroundColor" property for details.

TQWidget * TQWidget::parentWidget ( bool sameWindow = FALSE ) const

Returns the parent of this widget, or 0 if it does not have any parent widget. If sameWindow is TRUE and the widget is top level returns 0; otherwise returns the widget's parent.

Example: mdi/application.cpp.

void TQWidget::polish () [virtual slot]

Delayed initialization of a widget.

This function will be called after a widget has been fully created and before it is shown the very first time.

Polishing is useful for final initialization which depends on having an instantiated widget. This is something a constructor cannot guarantee since the initialization of the subclasses might not be finished.

After this function, the widget has a proper font and palette and TQApplication::polish() has been called.

Remember to call TQWidget's implementation first when reimplementing this function to ensure that your program does not end up in infinite recursion.

See also constPolish() and TQApplication::polish().

Example: menu/menu.cpp.

TQPoint TQWidget::pos () const

Returns the position of the widget within its parent widget. See the "pos" property for details.

bool TQWidget::qwsEvent ( TQWSEvent * ) [virtual protected]

This special event handler can be reimplemented in a subclass to receive native TQt/Embedded events.

In your reimplementation of this function, if you want to stop the event being handled by TQt, return TRUE. If you return FALSE, this native event is passed back to TQt, which translates the event into a TQt event and sends it to the widget.

Warning: This function is not portable.

See also TQApplication::qwsEventFilter().

void TQWidget::raise () [slot]

Raises this widget to the top of the parent widget's stack.

After this call the widget will be visually in front of any overlapping sibling widgets.

See also lower() and stackUnder().

Example: showimg/showimg.cpp.

void TQWidget::recreate ( TQWidget * parent, WFlags f, const TQPoint & p, bool showIt = FALSE )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

This method is provided to aid porting from TQt 1.0 to 2.0. It has been renamed reparent() in TQt 2.0.

TQRect TQWidget::rect () const

Returns the internal geometry of the widget excluding any window frame. See the "rect" property for details.

void TQWidget::releaseKeyboard ()

Releases the keyboard grab.

See also grabKeyboard(), grabMouse(), and releaseMouse().

void TQWidget::releaseMouse ()

Releases the mouse grab.

See also grabMouse(), grabKeyboard(), and releaseKeyboard().

void TQWidget::repaint ( int x, int y, int w, int h, bool erase = TRUE ) [slot]

Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden.

If erase is TRUE, TQt erases the area (x, y, w, h) before the paintEvent() call.

If w is negative, it is replaced with width() - x, and if h is negative, it is replaced width height() - y.

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 TQt 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(), updatesEnabled, and erase().

Example: qwerty/qwerty.cpp.

void TQWidget::repaint () [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This version erases and repaints the entire widget.

void TQWidget::repaint ( bool erase ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This version repaints the entire widget.

void TQWidget::repaint ( const TQRect & r, bool erase = TRUE ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Repaints the widget directly by calling paintEvent() directly, unless updates are disabled or the widget is hidden.

Erases the widget region r if erase is TRUE.

void TQWidget::repaint ( const TQRegion & reg, bool erase = TRUE ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Repaints the widget directly by calling paintEvent() directly, unless updates are disabled or the widget is hidden.

Erases the widget region reg if erase is TRUE.

Only use repaint if your widget needs to be repainted immediately, for example when doing some animation. In all other cases, use update(). Calling update() many times in a row will generate a single paint event.

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(), updatesEnabled, and erase().

void TQWidget::reparent ( TQWidget * parent, WFlags f, const TQPoint & p, bool showIt = FALSE ) [virtual]

Reparents the widget. The widget gets a new parent, new widget flags (f, but as usual, use 0) at a new position in its new parent (p).

If showIt is TRUE, show() is called once the widget has been reparented.

If the new parent widget is in a different top-level widget, 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, reparent() calls clearFocus() for that widget.

If the new parent widget is in the same top-level widget as the old parent, reparent doesn't change the tab order or keyboard focus.

Warning: It is extremely unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use TQWidgetStack or TQWizard.

See also getWFlags().

Example: toplevel/options.ui.h.

void TQWidget::reparent ( TQWidget * parent, const TQPoint & p, bool showIt = FALSE )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

A convenience version of reparent that does not take widget flags as argument.

Calls reparent(parent, getWFlags() & ~WType_Mask, p, showIt).

void TQWidget::resetInputContext () [protected]

This function is called when the user finishes input composition, e.g. changes focus to another widget, moves the cursor, etc.

void TQWidget::resize ( const TQSize & ) [slot]

Sets the size of the widget excluding any window frame. See the "size" property for details.

void TQWidget::resize ( int w, int h ) [virtual slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This corresponds to resize( TQSize(w, h) ).

void TQWidget::resizeEvent ( TQResizeEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through TQResizeEvent::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.

Widgets that have been created with the WNoAutoErase flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.

The default implementation calls updateMask() if the widget has automatic masking enabled.

See also moveEvent(), event(), size, TQResizeEvent, and paintEvent().

Examples: drawdemo/drawdemo.cpp, menu/menu.cpp, qmag/qmag.cpp, scribble/scribble.cpp, showimg/showimg.cpp, tooltip/tooltip.cpp, and xform/xform.cpp.

Reimplemented in TQFrame and TQGLWidget.

void TQWidget::scroll ( int dx, int dy )

Scrolls the widget including its children dx pixels to the right and dy downwards. Both dx and dy may be negative.

After scrolling, scroll() sends a paint event for the the part that is read but not written. For example, when scrolling 10 pixels rightwards, the leftmost ten pixels of the widget need repainting. The paint event may be delivered immediately or later, depending on some heuristics (note that you might have to force processing of paint events using TQApplication::sendPostedEvents() when using scroll() and move() in combination).

See also TQScrollView, erase(), and bitBlt().

void TQWidget::scroll ( int dx, int dy, const TQRect & r )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

If r is empty or invalid, the result is undefined.

See also TQScrollView, erase(), and bitBlt().

void TQWidget::setAcceptDrops ( bool on ) [virtual]

Sets whether drop events are enabled for this widget to on. See the "acceptDrops" property for details.

void TQWidget::setActiveWindow () [virtual]

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 setActiveWindow() 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 flash the task bar entry blue to indicate that the window has done something. This is because Microsoft do not allow an application to interrupt what the user is currently doing in another application.

See also isActiveWindow, topLevelWidget(), and show().

Reimplemented in TQXtWidget.

void TQWidget::setAutoMask ( bool ) [virtual]

Sets whether the auto mask feature is enabled for the widget. See the "autoMask" property for details.

void TQWidget::setBackgroundColor ( const TQColor & c ) [virtual]

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use setPaletteBackgroundColor() or setEraseColor() instead.

Examples: customlayout/main.cpp, desktop/desktop.cpp, hello/main.cpp, movies/main.cpp, and splitter/splitter.cpp.

void TQWidget::setBackgroundMode ( BackgroundMode ) [virtual]

Sets the color role used for painting the background of the widget. See the "backgroundMode" property for details.

void TQWidget::setBackgroundMode ( BackgroundMode m, BackgroundMode visual )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the widget's own background mode to m and the visual background mode to visual. The visual background mode is used with the designable properties backgroundColor, foregroundColor and backgroundPixmap.

For complex controls, the logical background mode sometimes differs from a widget's own background mode. A spinbox for example has PaletteBackground as background mode (typically dark gray), while it's embedded lineedit control uses PaletteBase (typically white). Since the lineedit covers most of the visual area of a spinbox, it defines PaletteBase to be its visual background mode. Changing the backgroundColor property thus changes the lineedit control's background, which is exactly what the user expects in TQt Designer.

void TQWidget::setBackgroundOrigin ( BackgroundOrigin ) [virtual]

Sets the origin of the widget's background. See the "backgroundOrigin" property for details.

void TQWidget::setBackgroundPixmap ( const TQPixmap & pm ) [virtual]

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. Use setPaletteBackgroundPixmap() or setErasePixmap() instead.

Example: desktop/desktop.cpp.

void TQWidget::setBaseSize ( const TQSize & )

Sets the base size of the widget. See the "baseSize" property for details.

void TQWidget::setBaseSize ( int basew, int baseh )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This corresponds to setBaseSize( TQSize(basew, baseh) ). Sets the widgets base size to width basew and height baseh.

void TQWidget::setCaption ( const TQString & ) [virtual slot]

Sets the window caption (title). See the "caption" property for details.

void TQWidget::setCursor ( const TQCursor & ) [virtual]

Sets the cursor shape for this widget. See the "cursor" property for details.

void TQWidget::setDisabled ( bool disable ) [slot]

Disables widget input events if disable is TRUE; otherwise enables input events.

See the enabled documentation for more information.

See also isEnabledTo(), TQKeyEvent, TQMouseEvent, and enabledChange().

void TQWidget::setEnabled ( bool ) [virtual slot]

Sets whether the widget is enabled. See the "enabled" property for details.

void TQWidget::setEraseColor ( const TQColor & color ) [virtual]

Sets the erase color of the widget to color.

The erase color is the color the widget is to be cleared to before paintEvent() is called. If there is an erase pixmap (set using setErasePixmap()), then this property has an indeterminate value.

See also erasePixmap(), backgroundColor(), backgroundMode, and palette.

void TQWidget::setErasePixmap ( const TQPixmap & pixmap ) [virtual]

Sets the widget's erase pixmap to pixmap.

This pixmap is used to clear the widget before paintEvent() is called.

void TQWidget::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, and setFixedSize().

Examples: fonts/simple-qfont-demo/viewer.cpp, layout/layout.cpp, qdir/qdir.cpp, and showimg/showimg.cpp.

void TQWidget::setFixedSize ( const TQSize & s )

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

See also maximumSize and minimumSize.

void TQWidget::setFixedSize ( int w, int h )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

void TQWidget::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, and setFixedSize().

Examples: progressbar/progressbar.cpp and qdir/qdir.cpp.

void TQWidget::setFocus () [virtual slot]

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

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.

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

See also focus, clearFocus(), focusInEvent(), focusOutEvent(), focusPolicy, TQApplication::focusWidget(), grabKeyboard(), and grabMouse().

Examples: addressbook/centralwidget.cpp, lineedits/lineedits.cpp, mdi/application.cpp, popup/popup.cpp, rot13/rot13.cpp, t8/main.cpp, and wizard/wizard.cpp.

void TQWidget::setFocusPolicy ( FocusPolicy ) [virtual]

Sets the way the widget accepts keyboard focus. See the "focusPolicy" property for details.

void TQWidget::setFocusProxy ( TQWidget * w ) [virtual]

Sets the widget's focus proxy to widget w. If w is 0, the function resets this widget to have no focus proxy.

Some widgets, such as TQComboBox, can "have focus", but create a child widget to actually handle the focus. TQComboBox, for example, creates a TQLineEdit which handles the focus.

setFocusProxy() sets the widget which will actually get focus when "this widget" gets it. If there is a focus proxy, focusPolicy(), setFocusPolicy(), setFocus() and hasFocus() all operate on the focus proxy.

See also focusProxy().

void TQWidget::setFont ( const TQFont & ) [virtual]

Sets the font currently set for the widget. See the "font" property for details.

Reimplemented in TQComboBox, TQLabel, and TQTabDialog.

void TQWidget::setFont ( const TQFont & f, bool )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Use setFont(const TQFont& font) instead.

void TQWidget::setGeometry ( const TQRect & ) [virtual slot]

Sets the geometry of the widget relative to its parent and excluding the window frame. See the "geometry" property for details.

void TQWidget::setGeometry ( int x, int y, int w, int h ) [virtual slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This corresponds to setGeometry( TQRect(x, y, w, h) ).

void TQWidget::setHidden ( bool hide ) [slot]

Sets whether the widget is explicitly hidden to hide. See the "hidden" property for details.

void TQWidget::setIcon ( const TQPixmap & ) [virtual slot]

Sets the widget's icon. See the "icon" property for details.

void TQWidget::setIconText ( const TQString & ) [virtual slot]

Sets the widget's icon text. See the "iconText" property for details.

void TQWidget::setInputMethodEnabled ( bool b )

Sets enables or disables the use of input methods for this widget to b. See the "inputMethodEnabled" property for details.

void TQWidget::setKeyCompression ( bool compress ) [virtual protected]

Enables key event compression, if compress is TRUE, and disables it if compress is FALSE.

Key compression is off by default (except for TQLineEdit and TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be processed in each event.

For example, a word processor widget might receive 2, 3 or more characters in each TQKeyEvent::text(), if the layout recalculation takes too long for the CPU.

If a widget supports multiple character unicode input, it is always safe to turn the compression on.

TQt performs key event compression only for printable characters. Modifier keys, cursor movement keys, function keys and miscellaneous action keys (e.g. Escape, Enter, Backspace, PrintScreen) will stop key event compression, even if there are more compressible key events available.

Not all platforms support this compression, in which case turning it on will have no effect.

See also TQKeyEvent::text().

void TQWidget::setMask ( const TQBitmap & bitmap ) [virtual]

Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. Use TQt::color0 to draw transparent regions and TQt::color1 to draw opaque regions of the bitmap.

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 examples/tux for an example of masking for transparency.

See also clearMask().

void TQWidget::setMask ( const TQRegion & region ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Causes only the parts of the widget which overlap region to be visible. If the region includes pixels outside the rect() of the widget, window system controls in that area may or may not be visible, depending on the platform.

Note that this effect can be slow if the region is particularly complex.

See also clearMask().

void TQWidget::setMaximumHeight ( int maxh )

Sets the widget's maximum height to maxh. See the "maximumHeight" property for details.

void TQWidget::setMaximumSize ( const TQSize & )

Sets the widget's maximum size. See the "maximumSize" property for details.

void TQWidget::setMaximumSize ( int maxw, int maxh ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This function corresponds to setMaximumSize( TQSize(maxw, maxh) ). Sets the maximum width to maxw and the maximum height to maxh.

void TQWidget::setMaximumWidth ( int maxw )

Sets the widget's maximum width to maxw. See the "maximumWidth" property for details.

void TQWidget::setMicroFocusHint ( int x, int y, int width, int height, bool text = TRUE, TQFont * f = 0 ) [virtual protected]

When a widget gets focus, it should call setMicroFocusHint() with some appropriate position and size, x, y, width and height. This has no visual effect, it just provides hints to any system-specific input handling tools.

The text argument should be TRUE if this is a position for text input.

In the Windows version of TQt, this method sets the system caret, which is used for user Accessibility focus handling. If text is TRUE, it also sets the IME composition window in Far East Asian language input systems.

In the X11 version of TQt, if text is TRUE, this method sets the XIM "spot" point for complex language input handling.

The font f is a rendering hint to the currently active input method. If f is 0 the widget's font is used.

See also microFocusHint.

void TQWidget::setMinimumHeight ( int minh )

Sets the widget's minimum height to minh. See the "minimumHeight" property for details.

void TQWidget::setMinimumSize ( const TQSize & )

Sets the widget's minimum size. See the "minimumSize" property for details.

void TQWidget::setMinimumSize ( int minw, int minh ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This function corresponds to setMinimumSize( TQSize(minw, minh) ). Sets the minimum width to minw and the minimum height to minh.

void TQWidget::setMinimumWidth ( int minw )

Sets the widget's minimum width to minw. See the "minimumWidth" property for details.

void TQWidget::setMouseTracking ( bool enable ) [virtual slot]

Sets whether mouse tracking is enabled for the widget to enable. See the "mouseTracking" property for details.

void TQWidget::setPalette ( const TQPalette & ) [virtual]

Sets the widget's palette. See the "palette" property for details.

Reimplemented in TQComboBox, TQScrollBar, and TQSlider.

void TQWidget::setPalette ( const TQPalette & p, bool )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Use setPalette( const TQPalette& p ) instead.

void TQWidget::setPaletteBackgroundColor ( const TQColor & ) [virtual]

Sets the background color of the widget. See the "paletteBackgroundColor" property for details.

void TQWidget::setPaletteBackgroundPixmap ( const TQPixmap & ) [virtual]

Sets the background pixmap of the widget. See the "paletteBackgroundPixmap" property for details.

void TQWidget::setPaletteForegroundColor ( const TQColor & )

Sets the foreground color of the widget. See the "paletteForegroundColor" property for details.

void TQWidget::setShown ( bool show ) [slot]

Sets whether the widget is shown to show. See the "shown" property for details.

void TQWidget::setSizeIncrement ( const TQSize & )

Sets the size increment of the widget. See the "sizeIncrement" property for details.

void TQWidget::setSizeIncrement ( int w, int h ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the x (width) size increment to w and the y (height) size increment to h.

void TQWidget::setSizePolicy ( TQSizePolicy ) [virtual]

Sets the default layout behavior of the widget. See the "sizePolicy" property for details.

void TQWidget::setSizePolicy ( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw = FALSE )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the size policy of the widget to hor, ver and hfw (height for width).

See also TQSizePolicy::TQSizePolicy().

void TQWidget::setStyle ( TQStyle * style )

Sets the widget's GUI style to style. Ownership of the style object is not transferred.

If no style is set, the widget uses the application's style, TQApplication::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 TQt's styling capabilities. Real applications should avoid it and use one consistent GUI style instead.

See also style(), TQStyle, TQApplication::style(), and TQApplication::setStyle().

Examples: grapher/grapher.cpp and progressbar/progressbar.cpp.

TQStyle * TQWidget::setStyle ( const TQString & style )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the widget's GUI style to style using the TQStyleFactory.

void TQWidget::setTabOrder ( TQWidget * first, TQWidget * second ) [static]

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

Note that since the tab order of the second 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:

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

If first or second has a focus proxy, setTabOrder() correctly substitutes the proxy.

See also focusPolicy and setFocusProxy().

Example: customlayout/main.cpp.

void TQWidget::setUpdatesEnabled ( bool enable ) [virtual slot]

Sets whether updates are enabled to enable. See the "updatesEnabled" property for details.

void TQWidget::setWFlags ( WFlags f ) [virtual protected]

Sets the widget flags f.

Widget flags are a combination of TQt::WidgetFlags.

See also testWFlags(), getWFlags(), and clearWFlags().

void TQWidget::setWindowOpacity ( double level )

Sets the level of opacity for the window to level. See the "windowOpacity" property for details.

void TQWidget::setWindowState ( uint windowState )

Sets the window state to windowState. The window state is a OR'ed combination of TQt::WindowState: WindowMinimized, WindowMaximized, WindowFullScreen and 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 mormal mode, use the following code:

        w->setWindowState(w->windowState() ^ 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() & ~WindowMinimized | WindowActive);
  

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

See also TQt::WindowState and windowState().

void TQWidget::show () [virtual slot]

Shows the widget and its child widgets.

If its size or position has changed, TQt guarantees that a widget gets move and resize events just before it is shown.

You almost never have to reimplement this 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 polish().

See also showEvent(), hide(), showMinimized(), showMaximized(), showNormal(), visible, and polish().

Examples: aclock/main.cpp, life/main.cpp, popup/popup.cpp, t1/main.cpp, t3/main.cpp, t4/main.cpp, and toplevel/options.ui.h.

Reimplemented in TQDialog and TQMenuBar.

void TQWidget::showEvent ( TQShowEvent * ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget show events.

Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of top-level widgets are delivered afterwards.

See also event() and TQShowEvent.

Example: qdir/qdir.cpp.

void TQWidget::showFullScreen () [slot]

Shows the widget in full-screen mode.

Calling this function only affects top-level widgets.

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 WX11BypassWM 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(), and visible.

void TQWidget::showMaximized () [virtual slot]

Shows the widget maximized.

Calling this function only affects top-level widgets.

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

See also setWindowState(), showNormal(), showMinimized(), show(), hide(), and visible.

Examples: canvas/main.cpp, helpviewer/main.cpp, mdi/application.cpp, qwerty/main.cpp, qwerty/qwerty.cpp, and scribble/main.cpp.

void TQWidget::showMinimized () [virtual slot]

Shows the widget minimized, as an icon.

Calling this function only affects top-level widgets.

See also showNormal(), showMaximized(), show(), hide(), visible, and minimized.

void TQWidget::showNormal () [virtual slot]

Restores the widget after it has been maximized or minimized.

Calling this function only affects top-level widgets.

See also setWindowState(), showMinimized(), showMaximized(), show(), hide(), and visible.

Example: mdi/application.cpp.

TQSize TQWidget::size () const

Returns the size of the widget excluding any window frame. See the "size" property for details.

TQSize TQWidget::sizeHint () const [virtual]

Returns the recommended size for the widget. See the "sizeHint" property for details.

Reimplemented in TQSizeGrip.

TQSize TQWidget::sizeIncrement () const

Returns the size increment of the widget. See the "sizeIncrement" property for details.

TQSizePolicy TQWidget::sizePolicy () const [virtual]

Returns the default layout behavior of the widget. See the "sizePolicy" property for details.

void TQWidget::stackUnder ( TQWidget * w ) [slot]

Places the widget under w in the parent widget's stack.

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

See also raise() and lower().

TQStyle & TQWidget::style () const

Returns the GUI style for this widget

See also TQWidget::setStyle(), TQApplication::setStyle(), and TQApplication::style().

void TQWidget::styleChange ( TQStyle & oldStyle ) [virtual protected]

This virtual function is called when the style of the widgets changes. oldStyle is the previous GUI style; you can get the new style from style().

Reimplement this function if your widget needs to know when its GUI style changes. You will almost certainly need to update the widget using update().

The default implementation updates the widget including its geometry.

See also TQApplication::setStyle(), style(), update(), and updateGeometry().

void TQWidget::tabletEvent ( TQTabletEvent * e ) [virtual protected]

This event handler, for event e, 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 TQTabletEvent::ignore(), TQTabletEvent::accept(), event(), and TQTabletEvent.

WFlags TQWidget::testWFlags ( WFlags f ) const

Returns the bitwise AND of the widget flags and f.

Widget flags are a combination of TQt::WidgetFlags.

If you want to test for the presence of multiple flags (or composite flags such as WStyle_Splash), test the return value for equality against the argument. For example:

    int flags = WStyle_Tool | WStyle_NoBorder;
    if ( testWFlags(flags) )
        ... // WStyle_Tool or WStyle_NoBorder or both are set
    if ( testWFlags(flags) == flags )
        ... // both WStyle_Tool and WStyle_NoBorder are set
    

See also getWFlags(), setWFlags(), and clearWFlags().

TQWidget * TQWidget::topLevelWidget () const

Returns the top-level widget for this widget, i.e. the next ancestor widget that has (or could have) a window-system frame.

If the widget is a top-level, the widget itself is returned.

Typical usage is changing the window caption:

        aWidget->topLevelWidget()->setCaption( "New Caption" );
    

See also isTopLevel.

void TQWidget::unsetCursor () [virtual]

Resets the cursor shape for this widget. See the "cursor" property for details.

void TQWidget::unsetFont ()

Resets the font currently set for the widget. See the "font" property for details.

void TQWidget::unsetPalette ()

Resets the widget's palette. See the "palette" property for details.

void TQWidget::update () [slot]

Updates the widget unless updates are disabled or the widget is hidden.

This function does not cause an immediate repaint; instead it schedules a paint event for processing when TQt returns to the main event loop. This permits TQt 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.

TQt normally erases the widget's area before the paintEvent() call. If the WRepaintNoErase widget flag is set, the widget is responsible for painting all its pixels itself.

See also repaint(), paintEvent(), updatesEnabled, erase(), and setWFlags().

Examples: desktop/desktop.cpp and scrollview/scrollview.cpp.

void TQWidget::update ( int x, int y, int w, int h ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Updates a rectangle (x, y, w, h) inside 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 TQt returns to the main event loop. This permits TQt to optimize for more speed and less flicker and a call to repaint() does.

Calling update() several times normally results in just one paintEvent() call.

If w is negative, it is replaced with width() - x. If h is negative, it is replaced width height() - y.

TQt normally erases the specified area before the paintEvent() call. If the WRepaintNoErase widget flag is set, the widget is responsible for painting all its pixels itself.

See also repaint(), paintEvent(), updatesEnabled, and erase().

void TQWidget::update ( const TQRect & r ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Updates a rectangle r inside 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 TQt returns to the main event loop. This permits TQt to optimize for more speed and less flicker and a call to repaint() does.

Calling update() several times normally results in just one paintEvent() call.

void TQWidget::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.

void TQWidget::updateMask () [virtual protected]

This function can be reimplemented in a subclass to support transparent widgets. It should be called whenever a widget changes state in a way that means that the shape mask must be recalculated.

See also autoMask, setMask(), and clearMask().

TQRect TQWidget::visibleRect () const

Returns the visible rectangle. See the "visibleRect" property for details.

void TQWidget::wheelEvent ( TQWheelEvent * e ) [virtual protected]

This event handler, for event e, 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 TQWheelEvent::ignore(), TQWheelEvent::accept(), event(), and TQWheelEvent.

int TQWidget::width () const

Returns the width of the widget excluding any window frame. See the "width" property for details.

bool TQWidget::winEvent ( MSG * ) [virtual protected]

This special event handler can be reimplemented in a subclass to receive native Windows events.

In your reimplementation of this function, if you want to stop the event being handled by TQt, return TRUE. If you return FALSE, this native event is passed back to TQt, which translates the event into a TQt event and sends it to the widget.

Warning: This function is not portable.

See also TQApplication::winEventFilter().

WId TQWidget::winId () const

Returns the window system identifier of the widget.

Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.

See also find().

void TQWidget::windowActivationChange ( bool oldActive ) [virtual protected]

This virtual function is called for a widget when its window is activated or deactivated by the window system. oldActive is the previous state; you can get the new setting from isActiveWindow().

Reimplement this function if your widget needs to know when its window becomes activated or deactivated.

The default implementation updates the visible part of the widget if the inactive and the active colorgroup are different for colors other than the highlight and link colors.

See also setActiveWindow(), isActiveWindow, update(), and palette.

double TQWidget::windowOpacity () const

Returns the level of opacity for the window. See the "windowOpacity" property for details.

uint TQWidget::windowState () const

Returns the current window state. The window state is a OR'ed combination of TQt::WindowState: WindowMinimized, WindowMaximized, WindowFullScreen and WindowActive.

See also TQt::WindowState and setWindowState().

int TQWidget::x () const

Returns the x coordinate of the widget relative to its parent including any window frame. See the "x" property for details.

bool TQWidget::x11Event ( XEvent * ) [virtual protected]

This special event handler can be reimplemented in a subclass to receive native X11 events.

In your reimplementation of this function, if you want to stop the event being handled by TQt, return TRUE. If you return FALSE, this native event is passed back to TQt, which translates the event into a TQt event and sends it to the widget.

Warning: This function is not portable.

See also TQApplication::x11EventFilter().

Reimplemented in TQXtWidget.

int TQWidget::y () const

Returns the y coordinate of the widget relative to its parent and including any window frame. See the "y" property for details.


Property Documentation

bool acceptDrops

This property holds 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 (TQWidget::isDesktop()), 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.

Set this property's value with setAcceptDrops() and get this property's value with acceptDrops().

bool autoMask

This property holds whether the auto mask feature is enabled for the widget.

Transparent widgets use a mask to define their visible region. TQWidget has some built-in support to make the task of recalculating the mask easier. When setting auto mask to TRUE, updateMask() will be called whenever the widget is resized or changes its focus state. Note that you must reimplement updateMask() (which should include a call to setMask()) or nothing will happen.

Note: when you re-implement resizeEvent(), focusInEvent() or focusOutEvent() in your custom widgets and still want to ensure that the auto mask calculation works, you should add:

        if ( autoMask() )
            updateMask();
    

at the end of your event handlers. This is true for all member functions that change the appearance of the widget in a way that requires a recalculation of the mask.

While being a technically appealing concept, masks have a big drawback: when using complex masks that cannot be expressed easily with relatively simple regions, they can be very slow on some window systems. The classic example is a transparent label. The complex shape of its contents makes it necessary to represent its mask by a bitmap, which consumes both memory and time. If all you want is to blend the background of several neighboring widgets together seamlessly, you will probably want to use setBackgroundOrigin() rather than a mask.

See also updateMask(), setMask(), clearMask(), and backgroundOrigin.

Set this property's value with setAutoMask() and get this property's value with autoMask().

TQBrush backgroundBrush

This property holds the widget's background brush.

The background brush depends on a widget's palette and its background mode.

See also backgroundColor(), backgroundPixmap(), eraseColor(), palette, and TQApplication::setPalette().

Get this property's value with backgroundBrush().

BackgroundMode backgroundMode

This property holds the color role used for painting the background of the widget.

setPaletteBackgroundColor() reads this property to determine which entry of the palette to set.

For most widgets the default suffices (PaletteBackground, typically gray), but some need to use PaletteBase (the background color for text output, typically white) or another role.

TQListBox, which is "sunken" and uses the base color to contrast with its environment, does this in its constructor:

    setBackgroundMode( PaletteBase );
    

You will never need to set the background mode of a built-in widget in TQt, but you might consider setting it in your custom widgets, so that setPaletteBackgroundColor() works as expected.

Note that two of the BackgroundMode values make no sense for setBackgroundMode(), namely FixedPixmap and FixedColor. You must call setBackgroundPixmap() and setPaletteBackgroundColor() instead.

Set this property's value with setBackgroundMode() and get this property's value with backgroundMode().

BackgroundOrigin backgroundOrigin

This property holds the origin of the widget's background.

The origin is either WidgetOrigin (the default), ParentOrigin, WindowOrigin or AncestorOrigin.

This only makes a difference if the widget has a background pixmap, in which case positioning matters. Using WindowOrigin for several neighboring widgets makes the background blend together seamlessly. AncestorOrigin allows blending backgrounds seamlessly when an ancestor of the widget has an origin other than WindowOrigin.

See also backgroundPixmap() and backgroundMode.

Set this property's value with setBackgroundOrigin() and get this property's value with backgroundOrigin().

TQSize baseSize

This property holds the base size of the widget.

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

See also sizeIncrement.

Set this property's value with setBaseSize() and get this property's value with baseSize().

TQString caption

This property holds the window caption (title).

This property only makes sense for top-level widgets. If no caption has been set, the caption is TQString::null.

See also icon and iconText.

Set this property's value with setCaption() and get this property's value with caption().

TQRect childrenRect

This property holds the bounding rectangle of the widget's children.

Hidden children are excluded.

See also childrenRegion and geometry.

Get this property's value with childrenRect().

TQRegion childrenRegion

This property holds the combined region occupied by the widget's children.

Hidden children are excluded.

See also childrenRect and geometry.

Get this property's value with childrenRegion().

TQColorGroup colorGroup

This property holds the current color group of the widget palette.

The color group is determined by the state of the widget. A disabled widget has the TQPalette::disabled() color group, a widget with keyboard focus has the TQPalette::active() color group, and an inactive widget has the TQPalette::inactive() color group.

See also palette.

Get this property's value with colorGroup().

TQCursor cursor

This property holds 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( IbeamCursor );
    

If no cursor has been set, or after a call to unsetCursor(), the parent's cursor is used. The function unsetCursor() has no effect on top-level widgets.

See also TQApplication::setOverrideCursor().

Set this property's value with setCursor(), get this property's value with cursor(), and reset this property's value with unsetCursor().

bool customWhatsThis

This property holds whether the widget wants to handle What's This help manually.

The default implementation of customWhatsThis() returns FALSE, which means the widget will not receive any events in Whats This mode.

The widget may leave What's This mode by calling TQWhatsThis::leaveWhatsThisMode(), with or without actually displaying any help text.

You can also reimplement customWhatsThis() if your widget is a "passive interactor" supposed to work under all circumstances. Simply don't call TQWhatsThis::leaveWhatsThisMode() in that case.

See also TQWhatsThis::inWhatsThisMode() and TQWhatsThis::leaveWhatsThisMode().

Get this property's value with customWhatsThis().

bool enabled

This property holds whether the widget is enabled.

An enabled widget receives keyboard and mouse events; a disabled widget does not. In fact, an enabled widget only receives keyboard events when it is in focus.

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 reimplement the enabledChange() function.

Disabling a widget implicitly disables all its children. Enabling respectively enables all child widgets unless they have been explicitly disabled.

See also enabled, isEnabledTo(), TQKeyEvent, TQMouseEvent, and enabledChange().

Set this property's value with setEnabled() and get this property's value with isEnabled().

bool focus

This property holds whether this widget (or its focus proxy) has the keyboard input focus.

Effectively equivalent to qApp->focusWidget() == this.

See also setFocus(), clearFocus(), focusPolicy, and TQApplication::focusWidget().

Get this property's value with hasFocus().

bool focusEnabled

This property holds whether the widget accepts keyboard focus.

Keyboard focus is initially disabled (i.e. focusPolicy() == TQWidget::NoFocus).

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 TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus).

See also focusPolicy, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled.

Get this property's value with isFocusEnabled().

FocusPolicy focusPolicy

This property holds the way the widget accepts keyboard focus.

The policy is TQWidget::TabFocus if the widget accepts keyboard focus by tabbing, TQWidget::ClickFocus if the widget accepts focus by clicking, TQWidget::StrongFocus if it accepts both, and TQWidget::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 TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus).

See also focusEnabled, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled.

Set this property's value with setFocusPolicy() and get this property's value with focusPolicy().

TQFont font

This property holds 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 unsetFont() 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:

    TQFont f( "Helvetica", 12, TQFont::Bold );
    setFont( f );
    

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

See also fontChange(), fontInfo(), fontMetrics(), and ownFont.

Set this property's value with setFont(), get this property's value with font(), and reset this property's value with unsetFont().

TQRect frameGeometry

This property holds geometry of the widget relative to its parent including any window frame.

See the Window Geometry documentation for an overview of geometry issues with top-level widgets.

See also geometry, x, y, and pos.

Get this property's value with frameGeometry().

TQSize frameSize

This property holds the size of the widget including any window frame.

Get this property's value with frameSize().

bool fullScreen

This property holds whether the widget is full screen.

Get this property's value with isFullScreen().

See also windowState(), minimized, and maximized.

TQRect geometry

This property holds 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().

setGeometry() is virtual, and all other overloaded setGeometry() implementations in TQt call it.

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

See the Window Geometry documentation for an overview of top-level widget geometry.

See also frameGeometry, rect, pos, size, moveEvent(), resizeEvent(), minimumSize, and maximumSize.

Set this property's value with setGeometry() and get this property's value with geometry().

int height

This property holds the height of the widget excluding any window frame.

See the Window Geometry documentation for an overview of top-level widget geometry.

See also geometry, width, and size.

Get this property's value with height().

bool hidden

This property holds whether the widget is explicitly hidden.

If FALSE, the widget is visible or would become visible if all its ancestors became visible.

See also hide(), show(), visible, isVisibleTo(), and shown.

Set this property's value with setHidden() and get this property's value with isHidden().

TQPixmap icon

This property holds the widget's icon.

This property only makes sense for top-level widgets. If no icon has been set, icon() returns 0.

See also iconText, caption, and Setting the Application Icon.

Set this property's value with setIcon() and get this property's value with icon().

TQString iconText

This property holds the widget's icon text.

This property only makes sense for top-level widgets. If no icon text has been set, this functions returns TQString::null.

See also icon and caption.

Set this property's value with setIconText() and get this property's value with iconText().

bool inputMethodEnabled

This property holds enables or disables the use of input methods for this widget.

Most Widgets (as eg. buttons) that do not handle text input should have the input method disabled if they have focus. This is the default.

If a widget handles text input it should set this property to TRUE.

Set this property's value with setInputMethodEnabled() and get this property's value with isInputMethodEnabled().

bool isActiveWindow

This property holds whether this widget is the active window.

The active window is the window that contains the widget that has keyboard focus.

When popup windows are visible, this property is TRUE for both the active window and for the popup.

See also setActiveWindow() and TQApplication::activeWindow().

Get this property's value with isActiveWindow().

bool isDesktop

This property holds whether the widget is a desktop widget, i.e. represents the desktop.

A desktop widget is also a top-level widget.

See also isTopLevel and TQApplication::desktop().

Get this property's value with isDesktop().

bool isDialog

This property holds whether the widget is a dialog widget.

A dialog widget is a secondary top-level widget, i.e. a top-level widget with a parent.

See also isTopLevel and TQDialog.

Get this property's value with isDialog().

bool isModal

This property holds whether the widget is a modal widget.

This property only makes sense for top-level widgets. A modal widget prevents widgets in all other top-level widgets from getting any input.

See also isTopLevel, isDialog, and TQDialog.

Get this property's value with isModal().

bool isPopup

This property holds whether the widget is a popup widget.

A popup widget is created by specifying the widget flag WType_Popup to the widget constructor. A popup widget is also a top-level widget.

See also isTopLevel.

Get this property's value with isPopup().

bool isTopLevel

This property holds whether the widget is a top-level widget.

A top-level widget is a widget which usually has a frame and a caption (title). Popup and desktop widgets are also top-level widgets.

A top-level widget 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.

TQDialog and TQMainWindow widgets are by default top-level, even if a parent widget is specified in the constructor. This behavior is specified by the WType_TopLevel widget flag.

See also topLevelWidget(), isDialog, isModal, isPopup, isDesktop, and parentWidget().

Get this property's value with isTopLevel().

bool maximized

This property holds whether this widget is maximized.

This property is only relevant for top-level widgets.

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, TQt 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(), and minimized.

Get this property's value with isMaximized().

int maximumHeight

This property holds the widget's maximum height.

This property corresponds to maximumSize().height().

See also maximumSize and maximumWidth.

Set this property's value with setMaximumHeight() and get this property's value with maximumHeight().

TQSize maximumSize

This property holds the widget's maximum size.

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

See also maximumWidth, maximumHeight, maximumSize, minimumSize, and sizeIncrement.

Set this property's value with setMaximumSize() and get this property's value with maximumSize().

int maximumWidth

This property holds the widget's maximum width.

This property corresponds to maximumSize().width().

See also maximumSize and maximumHeight.

Set this property's value with setMaximumWidth() and get this property's value with maximumWidth().

TQRect microFocusHint

This property holds the currently set micro focus hint for this widget.

See the documentation of setMicroFocusHint() for more information.

Get this property's value with microFocusHint().

bool minimized

This property holds whether this widget is minimized (iconified).

This property is only relevant for top-level widgets.

See also showMinimized(), visible, show(), hide(), showNormal(), and maximized.

Get this property's value with isMinimized().

int minimumHeight

This property holds the widget's minimum height.

This property corresponds to minimumSize().height().

See also minimumSize and minimumWidth.

Set this property's value with setMinimumHeight() and get this property's value with minimumHeight().

TQSize minimumSize

This property holds 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.

If you use a layout inside the widget, the minimum size will be set by the layout and not by setMinimumSize(), unless you set the layout's resize mode to TQLayout::FreeResize.

See also minimumWidth, minimumHeight, maximumSize, sizeIncrement, and TQLayout::resizeMode.

Set this property's value with setMinimumSize() and get this property's value with minimumSize().

TQSize minimumSizeHint

This property holds 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().

TQLayout will never resize a widget to a size smaller than minimumSizeHint.

See also TQSize::isValid(), size, minimumSize, and sizePolicy.

Get this property's value with minimumSizeHint().

int minimumWidth

This property holds the widget's minimum width.

This property corresponds to minimumSize().width().

See also minimumSize and minimumHeight.

Set this property's value with setMinimumWidth() and get this property's value with minimumWidth().

bool mouseTracking

This property holds 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() and TQApplication::setGlobalMouseTracking().

Set this property's value with setMouseTracking() and get this property's value with hasMouseTracking().

bool ownCursor

This property holds whether the widget uses its own cursor.

If FALSE, the widget uses its parent widget's cursor.

See also cursor.

Get this property's value with ownCursor().

bool ownFont

This property holds whether the widget uses its own font.

If FALSE, the widget uses its parent widget's font.

See also font.

Get this property's value with ownFont().

bool ownPalette

This property holds whether the widget uses its own palette.

If FALSE, the widget uses its parent widget's palette.

See also palette.

Get this property's value with ownPalette().

TQPalette palette

This property holds the widget's palette.

As long as no special palette has been set, or after unsetPalette() has been called, 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.

Instead of defining an entirely new palette, you can also use the paletteBackgroundColor, paletteBackgroundPixmap and paletteForegroundColor convenience properties to change a widget's background and foreground appearance only.

See also ownPalette, colorGroup, and TQApplication::palette().

Set this property's value with setPalette(), get this property's value with palette(), and reset this property's value with unsetPalette().

TQColor paletteBackgroundColor

This property holds the background color of the widget.

The palette background color is usually set implicitly by setBackgroundMode(), although it can also be set explicitly by setPaletteBackgroundColor(). setPaletteBackgroundColor() is a convenience function that creates and sets a modified TQPalette with setPalette(). The palette is modified according to the widget's background mode. For example, if the background mode is PaletteButton the color used for the palette's TQColorGroup::Button color entry is set.

If there is a background pixmap (set using setPaletteBackgroundPixmap()), then the return value of this function is indeterminate.

See also paletteBackgroundPixmap, paletteForegroundColor, palette, and colorGroup.

Set this property's value with setPaletteBackgroundColor(), get this property's value with paletteBackgroundColor(), and reset this property's value with unsetPalette().

TQPixmap paletteBackgroundPixmap

This property holds the background pixmap of the widget.

The palette background pixmap is usually set implicitly by setBackgroundMode(), although it can also be set explicitly by setPaletteBackgroundPixmap(). setPaletteBackgroundPixmap() is a convenience function that creates and sets a modified TQPalette with setPalette(). The palette is modified according to the widget's background mode. For example, if the background mode is PaletteButton the pixmap used for the palette's TQColorGroup::Button color entry is set.

If there is a plain background color (set using setPaletteBackgroundColor()), then this function returns 0.

See also paletteBackgroundColor, paletteForegroundColor, palette, and colorGroup.

Set this property's value with setPaletteBackgroundPixmap(), get this property's value with paletteBackgroundPixmap(), and reset this property's value with unsetPalette().

TQColor paletteForegroundColor

This property holds the foreground color of the widget.

setPaletteForegroundColor() is a convenience function that creates and sets a modified TQPalette with setPalette(). The palette is modified according to the widget's background mode. For example, if the background mode is PaletteButton the palette entry TQColorGroup::ButtonText is set to color.

See also palette, TQApplication::setPalette(), backgroundMode, foregroundColor(), backgroundMode, and setEraseColor().

Set this property's value with setPaletteForegroundColor(), get this property's value with paletteForegroundColor(), and reset this property's value with unsetPalette().

TQPoint pos

This property holds the position of the widget within its parent widget.

If the widget is a top-level widget, 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.

move() is virtual, and all other overloaded move() implementations in TQt call it.

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

See the Window Geometry documentation for an overview of top-level widget geometry.

See also frameGeometry, size, x, and y.

Set this property's value with move() and get this property's value with pos().

TQRect rect

This property holds the internal geometry of the widget excluding any window frame.

The rect property equals TQRect(0, 0, width(), height()).

See the Window Geometry documentation for an overview of top-level widget geometry.

See also size.

Get this property's value with rect().

bool shown

This property holds whether the widget is shown.

If TRUE, the widget is visible or would become visible if all its ancestors became visible.

See also hide(), show(), visible, isVisibleTo(), and hidden.

Set this property's value with setShown() and get this property's value with isShown().

TQSize size

This property holds the size of the widget excluding any window frame.

When resizing, the widget, if visible, 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(). Furthermore, the size is always at least TQSize(1, 1). For toplevel widgets, the minimum size might be larger, depending on the window manager.

If you want a top-level window to have a fixed size, call setResizeMode( TQLayout::FreeResize ) on its layout.

resize() is virtual, and all other overloaded resize() implementations in TQt call it.

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

See also pos, geometry, minimumSize, maximumSize, and resizeEvent().

Set this property's value with resize() and get this property's value with size().

TQSize sizeHint

This property holds 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 TQSize::isValid(), minimumSizeHint, sizePolicy, minimumSize, and updateGeometry().

Get this property's value with sizeHint().

TQSize sizeIncrement

This property holds 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 top-level widgets.

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

See also size, minimumSize, and maximumSize.

Set this property's value with setSizeIncrement() and get this property's value with sizeIncrement().

TQSizePolicy sizePolicy

This property holds the default layout behavior of the widget.

If there is a TQLayout that manages this widget's children, the size policy specified by that layout is used. If there is no such TQLayout, 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 TQLineEdit, TQSpinBox or an editable TQComboBox) and other horizontally orientated widgets (such as TQProgressBar). TQToolButton's are normally square, so they allow growth in both directions. Widgets that support different directions (such as TQSlider, TQScrollBar or TQHeader) specify stretching in the respective direction only. Widgets that can provide scrollbars (usually subclasses of TQScrollView) tend to specify that they can use additional space, and that they can make do with less than sizeHint().

See also sizeHint, TQLayout, TQSizePolicy, and updateGeometry().

Set this property's value with setSizePolicy() and get this property's value with sizePolicy().

bool underMouse

This property holds whether the widget is under the mouse cursor.

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

See also TQEvent::Enter and TQEvent::Leave.

Get this property's value with hasMouse().

bool updatesEnabled

This property holds whether updates are enabled.

Calling update() and repaint() has no effect if updates are disabled. Paint events from the window system are processed normally even 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.

Example:

        setUpdatesEnabled( FALSE );
        bigVisualChanges();
        setUpdatesEnabled( TRUE );
        repaint();
    

See also update(), repaint(), and paintEvent().

Set this property's value with setUpdatesEnabled() and get this property's value with isUpdatesEnabled().

bool visible

This property holds whether the widget is visible.

Calling show() sets the widget to visible status if all its parent widgets up to the top-level widget are visible. If an ancestor is not visible, the widget won't become visible until all its ancestors are shown.

Calling 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 top-level widgets 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.

See also show(), hide(), hidden, isVisibleTo(), minimized, showEvent(), and hideEvent().

Get this property's value with isVisible().

TQRect visibleRect

This property holds the visible rectangle.

This property is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

No longer necessary, you can simply call repaint(). If you do not need the rectangle for repaint(), use clipRegion() instead.

Get this property's value with visibleRect().

int width

This property holds the width of the widget excluding any window frame.

See the Window Geometry documentation for an overview of top-level widget geometry.

See also geometry, height, and size.

Get this property's value with width().

double windowOpacity

This property holds 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 only present on Mac OS X and Windows 2000 and up.

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 TQPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantely slower than opaque windows.

Set this property's value with setWindowOpacity() and get this property's value with windowOpacity().

int x

This property holds the x coordinate of the widget relative to its parent including any window frame.

See the Window Geometry documentation for an overview of top-level widget geometry.

See also frameGeometry, y, and pos.

Get this property's value with x().

int y

This property holds the y coordinate of the widget relative to its parent and including any window frame.

See the Window Geometry documentation for an overview of top-level widget geometry.

See also frameGeometry, x, and pos.

Get this property's value with y().


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8