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

QMainWindow Class Reference

The QMainWindow class provides a main application window. More...

#include <QMainWindow>

Inherits QWidget.

Writable Properties

Read-Only Properties

Public Functions

Public Slots

Signals

Static Public Members

Protected Functions


Detailed Description

The QMainWindow class provides a main application window.

QMainWindow provides a main application window, with a menu bar, tool bars, dock windows and a status bar around a large central widget, such as a text edit, drawing canvas or QWorkspace (for MDI applications).

See also QDockWindow and QToolBar.


Property Documentation

iconSize : Qt::IconSize

This property holds size of toolbar icons in this mainwindow.

The default is Qt::AutomaticIconSize.

Access functions:

toolButtonStyle : Qt::ToolButtonStyle

This property holds style of toolbar buttons in this mainwindow.

The default is Qt::ToolButtonIconOnly.

Access functions:


Member Function Documentation

QMainWindow::QMainWindow ( QWidget * parent = 0, Qt::WFlags flags = 0 )

Constructs a QMainWindow with the given parent and the specified widget flags.

QMainWindow::~QMainWindow ()

Destroys the main window.

void QMainWindow::addDockWindow ( Qt::DockWindowArea area, QDockWindow * dockwindow )

void QMainWindow::addToolBar ( Qt::ToolBarArea area, QToolBar * toolbar )

Adds the toolbar into the specified area in this main window. The toolbar is placed at the end of the current tool bar block (i.e. line).

See also insertToolBar(), addToolBarBlock(), and insertToolBarBlock().

void QMainWindow::addToolBar ( QToolBar * toolbar )

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

Equivalent of calling addToolBar(Qt::ToolBarAreaTop, toolbar)

void QMainWindow::addToolBarBreak ( Qt::ToolBarArea area )

QWidget * QMainWindow::centralWidget () const

Returns the central widget for the main window. This function returns zero if the central widget has not been set.

See also setCentralWidget().

Qt::DockWindowArea QMainWindow::corner ( Qt::Corner corner ) const

Returns the dock window area that occupies the specified corner.

See also setCorner().

QMenu * QMainWindow::createPopupMenu ()   [virtual]

This function is called to create a popup menu when the user right-clicks a toolbar or dock window. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller.

Qt::DockWindowArea QMainWindow::dockWindowArea ( QDockWindow * dockwindow ) const

Returns the Qt::DockWindowArea for dockwindow.

See also addDockWindow(), extendDockWindowArea(), splitDockWindow(), and Qt::DockWindowArea.

void QMainWindow::extendDockWindowArea ( Qt::DockWindowArea area, QDockWindow * dockwindow, Qt::Orientation orientation )

void QMainWindow::iconSizeChanged ( Qt::IconSize iconSize )   [signal]

void QMainWindow::insertToolBar ( QToolBar * before, QToolBar * toolbar )

Inserts the toolbar into the specified area in this main window. The toolbar is placed before the toolbar before.

See also insertToolBarBlock(), addToolBar(), and addToolBarBlock().

void QMainWindow::insertToolBarBreak ( QToolBar * before )

QMenuBar * QMainWindow::menuBar () const

Returns the menu bar for the main window. This function creates and returns an empty menu bar if the menu bar does not exist.

See also setMenuBar().

void QMainWindow::removeDockWindow ( QDockWindow * dockwindow )

Removes the dockwindow from the main window.

void QMainWindow::removeToolBar ( QToolBar * toolbar )

Removes the toolbar from the main window.

bool QMainWindow::restoreState ( const QByteArray & state, int version = 0 )

Restores the state of this mainwindow's toolbars and dockwindows. The version number is compared with that stored in state. If they do not match, the mainwindow's state is left unchanged, and this function returns false; otherwise, the state is restored, and this function returns true.

See also saveState().

QByteArray QMainWindow::saveState ( int version = 0 ) const

Saves the current state of this mainwindow's toolbars and dockwindows. The version number is stored as part of the data.

To restore the saved state, pass the return value and version number to restoreState().

See also restoreState().

void QMainWindow::setCentralWidget ( QWidget * widget )

Sets the given widget to be the main window's central widget.

Warning: This function should be called at most once for each main window instance

See also centralWidget().

void QMainWindow::setCorner ( Qt::Corner corner, Qt::DockWindowArea area )

Sets the given dock window area to occupy the specified corner.

See also corner().

void QMainWindow::setMenuBar ( QMenuBar * menubar )

Sets the menu bar for the main window to menubar.

See also menuBar().

void QMainWindow::setStatusBar ( QStatusBar * statusbar )

Sets the status bar for the main window to statusbar.

See also statusBar().

void QMainWindow::splitDockWindow ( QDockWindow * after, QDockWindow * dockwindow, Qt::Orientation orientation )

QStatusBar * QMainWindow::statusBar () const

Returns the status bar for the main window. This function creates and returns an empty status bar if the status bar does not exist.

See also setStatusBar().

Qt::ToolBarArea QMainWindow::toolBarArea ( QToolBar * toolbar ) const

Returns the tool bar area for toolbar.

See also addToolBar(), addToolBarBlock(), and Qt::ToolBarArea.

void QMainWindow::toolButtonStyleChanged ( Qt::ToolButtonStyle toolButtonStyle )   [signal]


Copyright © 2004 Trolltech Trademarks
Qt 4.0.0-b1