Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QMdiSubWindow Class

TheQMdiSubWindow class provides a subwindow class forQMdiArea.More...

Header:#include <QMdiSubWindow>
Since: Qt 4.3
Inherits:QWidget

Public Types

enumSubWindowOption { RubberBandResize, RubberBandMove }
flagsSubWindowOptions

Properties

Public Functions

QMdiSubWindow(QWidget * parent = 0, Qt::WindowFlags flags = 0)
~QMdiSubWindow()
boolisShaded() const
intkeyboardPageStep() const
intkeyboardSingleStep() const
QMdiArea *mdiArea() const
voidsetKeyboardPageStep(int step)
voidsetKeyboardSingleStep(int step)
voidsetOption(SubWindowOption option, bool on = true)
voidsetSystemMenu(QMenu * systemMenu)
voidsetWidget(QWidget * widget)
QMenu *systemMenu() const
booltestOption(SubWindowOption option) const
QWidget *widget() const

Reimplemented Public Functions

virtual QSizeminimumSizeHint() const
virtual QSizesizeHint() const

Public Slots

  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidaboutToActivate()
voidwindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)

Reimplemented Protected Functions

virtual voidchangeEvent(QEvent * changeEvent)
virtual voidchildEvent(QChildEvent * childEvent)
virtual voidcloseEvent(QCloseEvent * closeEvent)
virtual voidcontextMenuEvent(QContextMenuEvent * contextMenuEvent)
virtual boolevent(QEvent * event)
virtual booleventFilter(QObject * object, QEvent * event)
virtual voidfocusInEvent(QFocusEvent * focusInEvent)
virtual voidfocusOutEvent(QFocusEvent * focusOutEvent)
virtual voidhideEvent(QHideEvent * hideEvent)
virtual voidkeyPressEvent(QKeyEvent * keyEvent)
virtual voidleaveEvent(QEvent * leaveEvent)
virtual voidmouseDoubleClickEvent(QMouseEvent * mouseEvent)
virtual voidmouseMoveEvent(QMouseEvent * mouseEvent)
virtual voidmousePressEvent(QMouseEvent * mouseEvent)
virtual voidmouseReleaseEvent(QMouseEvent * mouseEvent)
virtual voidmoveEvent(QMoveEvent * moveEvent)
virtual voidpaintEvent(QPaintEvent * paintEvent)
virtual voidresizeEvent(QResizeEvent * resizeEvent)
virtual voidshowEvent(QShowEvent * showEvent)
virtual voidtimerEvent(QTimerEvent * timerEvent)
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice

Additional Inherited Members

  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQMdiSubWindow class provides a subwindow class forQMdiArea.

QMdiSubWindow represents a top-level window in aQMdiArea, 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 aQMdiSubWindow is to callQMdiArea::addSubWindow() with the internal widget as the argument. You can also create a subwindow yourself, and set an internal widget by callingsetWidget().

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

Subwindow Handling

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

By default, eachQMdiSubWindow 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. ThesetOption() function is used to enable this behavior.

TheisShaded() 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, callshowShaded().QMdiSubWindow emits thewindowStateChanged() signal whenever the window state has changed (e.g., when the window becomes minimized, or is restored). It also emitsaboutToActivate() 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. ThekeyboardSingleStep andkeyboardPageStep 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.

You can also change the active window with the keyboard. By pressing the control and tab keys at the same time, the next (using the currentWindowOrder) subwindow will be activated. By pressing control, shift, and tab, you will activate the previous window. This is equivalent to callingactivateNextSubWindow() andactivatePreviousSubWindow(). Note that these shortcuts overrides global shortcuts, but not theQMdiAreas shortcuts.

See alsoQMdiArea.

Member Type Documentation

enum QMdiSubWindow::SubWindowOption
flags QMdiSubWindow::SubWindowOptions

This enum describes options that customize the behavior ofQMdiSubWindow.

ConstantValueDescription
QMdiSubWindow::RubberBandResize0x4If you enable this option, a rubber band control is used to represent the subwindow's outline, and the user resizes this instead of the subwindow itself. As a result, the subwindow maintains its original position and size until the resize operation has been completed, at which time it will receive a singleQResizeEvent. By default, this option is disabled.
QMdiSubWindow::RubberBandMove0x8If you enable this option, a rubber band control is used to represent the subwindow's outline, and the user moves this instead of the subwindow itself. As a result, the subwindow remains in its original position until the move operation has completed, at which time aQMoveEvent is sent to the window. By default, this option is disabled.

The SubWindowOptions type is a typedef forQFlags<SubWindowOption>. It stores an OR combination of SubWindowOption values.

Property Documentation

keyboardPageStep :int

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

Access functions:

intkeyboardPageStep() const
voidsetKeyboardPageStep(int step)

See alsokeyboardSingleStep.

keyboardSingleStep :int

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

Access functions:

intkeyboardSingleStep() const
voidsetKeyboardSingleStep(int step)

See alsokeyboardPageStep.

Member Function Documentation

QMdiSubWindow::QMdiSubWindow(QWidget * parent = 0,Qt::WindowFlags flags = 0)

Constructs a newQMdiSubWindow widget. Theparent andflags arguments are passed toQWidget's constructor.

Instead of using addSubWindow(), it is also simply possible to usesetParent() when you add the subwindow to aQMdiArea.

