Qt Jambi Home

com.trolltech.qt.gui
Class QMdiSubWindow

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QMdiSubWindow
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QMdiSubWindow
extends QWidget

The QMdiSubWindow class provides a subwindow class for QMdiArea.

QMdiSubWindow represents a top-level window in a QMdiArea, and consists of a title bar with window decorations, an internal widget, and (depending on the current style) a window frame and a size grip. QMdiSubWindow has its own layout, which consists of the title bar and a center area for the internal widget.

The most common way to construct a QMdiSubWindow is to call QMdiArea::addSubWindow() with the internal widget as the argument. You can also create a subwindow yourself, and set an internal widget by calling setWidget.

You use the same API when programming with subwindows as with regular top-level windows (e.g., you can call functions such as show, hide, showMaximized, and setWindowTitle).

Subwindow Handling

QMdiSubWindow also supports behavior specific to subwindows in an MDI area.

By default, each QMdiSubWindow is visible inside the MDI area viewport when moved around, but it is also possible to specify transparent window movement and resizing behavior, where only the outline of a subwindow is updated during these operations. The setOption function is used to enable this behavior.

The isShaded function detects whether the subwindow is currently shaded (i.e., the window is collapsed so that only the title bar is visible). To enter shaded mode, call showShaded. QMdiSubWindow emits the windowStateChanged signal whenever the window state has changed (e.g., when the window becomes minimized, or is restored). It also emits aboutToActivate before it is activated.

In keyboard-interactive mode, the windows are moved and resized with the keyboard. You can enter this mode through the system menu of the window. The keyboardSingleStep and keyboardPageStep properties control the distance the widget is moved or resized for each keypress event. When shift is pressed down page step is used; otherwise single step is used.

See Also:
QMdiArea

Nested Class Summary
static class QMdiSubWindow.SubWindowOption
          This enum describes options that customize the behavior of QMdiSubWindow.
static class QMdiSubWindow.SubWindowOptions
          This QFlag class provides flags for the int enum.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal0 aboutToActivate
          QMdiSubWindow emits this signal immediately before it is activated.
 QSignalEmitter.Signal2<Qt.WindowStates,Qt.WindowStates> windowStateChanged
          QMdiSubWindow emits this signal after the window state changes.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QMdiSubWindow()
          Equivalent to QMdiSubWindow(0, 0).
QMdiSubWindow(QWidget parent)
          Equivalent to QMdiSubWindow(parent, 0).
QMdiSubWindow(QWidget parent, Qt.WindowFlags flags)
          Constructs a new QMdiSubWindow widget.
 
Method Summary
protected  void changeEvent(QEvent changeEvent)
          

This event handler can be reimplemented to handle state changes.

protected  void childEvent(QChildEvent childEvent)
          

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

protected  void closeEvent(QCloseEvent closeEvent)
          

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

protected  void contextMenuEvent(QContextMenuEvent contextMenuEvent)
          

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

 boolean event(QEvent event)
          

This is the main event handler; it handles event arg__1.

 boolean eventFilter(QObject object, QEvent event)
          

Filters events if this object has been installed as an event filter for the arg__1 object.

protected  void focusInEvent(QFocusEvent focusInEvent)
          

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

protected  void focusOutEvent(QFocusEvent focusOutEvent)
          

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

static QMdiSubWindow fromNativePointer(QNativePointer nativePointer)
          This function returns the QMdiSubWindow instance pointed to by nativePointer
protected  void hideEvent(QHideEvent hideEvent)
          

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

 boolean isShaded()
          Returns true if this window is shaded; otherwise returns false.
 int keyboardPageStep()
          Returns sets how far a widget should move or resize when using the keyboard page keys..
 int keyboardSingleStep()
          Returns sets how far a widget should move or resize when using the keyboard arrow keys..
protected  void keyPressEvent(QKeyEvent keyEvent)
          

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

protected  void leaveEvent(QEvent leaveEvent)
          

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

 QWidget maximizedButtonsWidget()
          
 QWidget maximizedSystemMenuIconWidget()
          
 QSize minimumSizeHint()
          

Returns the recommended minimum size for the widget.

protected  void mouseDoubleClickEvent(QMouseEvent mouseEvent)
          

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

protected  void mouseMoveEvent(QMouseEvent mouseEvent)
          

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

protected  void mousePressEvent(QMouseEvent mouseEvent)
          

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

protected  void mouseReleaseEvent(QMouseEvent mouseEvent)
          

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

protected  void moveEvent(QMoveEvent moveEvent)
          

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

protected  void paintEvent(QPaintEvent paintEvent)
          

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

