Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QWorkspace Class Reference

The QWorkspace widget provides a workspace window that can be used in an MDI application. More...

 #include <QWorkspace>

This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits: QWidget.

Public Types

enum WindowOrder { CreationOrder, StackingOrder }

Properties

  • 58 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

QWorkspace ( QWidget * parent = 0 )
~QWorkspace ()
QWidget * activeWindow () const
QWidget * addWindow ( QWidget * w, Qt::WindowFlags flags = 0 )
QBrush background () const
bool scrollBarsEnabled () const
void setBackground ( const QBrush & background )
void setScrollBarsEnabled ( bool enable )
QWidgetList windowList ( WindowOrder order = CreationOrder ) const

Reimplemented Public Functions

virtual QSize sizeHint () const
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions inherited from QPaintDevice

Public Slots

void activateNextWindow ()
void activatePreviousWindow ()
void arrangeIcons ()
void cascade ()
void closeActiveWindow ()
void closeAllWindows ()
void setActiveWindow ( QWidget * w )
void tile ()
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

void windowActivated ( QWidget * w )

Reimplemented Protected Functions

virtual void changeEvent ( QEvent * ev )
virtual void childEvent ( QChildEvent * e )
virtual bool event ( QEvent * e )
virtual bool eventFilter ( QObject * o, QEvent * e )
virtual void hideEvent ( QHideEvent * e )
virtual void paintEvent ( QPaintEvent * e )
virtual void resizeEvent ( QResizeEvent * )
virtual void showEvent ( QShowEvent * e )
virtual void wheelEvent ( QWheelEvent * e )
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget

Detailed Description

The QWorkspace widget provides a workspace window that can be used in an MDI application.

This class is deprecated. Use QMdiArea instead.

Multiple Document Interface (MDI) applications are typically composed of a main window containing a menu bar, a toolbar, and a central QWorkspace widget. The workspace itself is used to display a number of child 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. Workspaces can be placed in any layout, but are typically given as the central widget in a QMainWindow:

 MainWindow::MainWindow()
 {
     workspace = new QWorkspace;
     setCentralWidget(workspace);
     ...
 }

Child windows (MDI windows) are standard Qt widgets that are inserted into the workspace with addWindow(). As with top-level widgets, you can call functions such as show(), hide(), showMaximized(), and setWindowTitle() on a child window to change its appearance within the workspace. You can also provide widget flags to determine the layout of the decoration or the behavior of the widget itself.

To change or retrieve the geometry of a child window, you must operate on its parentWidget(). The parentWidget() provides access to the decorated frame that contains the child window widget. When a child window is maximised, its decorated frame is hidden. If the top-level widget contains a menu bar, it will display the maximised window's operations menu to the left of the menu entries, and the window's controls to the right.

A child window becomes active when it gets the keyboard focus, or when setFocus() is called. 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 the active window changes, and the function activeWindow() returns a pointer to the active child window, or 0 if no window is active.

The convenience function windowList() returns a list of all child windows. This information could be used in a popup menu containing a list of windows, for example. This feature is also available as part of the Window Menu Solution.

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 child windows larger than the visible workspace area, set the scrollBarsEnabled property to true.

See also QDockWidget and MDI Example.

Member Type Documentation

enum QWorkspace::WindowOrder

Specifies the order in which child windows are returned from windowList().

ConstantValueDescription
QWorkspace::CreationOrder0The windows are returned in the order of their creation
QWorkspace::StackingOrder1The windows are returned in the order of their stacking

Property Documentation

background : QBrush

This property holds the workspace's background.

Access functions:

QBrush background () const
void setBackground ( const QBrush & background )

scrollBarsEnabled : bool

This property holds whether the workspace provides scroll bars.

If this property is true, the workspace will provide scroll bars if any of the child windows extend beyond the edges of the visible workspace. The workspace area will automatically increase to contain child windows if they are resized beyond the right or bottom edges of the visible area.

