Eneboo - Documentación para desarrolladores
|
The QWorkspace widget provides a workspace window that can contain decorated windows, e.g. for MDI. Más...
#include <qworkspace.h>
The QWorkspace widget provides a workspace window that can contain decorated windows, e.g. for MDI.
workspace
MDI (multiple document interface) applications typically have one main window with a menu bar and toolbar, and a central widget that is a QWorkspace. The workspace itself contains zero, one or more document windows, each of which is a widget.
The workspace itself is an ordinary Qt widget. It has a standard constructor that takes a parent widget and an object name. The parent window is usually a QMainWindow, but it need not be.
Document windows (i.e. MDI windows) are also ordinary Qt widgets which have the workspace as their parent widget. When you call show(), hide(), showMaximized(), setCaption(), etc. on a document window, it is shown, hidden, etc. with a frame, caption, icon and icon text, just as you'd expect. You can provide widget flags which will be used for the layout of the decoration or the behaviour of the widget itself.
To change or retrieve the geometry of MDI windows you must operate on the MDI widget's parentWidget(). (The parentWidget() provides access to the decorated window in which the MDI window's widget is shown.)
A document window becomes active when it gets the keyboard focus. You can also activate a window in code using setFocus(). The user can activate a window by moving focus in the usual ways, for example by clicking a window or by pressing Tab. The workspace emits a signal windowActivated() when it detects the activation change, and the function activeWindow() always returns a pointer to the active document window.
The convenience function windowList() returns a list of all document windows. This is useful to create a popup menu "<u>W</u>indows" on the fly, for example.
QWorkspace provides two built-in layout strategies for child windows: cascade() and tile(). Both are slots so you can easily connect menu entries to them.
If you want your users to be able to work with document windows larger than the actual workspace, set the scrollBarsEnabled property to TRUE.
If the top-level window contains a menu bar and a document window is maximised, QWorkspace moves the document window's minimize, restore and close buttons from the document window's frame to the workspace window's menu bar. It then inserts a window operations menu at the far left of the menu bar.
Specifies the order in which windows are returned from windowList().
CreationOrder The windows are returned in the order of their creation StackingOrder The windows are returned in the order of their stacking
QWorkspace::QWorkspace | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructs a workspace with a parent and a name.
QWorkspace::~QWorkspace | ( | ) |
Destroys the workspace and frees any allocated resources.
QWorkspace::QWorkspace | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
QWorkspace::~QWorkspace | ( | ) |
void QWorkspace::activateNextWindow | ( | ) | [slot] |
Activates the next window in the child window chain.
void QWorkspace::activateNextWindow | ( | ) | [slot] |
void QWorkspace::activatePrevWindow | ( | ) | [slot] |
Activates the previous window in the child window chain.
void QWorkspace::activatePrevWindow | ( | ) | [slot] |
QWidget * QWorkspace::activeWindow | ( | ) | const |
Returns the active window, or 0 if no window is active.
QWidget* QWorkspace::activeWindow | ( | ) | const |
void QWorkspace::cascade | ( | ) | [slot] |
void QWorkspace::cascade | ( | ) | [slot] |
Arranges all the child windows in a cascade pattern.
void QWorkspace::childEvent | ( | QChildEvent * | e | ) | [protected, virtual] |
Reimplementado de QObject.
void QWorkspace::childEvent | ( | QChildEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive child events.
Child events are sent to objects when children are inserted or removed.
Note that events with QEvent::type() QEvent::ChildInserted
are posted (with {QApplication::postEvent()}) to make sure that the child's construction is completed before this function is called.
If a child is removed immediately after it is inserted, the ChildInserted
event may be suppressed, but the ChildRemoved
event will always be sent. In such cases it is possible that there will be a ChildRemoved
event without a corresponding ChildInserted
event.
If you change state based on ChildInserted
events, call QWidget::constPolish(), or do
in functions that depend on the state. One notable example is QWidget::sizeHint().
Reimplementado de QObject.
void QWorkspace::closeActiveWindow | ( | ) | [slot] |
void QWorkspace::closeActiveWindow | ( | ) | [slot] |
Closes the child window that is currently active.
void QWorkspace::closeAllWindows | ( | ) | [slot] |
void QWorkspace::closeAllWindows | ( | ) | [slot] |
Closes all child windows.
The windows are closed in random order. The operation stops if a window does not accept the close event.
Reimplementado de QObject.
Filters events if this object has been installed as an event filter for the watched object.
In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.
Example:
class MyMainWindow : public QMainWindow { public: MyMainWindow( QWidget *parent = 0, const char *name = 0 ); protected: bool eventFilter( QObject *obj, QEvent *ev ); private: QTextEdit *textEdit; }; MyMainWindow::MyMainWindow( QWidget *parent, const char *name ) : QMainWindow( parent, name ) { textEdit = new QTextEdit( this ); setCentralWidget( textEdit ); textEdit->installEventFilter( this ); } bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev ) { if ( obj == textEdit ) { if ( e->type() == QEvent::KeyPress ) { QKeyEvent *k = (QKeyEvent*)ev; qDebug( "Ate key press %d", k->key() ); return TRUE; } else { return FALSE; } } else { // pass the event on to the parent class return QMainWindow::eventFilter( obj, ev ); } }
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.
Reimplementado de QObject.
void QWorkspace::hideEvent | ( | QHideEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
void QWorkspace::hideEvent | ( | QHideEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget hide events.
Hide events are sent to widgets immediately after they have been hidden.
Reimplementado de QWidget.
void QWorkspace::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Reimplementado de QWidget.
void QWorkspace::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Widgets that have been created with the WNoAutoErase
flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.
The default implementation calls updateMask() if the widget has automatic masking enabled.
Reimplementado de QWidget.
bool QWorkspace::scrollBarsEnabled | ( | ) | const |
bool QWorkspace::scrollBarsEnabled | ( | ) | const |
void QWorkspace::setPaletteBackgroundPixmap | ( | const QPixmap & | ) | [virtual] |
Reimplementado de QWidget.
void QWorkspace::setPaletteBackgroundPixmap | ( | const QPixmap & | pm | ) | [virtual] |
Reimplementado de QWidget.
void QWorkspace::setScrollBarsEnabled | ( | bool | enable | ) |
void QWorkspace::setScrollBarsEnabled | ( | bool | enable | ) |
void QWorkspace::showEvent | ( | QShowEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget show events.
Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of top-level widgets are delivered afterwards.
Reimplementado de QWidget.
void QWorkspace::showEvent | ( | QShowEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
void QWorkspace::styleChange | ( | QStyle & | ) | [protected, virtual] |
This virtual function is called when the style of the widgets changes. oldStyle is the previous GUI style; you can get the new style from style().
Reimplement this function if your widget needs to know when its GUI style changes. You will almost certainly need to update the widget using update().
The default implementation updates the widget including its geometry.
Reimplementado de QWidget.
void QWorkspace::tile | ( | ) | [slot] |
void QWorkspace::tile | ( | ) | [slot] |
Arranges all child windows in a tile pattern.
void QWorkspace::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual] |
This event handler, for event e, can be reimplemented in a subclass to receive wheel events for the widget.
If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.
The default implementation ignores the event.
Reimplementado de QWidget.
void QWorkspace::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
void QWorkspace::windowActivated | ( | QWidget * | w | ) | [signal] |
void QWorkspace::windowActivated | ( | QWidget * | w | ) | [signal] |
This signal is emitted when the window widget w becomes active. Note that w can be null, and that more than one signal may be emitted for a single activation event.
QWidgetList QWorkspace::windowList | ( | ) | const |
QWidgetList QWorkspace::windowList | ( | WindowOrder | order | ) | const |
QWidgetList QWorkspace::windowList | ( | ) | const |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
QWidgetList QWorkspace::windowList | ( | WindowOrder | order | ) | const |
Returns a list of all windows. If order is CreationOrder (the default) the windows are listed in the order in which they had been inserted into the workspace. If order is StackingOrder the windows are listed in their stacking order, with the topmost window being the last window in the list.
QWidgetList is the same as QPtrList<QWidget>.
QWorkspace::WindowMode QWorkspace::windowMode | ( | ) | const |
WindowMode QWorkspace::windowMode | ( | ) | const |
QWorkspaceChild [friend] |
QWorkspacePrivate [friend] |
bool QWorkspace::scrollBarsEnabled [read, write] |
whether the workspace provides scrollbars
If this property is set to TRUE, it is possible to resize child windows over the right or the bottom edge out of the visible area of the workspace. The workspace shows scrollbars to make it possible for the user to access those windows. If this property is set to FALSE (the default), resizing windows out of the visible area of the workspace is not permitted.