protected  void resizeEvent(QResizeEvent resizeEvent)
          

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

 void setKeyboardPageStep(int step)
          Sets sets how far a widget should move or resize when using the keyboard page keys.
 void setKeyboardSingleStep(int step)
          Sets sets how far a widget should move or resize when using the keyboard arrow keys.
 void setOption(QMdiSubWindow.SubWindowOption option)
          Equivalent to setOption(option, true).
 void setOption(QMdiSubWindow.SubWindowOption option, boolean on)
          If on is true, option is enabled on the subwindow; otherwise it is disabled.
 void setSystemMenu(QMenu systemMenu)
          Sets systemMenu as the current system menu for this subwindow.
 void setWidget(QWidget widget)
          Sets widget as the internal widget of this subwindow.
protected  void showEvent(QShowEvent showEvent)
          

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

 void showShaded()
          Calling this function makes the subwindow enter the shaded mode.
 void showSystemMenu()
          Shows the system menu below the system menu icon in the title bar.
 QSize sizeHint()
          

Returns the recommended size for the widget.

 QMenu systemMenu()
          Returns a pointer to the current system menu, or zero if no system menu is set.
 boolean testOption(QMdiSubWindow.SubWindowOption arg__1)
          Returns true if arg__1 is enabled; otherwise returns false.
protected  void timerEvent(QTimerEvent timerEvent)
          

This event handler can be reimplemented in a subclass to receive timer events for the object.

 QWidget widget()
          Returns the current internal widget.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, focusNextChild, focusNextPrevChild, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, move, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

aboutToActivate

public final QSignalEmitter.Signal0 aboutToActivate

QMdiSubWindow emits this signal immediately before it is activated. After the subwindow has been activated, the QMdiArea that manages the subwindow will also emit the subWindowActivated() signal.

Compatible Slot Signature:
void mySlot()
See Also:
QMdiArea::subWindowActivated


windowStateChanged

public final QSignalEmitter.Signal2<Qt.WindowStates,Qt.WindowStates> windowStateChanged

QMdiSubWindow emits this signal after the window state changes. oldState is the window state before it changed, and newState is the new, current state.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.Qt.WindowStates oldState, com.trolltech.qt.core.Qt.WindowStates newState)
void mySlot(com.trolltech.qt.core.Qt.WindowStates oldState)
void mySlot()

Constructor Detail

QMdiSubWindow

public QMdiSubWindow(QWidget parent)

Equivalent to QMdiSubWindow(parent, 0).


QMdiSubWindow

public QMdiSubWindow()

Equivalent to QMdiSubWindow(0, 0).


QMdiSubWindow

public QMdiSubWindow(QWidget parent,
                     Qt.WindowFlags flags)

Constructs a new QMdiSubWindow widget. The parent and flags arguments are passed to QWidget's constructor.

Instead of using addSubWindow(), it is also simply possible to use setParent when you add the subwindow to a QMdiArea.

Note that only QMdiSubWindows can be set as children of QMdiArea; you cannot, for instance, write:

    QMdiArea mdiArea;
    QTextEdit editor(&mdiArea); // invalid child widget

See Also:
QMdiArea::addSubWindow
Method Detail

isShaded

public final boolean isShaded()

Returns true if this window is shaded; otherwise returns false.

A window is shaded if it is collapsed so that only the title bar is visible.


keyboardPageStep

public final int keyboardPageStep()

Returns sets how far a widget should move or resize when using the keyboard page keys..

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the page keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard page step value is 20 pixels.

See Also:
setKeyboardPageStep, keyboardSingleStep

keyboardSingleStep

public final int keyboardSingleStep()

Returns sets how far a widget should move or resize when using the keyboard arrow keys..

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the arrow keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard single step value is 5 pixels.

See Also:
setKeyboardSingleStep, keyboardPageStep

maximizedButtonsWidget

public final QWidget maximizedButtonsWidget()


maximizedSystemMenuIconWidget

public final QWidget maximizedSystemMenuIconWidget()


setKeyboardPageStep

public final void setKeyboardPageStep(int step)

Sets sets how far a widget should move or resize when using the keyboard page keys. to step.

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the page keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard page step value is 20 pixels.

See Also:
keyboardPageStep, keyboardSingleStep

setKeyboardSingleStep

public final void setKeyboardSingleStep(int step)

Sets sets how far a widget should move or resize when using the keyboard arrow keys. to step.

When in keyboard-interactive mode, you can use the arrow and page keys to either move or resize the window. This property controls the arrow keys. The common way to enter keyboard interactive mode is to enter the subwindow menu, and select either "resize" or "move".

The default keyboard single step value is 5 pixels.

See Also:
keyboardSingleStep, keyboardPageStep

setOption

public final void setOption(QMdiSubWindow.SubWindowOption option)

Equivalent to setOption(option, true).


setOption

public final void setOption(QMdiSubWindow.SubWindowOption option,
                            boolean on)

If on is true, option is enabled on the subwindow; otherwise it is disabled. See SubWindowOption for the effect of each option.

