Home

QtWindowListMenu Class Reference

The QtWindowListMenu class is a menu that displays the names of the windows in a QWorkspace. More...

#include <QtWindowListMenu>

Inherits QMenu.

Public Functions

Public Slots

Additional Inherited Members


Detailed Description

The QtWindowListMenu class is a menu that displays the names of the windows in a QWorkspace.

This class is intended to be used in the "Windows" item in an MDI application's menubar. It keeps track of the workspace and updates its own contents automatically, noting when windows are added, removed or activated. When there are no windows on the workspace it disables itself. Additionally, it provides the standard Window menu entries: "Tile", "Cascade", "Close" and "Close All".

The QtWindowListMenu is added to the menubar (or any descendant of QMenuBar) using addTo().

This class inherits publicly from QMenu, so the items "Tile", "Cascade", "Close" and "Close All" may be modified or removed, and new items may be added. However, removing menu items which correspond to windows on the workspace results in undefined behavior.


Member Function Documentation

QtWindowListMenu::QtWindowListMenu ( QWorkspace * workspace, QWidget * parent = 0, const char * name = 0 )

Constructs a QtWindowListMenu object. The parent parameter is passed to the QMenu constructor, and the name parameter is set as the object name. The workspace parameter specifies which QWorkspace object the menu must keep track of. If it is 0, the QtWindowListMenu will not update itself automatically, although it will still keep track of the state of any windows specified manually using addWindow().

QAction * QtWindowListMenu::addTo ( const QString & text, QMenuBar * menubar, int idx = -1 )

Adds this window list menu to menubar at position idx, with the name text. If idx is -1, the window list menu is appended as the last item on the menubar. Does nothing and returns null if this menu is already assigned to a menubar. Otherwise returns a pointer to the QAction object for the inserted menu item.

void QtWindowListMenu::addWindow ( QWidget * w )   [slot]

Adds the widget w to this QtWindowListMenu. Does nothing if w is already in the menu. Normally it's not necessary to call this function, since QtWindowListMenu automatically adds windows to the list when they are inserted into the QWorkspace specified in the constructor.

void QtWindowListMenu::addWindow ( QWidget * widget, const QIcon & icon )   [slot]

This is an overloaded member function, provided for convenience.

Adds the widget widget to this QtWindowListMenu, and sets the icon of its menu item to be icon.

void QtWindowListMenu::removeWindow ( QWidget * w, bool windowDestroyed = false )

Removes the widget w from this window list menu's list of widgets. If windowDestroyed is true, QtWindowListMenu assumes that w is a pointer to a destroyed object, and will not call w's functions. windowDestroyed has a default value of false. Normally it's not necessary to call this method, as QtWindowListMenu automatically removes windows from the list when they recieve a QCloseEvent.

void QtWindowListMenu::setCascadeIcon ( const QIcon & icon )

Sets icon as the icon of the menu item which cascades the windows in the workspace. If icon is a null icon, then the menu item's icon will be cleared instead of set.

void QtWindowListMenu::setCloseAllIcon ( const QIcon & icon )

Sets icon as the icon of the menu item which closes all windows in the workspace. If icon is a null icon, then the menu item's icon will be cleared instead of set.

void QtWindowListMenu::setCloseIcon ( const QIcon & icon )

Sets icon as the icon of the menu item which closes the current window. If icon is a null icon, then the menu item's icon will be cleared instead of set.

void QtWindowListMenu::setDefaultIcon ( const QIcon & icon )

Sets icon as the default menu item icon for this QtWindowListMenu. The menu items for each of the windows currently listed in the menu will get this as their current icon. New menu items added to the menu will also get this icon by default. If icon is a null icon, then the default icon will be cleared.

void QtWindowListMenu::setEnabled ( bool b )   [virtual slot]

Enables or disables the window list menu, according to the value of b. Normally it is not necessary to call this function, since QtWindowListMenu automatically enables itself whenever there is more than one window present in the workspace.

See also QAction::setEnabled().

void QtWindowListMenu::setTileIcon ( const QIcon & icon )

Sets icon as the icon of the menu item which tiles the windows in the workspace. If icon is a null icon, then the menu item's icon will be cleared instead of set.

void QtWindowListMenu::setWindowIcon ( QWidget * widget, const QIcon & icon )

Sets icon as the icon of the menu item belonging to the widget widget. If icon is a null icon, then the menu item's icon will be cleared instead of set.


Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions