Qt Jambi Home

com.trolltech.qt.gui
Class QMdiArea

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.QFrame
                      extended by com.trolltech.qt.gui.QAbstractScrollArea
                          extended by com.trolltech.qt.gui.QMdiArea
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QMdiArea
extends QAbstractScrollArea

The QMdiArea widget provides an area in which MDI windows are displayed.

QMdiArea functions, essentially, like a window manager for MDI windows. For instance, it draws the windows it manages on itself and arranges them in a cascading or tile pattern. QMdiArea is commonly used as the center widget in a QMainWindow to create MDI applications, but can also be placed in any layout. The following code adds an area to a main window:

        QMainWindow *mainWindow = new QMainWindow;
        mainWindow->setCentralWidget(mdiArea);

Unlike the window managers for top-level windows, all window flags (Qt::WindowFlags) are supported by QMdiArea as long as the flags are supported by the current widget style. If a specific flag is not supported by the style (e.g., the WindowShadeButtonHint), you can still shade the window with showShaded().

Subwindows in QMdiArea are instances of QMdiSubWindow. They are added to an MDI area with addSubWindow. It is common to pass a QWidget, which is set as the internal widget, to this function, but it is also possible to pass a QMdiSubWindow directly.The class inherits QWidget, and you can use the same API as with a normal top-level window when programming. QMdiSubWindow also has behavior that is specific to MDI windows. See the QMdiSubWindow class description for more details.

A subwindow becomes active when it gets the keyboard focus, or when setFocus is called. The user activates a window by moving focus in the usual ways. The MDI area emits the subWindowActivated signal when the active window changes, and the activeSubWindow function returns the active subwindow.

The convenience function subWindowList returns a list of all subwindows. This information could be used in a popup menu containing a list of windows, for example.

QMdiArea provides two built-in layout strategies for subwindows: cascadeSubWindows and tileSubWindows. Both are slots and are easily connected to menu entries.

Note: The default scroll bar property for QMdiArea is Qt::ScrollBarAlwaysOff.

See Also:
QMdiSubWindow

Nested Class Summary
static class QMdiArea.AreaOption
          This enum describes options that customize the behavior of the QMdiArea.
static class QMdiArea.AreaOptions
          This QFlag class provides flags for the int enum.
static class QMdiArea.WindowOrder
          Specifies the order in which child windows are returned from subWindowList.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame
QFrame.Shadow, QFrame.Shape, QFrame.StyleMask
 
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.Signal1<QMdiSubWindow> subWindowActivated
          QMdiArea emits this signal after arg__1 has been activated.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QMdiArea()
          Equivalent to QMdiArea(0).
QMdiArea(QWidget parent)
          Constructs an empty mdi area.
 
Method Summary
 void activateNextSubWindow()
          Gives the keyboard focus to the next window in the list of child windows.
 void activatePreviousSubWindow()
          Gives the keyboard focus to the previous window in the list of child windows.
 QMdiSubWindow activeSubWindow()
          Returns a pointer to the current active subwindow.
 QMdiSubWindow addSubWindow(QWidget widget)
          Equivalent to addSubWindow(widget, 0).
 QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowFlags flags)
          Adds widget as a new subwindow to the MDI area.
 QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowType... flags)
          Adds widget as a new subwindow to the MDI area.
 QBrush background()
          Returns the background brush for the workspace.
 void cascadeSubWindows()
          Arranges all the child windows in a cascade pattern.
protected  void childEvent(QChildEvent childEvent)
          

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

 void closeActiveSubWindow()
          Closes the active subwindow.
 void closeAllSubWindows()
          Closes all subwindows by sending a QCloseEvent to each window.
 QMdiSubWindow currentSubWindow()
          Returns a pointer to the current subwindow, or 0 if there is no current subwindow.
 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.

 boolean eventFilter(QObject object, QEvent event)
          

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

static QMdiArea fromNativePointer(QNativePointer nativePointer)
          This function returns the QMdiArea instance pointed to by nativePointer
 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.

protected  void paintEvent(QPaintEvent paintEvent)
          

This event handler can be reimplemented in a subclass to receive paint events (passed in arg__1), for the viewport widget.

 void removeSubWindow(QWidget widget)
          Removes widget from the MDI area.
protected  void resizeEvent(QResizeEvent resizeEvent)
          

This event handler can be reimplemented in a subclass to receive resize events (passed in arg__1), for the viewport widget.

protected  void scrollContentsBy(int dx, int dy)
          

This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewport's contents should be scrolled accordingly.

 void setActiveSubWindow(QMdiSubWindow window)
          Activates the subwindow window.
 void setBackground(QBrush background)
          Sets the background brush for the workspace to background.
 void setOption(QMdiArea.AreaOption option)
          Equivalent to setOption(option, true).
 void setOption(QMdiArea.AreaOption option, boolean on)
          If on is true, option is enabled on the MDI area; otherwise it is disabled.