If this property is false (the default), resizing child windows out of the visible area of the workspace is not permitted, although it is still possible to position them partially outside the visible area.

Access functions:

bool scrollBarsEnabled () const
void setScrollBarsEnabled ( bool enable )

Member Function Documentation

QWorkspace::QWorkspace ( QWidget * parent = 0 )

Constructs a workspace with the given parent.

QWorkspace::~QWorkspace ()

Destroys the workspace and frees any allocated resources.

void QWorkspace::activateNextWindow () [slot]

Gives the input focus to the next window in the list of child windows.

See also activatePreviousWindow().

void QWorkspace::activatePreviousWindow () [slot]

Gives the input focus to the previous window in the list of child windows.

See also activateNextWindow().

QWidget * QWorkspace::activeWindow () const

Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.

See also setActiveWindow().

QWidget * QWorkspace::addWindow ( QWidget * w, Qt::WindowFlags flags = 0 )

Adds widget w as new sub window to the workspace. If flags are non-zero, they will override the flags set on the widget.

Returns the widget used for the window frame.

To remove the widget w from the workspace, simply call setParent() with the new parent (or 0 to make it a stand-alone window).

void QWorkspace::arrangeIcons () [slot]

Arranges all iconified windows at the bottom of the workspace.

See also cascade() and tile().

void QWorkspace::cascade () [slot]

Arranges all the child windows in a cascade pattern.

See also tile() and arrangeIcons().

void QWorkspace::changeEvent ( QEvent * ev ) [virtual protected]

Reimplemented from QWidget::changeEvent().

void QWorkspace::childEvent ( QChildEvent * e ) [virtual protected]

Reimplemented from QObject::childEvent().

void QWorkspace::closeActiveWindow () [slot]

Closes the child window that is currently active.

See also closeAllWindows().

void QWorkspace::closeAllWindows () [slot]

Closes all child windows.

If any child window fails to accept the close event, the remaining windows will remain open.

See also closeActiveWindow().

bool QWorkspace::event ( QEvent * e ) [virtual protected]

Reimplemented from QObject::event().

bool QWorkspace::eventFilter ( QObject * o, QEvent * e ) [virtual protected]

Reimplemented from QObject::eventFilter().

void QWorkspace::hideEvent ( QHideEvent * e ) [virtual protected]

Reimplemented from QWidget::hideEvent().

void QWorkspace::paintEvent ( QPaintEvent * e ) [virtual protected]

Reimplemented from QWidget::paintEvent().

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

Reimplemented from QWidget::resizeEvent().

void QWorkspace::setActiveWindow ( QWidget * w ) [slot]

Makes the child window that contains w the active child window.

See also activeWindow().

void QWorkspace::showEvent ( QShowEvent * e ) [virtual protected]

Reimplemented from QWidget::showEvent().

QSize QWorkspace::sizeHint () const [virtual]

Reimplemented from QWidget::sizeHint().

void QWorkspace::tile () [slot]

Arranges all child windows in a tile pattern.

See also cascade() and arrangeIcons().

void QWorkspace::wheelEvent ( QWheelEvent * e ) [virtual protected]

Reimplemented from QWidget::wheelEvent().

void QWorkspace::windowActivated ( QWidget * w ) [signal]

This signal is emitted when the child window w becomes active. Note that w can be 0, and that more than one signal may be emitted for a single activation event.

See also activeWindow() and windowList().

QWidgetList QWorkspace::windowList ( WindowOrder order = CreationOrder ) const

Returns a list of all visible or minimized child windows. If order is CreationOrder (the default), the windows are listed in the order in which they were inserted into the workspace. If order is StackingOrder, the windows are listed in their stacking order, with the topmost window as the last item in the list.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 102
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 53
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 79
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 28
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 229
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 102
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le Qt Quarterly au hasard

Logo

La sortie retentissante de Qt 4.5.0

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web