Note that onlyQMdiSubWindows can be set as children ofQMdiArea; you cannot, for instance, write:

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

See alsoQMdiArea::addSubWindow().

QMdiSubWindow::~QMdiSubWindow()

Destroys the subwindow.

See alsoQMdiArea::removeSubWindow().

[signal]void QMdiSubWindow::aboutToActivate()

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

See alsoQMdiArea::subWindowActivated().

[virtual protected]void QMdiSubWindow::changeEvent(QEvent * changeEvent)

Reimplemented fromQWidget::changeEvent().

[virtual protected]void QMdiSubWindow::childEvent(QChildEvent * childEvent)

Reimplemented fromQObject::childEvent().

[virtual protected]void QMdiSubWindow::closeEvent(QCloseEvent * closeEvent)

Reimplemented fromQWidget::closeEvent().

[virtual protected]void QMdiSubWindow::contextMenuEvent(QContextMenuEvent * contextMenuEvent)

Reimplemented fromQWidget::contextMenuEvent().

[virtual protected]bool QMdiSubWindow::event(QEvent * event)

Reimplemented fromQObject::event().

[virtual protected]bool QMdiSubWindow::eventFilter(QObject * object,QEvent * event)

Reimplemented fromQObject::eventFilter().

[virtual protected]void QMdiSubWindow::focusInEvent(QFocusEvent * focusInEvent)

Reimplemented fromQWidget::focusInEvent().

[virtual protected]void QMdiSubWindow::focusOutEvent(QFocusEvent * focusOutEvent)

Reimplemented fromQWidget::focusOutEvent().

[virtual protected]void QMdiSubWindow::hideEvent(QHideEvent * hideEvent)

Reimplemented fromQWidget::hideEvent().

bool QMdiSubWindow::isShaded() const

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.

[virtual protected]void QMdiSubWindow::keyPressEvent(QKeyEvent * keyEvent)

Reimplemented fromQWidget::keyPressEvent().

[virtual protected]void QMdiSubWindow::leaveEvent(QEvent * leaveEvent)

Reimplemented fromQWidget::leaveEvent().

QMdiArea * QMdiSubWindow::mdiArea() const

Returns the area containing this sub-window, or 0 if there is none.

This function was introduced in Qt 4.4.

See alsoQMdiArea::addSubWindow().

[virtual]QSize QMdiSubWindow::minimumSizeHint() const

Reimplemented fromQWidget::minimumSizeHint().

[virtual protected]void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent * mouseEvent)

Reimplemented fromQWidget::mouseDoubleClickEvent().

[virtual protected]void QMdiSubWindow::mouseMoveEvent(QMouseEvent * mouseEvent)

Reimplemented fromQWidget::mouseMoveEvent().

[virtual protected]void QMdiSubWindow::mousePressEvent(QMouseEvent * mouseEvent)

Reimplemented fromQWidget::mousePressEvent().

[virtual protected]void QMdiSubWindow::mouseReleaseEvent(QMouseEvent * mouseEvent)

Reimplemented fromQWidget::mouseReleaseEvent().

[virtual protected]void QMdiSubWindow::moveEvent(QMoveEvent * moveEvent)

Reimplemented fromQWidget::moveEvent().

[virtual protected]void QMdiSubWindow::paintEvent(QPaintEvent * paintEvent)

Reimplemented fromQWidget::paintEvent().

[virtual protected]void QMdiSubWindow::resizeEvent(QResizeEvent * resizeEvent)

Reimplemented fromQWidget::resizeEvent().

void QMdiSubWindow::setOption(SubWindowOption option,bool on = true)

Ifon is true,option is enabled on the subwindow; otherwise it is disabled. SeeSubWindowOption for the effect of each option.

See alsoSubWindowOption andtestOption().

void QMdiSubWindow::setSystemMenu(QMenu * systemMenu)

SetssystemMenu as the current system menu for this subwindow.

By default, eachQMdiSubWindow has a standard system menu.

QActions for the system menu created byQMdiSubWindow 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 byQMdiSubWindow.

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

See alsosystemMenu() andshowSystemMenu().

void QMdiSubWindow::setWidget(QWidget * widget)

Setswidget 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 ofwidget; you do not have to delete it. Any existing internal widget will be removed and reparented to the root window.

See alsowidget().

[virtual protected]void QMdiSubWindow::showEvent(QShowEvent * showEvent)

Reimplemented fromQWidget::showEvent().

[slot]void QMdiSubWindow::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 alsoisShaded().

[slot]void QMdiSubWindow::showSystemMenu()

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

See alsosetSystemMenu() andsystemMenu().

[virtual]QSize QMdiSubWindow::sizeHint() const

Reimplemented fromQWidget::sizeHint().

QMenu * QMdiSubWindow::systemMenu() const

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

See alsosetSystemMenu() andshowSystemMenu().

bool QMdiSubWindow::testOption(SubWindowOption option) const

Returns true ifoption is enabled; otherwise returns false.

See alsoSubWindowOption andsetOption().

[virtual protected]void QMdiSubWindow::timerEvent(QTimerEvent * timerEvent)

Reimplemented fromQObject::timerEvent().

QWidget * QMdiSubWindow::widget() const

Returns the current internal widget.

See alsosetWidget().

[signal]void QMdiSubWindow::windowStateChanged(Qt::WindowStates oldState,Qt::WindowStates newState)

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

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp