QtWindowListMenu Class Reference
The QtWindowListMenu class is a popup menu that displays
the names of the windows in a QWorkspace.
More...
#include <qtwindowlistmenu.h>
List of all member functions.
Public Members
QtWindowListMenu ( QWorkspace * workspace, QWidget * parent = 0, const char * name = 0 )
int
addTo ( const QString & text, QMenuData * menubar, int idx = -1 )
void
removeWindow ( QWidget * w, bool windowDestroyed = false )
Public Slots
Detailed Description
The QtWindowListMenu class is a popup 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
QMenuData) using addTo().
This class inherits publically from QPopupMenu, 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 worspace results in undefined
behaviour.
Member Function Documentation
QtWindowListMenu::QtWindowListMenu ( QWorkspace * workspace, QWidget * parent = 0, const char * name = 0 )
Constructs a QtWindowListMenu object. The parent and name
parameters are passed to the QPopupMenu constructor. 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().
int QtWindowListMenu::addTo ( const QString & text, QMenuData * 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 -1 if this
menu is already assigned to a menubar.
Returns the allocated menu identifier number.
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::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.
This file is part of the Qt Solutions.
Copyright © 2003-2004
Trolltech. All Rights Reserved.