protected  void setupViewport(QWidget viewport)
          This slot is called by QAbstractScrollArea after setViewport has been called.
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.

 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.

 java.util.List<QMdiSubWindow> subWindowList()
          Returns a list of all subwindows in the MDI area.
 java.util.List<QMdiSubWindow> subWindowList(QMdiArea.WindowOrder order)
          Returns a list of all subwindows in the MDI area.
 boolean testOption(QMdiArea.AreaOption opton)
          Returns true if opton is enabled; otherwise returns false.
 void tileSubWindows()
          Arranges all child windows in a tile pattern.
protected  void timerEvent(QTimerEvent timerEvent)
          

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

protected  boolean viewportEvent(QEvent event)
          

The main event handler for the scrolling area (the viewport widget).

 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, horizontalScrollBar, horizontalScrollBarPolicy, keyPressEvent, maximumViewportSize, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, paintEngine, scrollBarWidgets, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, verticalScrollBar, verticalScrollBarPolicy, viewport, wheelEvent
 
Methods inherited from class com.trolltech.qt.gui.QFrame
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth
 
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, closeEvent, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, 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, 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

subWindowActivated

public final QSignalEmitter.Signal1<QMdiSubWindow> subWindowActivated

QMdiArea emits this signal after arg__1 has been activated. When arg__1 is 0, QMdiArea has just deactivated its last active window, and there are no active windows on the workspace.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.gui.QMdiSubWindow arg__1)
void mySlot()
See Also:
QMdiArea::activeSubWindow

Constructor Detail

QMdiArea

public QMdiArea()

Equivalent to QMdiArea(0).


QMdiArea

public QMdiArea(QWidget parent)

Constructs an empty mdi area. parent is passed to QWidget's constructor.

Method Detail

activateNextSubWindow

public final void activateNextSubWindow()

Gives the keyboard focus to the next window in the list of child windows. The windows are activated in the order in which they are created (CreationOrder).

See Also:
activatePreviousSubWindow

activatePreviousSubWindow

public final void activatePreviousSubWindow()

Gives the keyboard focus to the previous window in the list of child windows. The windows are activated in the order in which they are created (CreationOrder).

See Also:
activateNextSubWindow

activeSubWindow

public final QMdiSubWindow activeSubWindow()

Returns a pointer to the current active subwindow. If no window is currently active, 0 is returned.

Subwindows are treated as top-level windows with respect to window state, i.e., if a widget outside the MDI area is the active window, no subwindow will be active. Note that if a widget in the window in which the MDI area lives gains focus, the window will be activated.

See Also:
setActiveSubWindow, Qt::WindowState

addSubWindow

public final QMdiSubWindow addSubWindow(QWidget widget,
                                        Qt.WindowType... flags)

Adds widget as a new subwindow to the MDI area. If flags are non-zero, they will override the flags set on the widget.

The widget can be either a QMdiSubWindow or another QWidget (in which case the MDI area will create a subwindow and set the widget as the internal widget).

Note: Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea.

        QMdiArea mdiArea;
        QMdiSubWindow *subWindow1 = new QMdiSubWindow;
        subWindow1->setWidget(internalWidget1);
        subWindow1->setAttribute(Qt::WA_DeleteOnClose);
        mdiArea.addSubWindow(subWindow1);

        QMdiSubWindow *subWindow2 =
            mdiArea.addSubWindow(internalWidget2);

When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.

Returns the QMdiSubWindow that is added to the MDI area.

See Also:
removeSubWindow

addSubWindow

public final QMdiSubWindow addSubWindow(QWidget widget)

Equivalent to addSubWindow(widget, 0).


addSubWindow

public final QMdiSubWindow addSubWindow(QWidget widget,
                                        Qt.WindowFlags flags)

Adds widget as a new subwindow to the MDI area. If flags are non-zero, they will override the flags set on the widget.

The widget can be either a QMdiSubWindow or another QWidget (in which case the MDI area will create a subwindow and set the widget as the internal widget).

Note: Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea.

        QMdiArea mdiArea;
        QMdiSubWindow *subWindow1 = new QMdiSubWindow;
        subWindow1->setWidget(internalWidget1);
        subWindow1->setAttribute(Qt::WA_DeleteOnClose);
        mdiArea.addSubWindow(subWindow1);

        QMdiSubWindow *subWindow2 =
            mdiArea.addSubWindow(internalWidget2);

When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.

Returns the QMdiSubWindow that is added to the MDI area.

See Also:
removeSubWindow

background

public final QBrush background()

Returns the background brush for the workspace.

This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).

See Also:
setBackground

cascadeSubWindows

public final void cascadeSubWindows()

Arranges all the child windows in a cascade pattern.

See Also:
tileSubWindows

closeActiveSubWindow

public final void closeActiveSubWindow()

Closes the active subwindow.

See Also:
closeAllSubWindows

closeAllSubWindows