See Also:
SubWindowOption, testOption

setSystemMenu

public final void setSystemMenu(QMenu systemMenu)

Sets systemMenu as the current system menu for this subwindow.

By default, each QMdiSubWindow has a standard system menu.

QActions for the system menu created by QMdiSubWindow will automatically be updated depending on the current window state; e.g., the minimize action will be disabled after the window is minimized.

QActions added by the user are not updated by QMdiSubWindow.

QMdiSubWindow takes ownership of systemMenu; you do not have to delete it. Any existing menus will be deleted.

See Also:
systemMenu, showSystemMenu

setWidget

public final void setWidget(QWidget widget)

Sets widget as the internal widget of this subwindow. The internal widget is displayed in the center of the subwindow beneath the title bar.

QMdiSubWindow takes temporary ownership of widget; you do not have to delete it. Any existing internal widget will be removed and reparented to the root window.

See Also:
widget

showShaded

public final void showShaded()

Calling this function makes the subwindow enter the shaded mode. When the subwindow is shaded, only the title bar is visible.

Although shading is not supported by all styles, this function will still show the subwindow as shaded, regardless of whether support for shading is available. However, when used with styles without shading support, the user will be unable to return from shaded mode through the user interface (e.g., through a shade button in the title bar).

See Also:
isShaded

showSystemMenu

public final void showSystemMenu()

Shows the system menu below the system menu icon in the title bar.

See Also:
setSystemMenu, systemMenu

systemMenu

public final QMenu systemMenu()

Returns a pointer to the current system menu, or zero if no system menu is set. QMdiSubWindow provides a default system menu, but you can also set the menu with setSystemMenu.

See Also:
setSystemMenu, showSystemMenu

testOption

public final boolean testOption(QMdiSubWindow.SubWindowOption arg__1)

Returns true if arg__1 is enabled; otherwise returns false.

See Also:
SubWindowOption, setOption

widget

public final QWidget widget()

Returns the current internal widget.

See Also:
setWidget

changeEvent

protected void changeEvent(QEvent changeEvent)

This event handler can be reimplemented to handle state changes.

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

Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange.

Overrides:
changeEvent in class QWidget

childEvent

protected void childEvent(QChildEvent childEvent)

This event handler can be reimplemented in a subclass to receive child events. The event is passed in the arg__1 parameter.

QEvent::ChildAdded and QEvent::ChildRemoved events are sent to objects when children are added or removed. In both cases you can only rely on the child being a QObject, or if isWidgetType returns true, a QWidget. (This is because, in the ChildAdded case, the child is not yet fully constructed, and in the ChildRemoved case it might have been destructed already).

QEvent::ChildPolished events are sent to widgets when children are polished, or when polished children are added. If you receive a child polished event, the child's construction is usually completed.

For every child widget, you receive one ChildAdded event, zero or more ChildPolished events, and one ChildRemoved event.

The ChildPolished event is omitted if a child is removed immediately after it is added. If a child is polished several times during construction and destruction, you may receive several child polished events for the same child, each time with a different virtual table.

Overrides:
childEvent in class QObject
See Also:
event

closeEvent

protected void closeEvent(QCloseEvent closeEvent)

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

Overrides:
closeEvent in class QWidget
See Also:
event, hide, close, QCloseEvent, Application Example

contextMenuEvent

protected void contextMenuEvent(QContextMenuEvent contextMenuEvent)

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

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

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

Overrides:
contextMenuEvent in class QWidget
See Also:
event, QContextMenuEvent, customContextMenuRequested

event

public boolean event(QEvent event)

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

Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent.

Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event.

This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.

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

eventFilter

public boolean eventFilter(QObject object,
                           QEvent event)

Filters events if this object has been installed as an event filter for the arg__1 object.

In your reimplementation of this function, if you want to filter the arg__2 out, i.e. stop it being handled further, return true; otherwise return false.