public final void closeAllSubWindows()

Closes all subwindows by sending a QCloseEvent to each window. You may receive subWindowActivated signals from subwindows before they are closed (if the MDI area activates the subwindow when another is closing).

Subwindows that ignore the close event will remain open.

See Also:
closeActiveSubWindow

currentSubWindow

public final QMdiSubWindow currentSubWindow()

Returns a pointer to the current subwindow, or 0 if there is no current subwindow.

This function will return the same as activeSubWindow if the QApplication containing QMdiArea is active.

See Also:
activeSubWindow, QApplication::activeWindow

removeSubWindow

public final void removeSubWindow(QWidget widget)

Removes widget from the MDI area. The widget must be either a QMdiSubWindow or a widget that is the internal widget of a subwindow. Note that the subwindow is not deleted by QMdiArea and that its parent is set to 0.

See Also:
addSubWindow

setActiveSubWindow

public final void setActiveSubWindow(QMdiSubWindow window)

Activates the subwindow window. If window is 0, any current active window is deactivated.

See Also:
activeSubWindow

setBackground

public final void setBackground(QBrush background)

Sets the background brush for the workspace to background.

This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).

See Also:
background

setOption

public final void setOption(QMdiArea.AreaOption option)

Equivalent to setOption(option, true).


setOption

public final void setOption(QMdiArea.AreaOption option,
                            boolean on)

If on is true, option is enabled on the MDI area; otherwise it is disabled. See AreaOption for the effect of each option.

See Also:
AreaOption, testOption

setupViewport

protected final void setupViewport(QWidget viewport)

This slot is called by QAbstractScrollArea after setViewport has been called. Reimplement this function in a subclass of QMdiArea to initialize the new viewport before it is used.

Overrides:
setupViewport in class QAbstractScrollArea
See Also:
setViewport

subWindowList

public final java.util.List<QMdiSubWindow> subWindowList()
Returns a list of all subwindows in the MDI area.


subWindowList

public final java.util.List<QMdiSubWindow> subWindowList(QMdiArea.WindowOrder order)

Returns a list of all subwindows in the MDI area. If order is CreationOrder (the default), the windows are sorted in the order in which they were inserted into the workspace. If order is StackingOrder, the windows are listed in their stacking order, with the topmost window as the last item in the list.

See Also:
WindowOrder

testOption

public final boolean testOption(QMdiArea.AreaOption opton)

Returns true if opton is enabled; otherwise returns false.

See Also:
AreaOption, setOption

tileSubWindows

public final void tileSubWindows()

Arranges all child windows in a tile pattern.

See Also:
cascadeSubWindows

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

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 QAbstractScrollArea
See Also:
QEvent::type

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

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 QAbstractScrollArea
See Also:
QSize::isValid, resize, setMinimumSize, sizePolicy

paintEvent

protected void paintEvent(QPaintEvent paintEvent)

This event handler can be reimplemented in a subclass to receive paint events (passed in arg__1), for the viewport widget.

Note: If you open a painter, make sure to open it on the viewport.

Overrides:
paintEvent in class QAbstractScrollArea
See Also:
QWidget::paintEvent

resizeEvent

protected void resizeEvent(QResizeEvent resizeEvent)

This event handler can be reimplemented in a subclass to receive resize events (passed in arg__1), for the viewport widget.

When resizeEvent is called, the viewport already has its new geometry: Its new size is accessible through the QResizeEvent::size() function, and the old size through QResizeEvent::oldSize().

Overrides:
resizeEvent in class QAbstractScrollArea
See Also:
QWidget::resizeEvent

scrollContentsBy

protected void scrollContentsBy(int dx,
                                int dy)

This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewport's contents should be scrolled accordingly.

The default implementation simply calls update on the entire viewport, subclasses can reimplement this handler for optimization purposes, or - like QScrollArea - to move a contents widget. The parameters dx and dy are there for convenience, so that the class knows how much should be scrolled (useful e.g. when doing pixel-shifts). You may just as well ignore these values and scroll directly to the position the scroll bars indicate.

Calling this function in order to scroll programmatically is an error, use the scroll bars instead (e.g. by calling QScrollBar::setValue() directly).

Overrides:
scrollContentsBy in class QAbstractScrollArea

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

viewportEvent

protected boolean viewportEvent(QEvent event)

The main event handler for the scrolling area (the viewport widget). It handles the arg__1 specified, and can be called by subclasses to provide reasonable default behavior.

Returns true to indicate to the event system that the event has been handled, and needs no further processing; otherwise returns false to indicate that the event should be propagated further.

You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

Specialised handlers for viewport events are: paintEvent, mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, mouseMoveEvent, wheelEvent, dragEnterEvent, dragMoveEvent, dragLeaveEvent, dropEvent, contextMenuEvent, and resizeEvent.

Overrides:
viewportEvent in class QAbstractScrollArea

fromNativePointer

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

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

Qt Jambi Home