Example:

    class MainWindow : public QMainWindow
    {
    public:
        MainWindow();

    protected:
        bool eventFilter(QObject *obj, QEvent *ev);

    private:
        QTextEdit *textEdit;
    };

    MainWindow::MainWindow()
    {
        textEdit = new QTextEdit;
        setCentralWidget(textEdit);

        textEdit->installEventFilter(this);
    }

    bool MainWindow::eventFilter(QObject *obj, QEvent *event)
    {
        if (obj == textEdit) {
            if (event->type() == QEvent::KeyPress) {
                QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
                qDebug() << "Ate key press" << keyEvent->key();
                return true;
            } else {
                return false;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter(obj, event);
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter function, since the base class might have reimplemented eventFilter for its own internal purposes.

Warning: If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.

Overrides:
eventFilter in class QObject
See Also:
installEventFilter

focusInEvent

protected void focusInEvent(QFocusEvent focusInEvent)

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

A widget normally must setFocusPolicy to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for windows that do not specify a focusPolicy).

Overrides:
focusInEvent in class QWidget
See Also:
focusOutEvent, setFocusPolicy, keyPressEvent, keyReleaseEvent, event, QFocusEvent

focusOutEvent

protected void focusOutEvent(QFocusEvent focusOutEvent)

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

A widget normally must setFocusPolicy to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for windows that do not specify a focusPolicy).

Overrides:
focusOutEvent in class QWidget
See Also:
focusInEvent, setFocusPolicy, keyPressEvent, keyReleaseEvent, event, QFocusEvent

hideEvent

protected void hideEvent(QHideEvent hideEvent)

This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the arg__1 parameter.

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

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.

Overrides:
hideEvent in class QWidget
See Also:
visible, event, QHideEvent

keyPressEvent

protected void keyPressEvent(QKeyEvent keyEvent)

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

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

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

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

Overrides:
keyPressEvent in class QWidget
See Also:
keyReleaseEvent, QKeyEvent::ignore, setFocusPolicy, focusInEvent, focusOutEvent, event, QKeyEvent, Tetrix Example

leaveEvent

protected void leaveEvent(QEvent leaveEvent)

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

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

Overrides:
leaveEvent in class QWidget
See Also:
enterEvent, mouseMoveEvent, event

minimumSizeHint

public QSize minimumSizeHint()

Returns the recommended minimum size for the widget.

If the value of this property is an invalid size, no minimum size is recommended.

The default implementation of minimumSizeHint returns an invalid size if there is no layout for this widget, and returns the layout's minimum size otherwise. Most built-in widgets reimplement minimumSizeHint.

QLayout will never resize a widget to a size smaller than the minimum size hint unless minimumSize is set or the size policy is set to QSizePolicy::Ignore. If minimumSize is set, the minimum size hint will be ignored.

Overrides:
minimumSizeHint in class QWidget
See Also:
QSize::isValid, resize, setMinimumSize, sizePolicy

mouseDoubleClickEvent

protected void mouseDoubleClickEvent(QMouseEvent mouseEvent)

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

The default implementation generates a normal mouse press event.

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

Overrides:
mouseDoubleClickEvent in class QWidget
See Also:
mousePressEvent, mouseReleaseEvent, mouseMoveEvent, event, QMouseEvent

mouseMoveEvent

protected void mouseMoveEvent(QMouseEvent mouseEvent)

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

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

Overrides:
mouseMoveEvent in class QWidget
See Also:
setMouseTracking, mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, event, QMouseEvent, Example

mousePressEvent

protected void mousePressEvent(QMouseEvent mouseEvent)

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

If you create new widgets in the mousePressEvent the mouseReleaseEvent may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

Overrides:
mousePressEvent in class QWidget
See Also:
mouseReleaseEvent, mouseDoubleClickEvent, mouseMoveEvent, event, QMouseEvent, Example

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent mouseEvent)

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

Overrides:
mouseReleaseEvent in class QWidget
See Also:
mousePressEvent, mouseDoubleClickEvent, mouseMoveEvent, event, QMouseEvent, Example

moveEvent

protected void moveEvent(QMoveEvent moveEvent)

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

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

Overrides:
moveEvent in class QWidget
See Also:
resizeEvent, event, move, QMoveEvent

paintEvent

protected void paintEvent(QPaintEvent paintEvent)

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

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

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint does not permit this optimization, so we suggest using update whenever possible.

When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background.

The background can be set using setBackgroundRole and setPalette.

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

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

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

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

Overrides:
paintEvent in class QWidget
See Also:
event, repaint, update, QPainter, QPixmap, QPaintEvent, Analog Clock Example

resizeEvent

protected void resizeEvent(QResizeEvent resizeEvent)

This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the arg__1 parameter. When resizeEvent is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

Overrides:
resizeEvent in class QWidget
See Also:
moveEvent, event, resize, QResizeEvent, paintEvent, Example

showEvent

protected void showEvent(QShowEvent showEvent)

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

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

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.

Overrides:
showEvent in class QWidget
See Also:
visible, event, QShowEvent

sizeHint

public QSize sizeHint()

Returns the recommended size for the widget.

If the value of this property is an invalid size, no size is recommended.

The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.

Overrides:
sizeHint in class QWidget
See Also:
QSize::isValid, minimumSizeHint, sizePolicy, setMinimumSize, updateGeometry

timerEvent

protected void timerEvent(QTimerEvent timerEvent)

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the arg__1 parameter.

Overrides:
timerEvent in class QObject
See Also:
startTimer, killTimer, event

fromNativePointer

public static QMdiSubWindow fromNativePointer(QNativePointer nativePointer)
This function returns the QMdiSubWindow instance pointed to by nativePointer

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

Qt Jambi Home