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  · 

Q3WidgetStack Class Reference

The Q3WidgetStack class provides a stack of widgets of which only the top widget is user-visible. More...

 #include <Q3WidgetStack>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits: Q3Frame.

Public Functions

Q3WidgetStack ( QWidget * parent, const char * name = 0, Qt::WindowFlags f = 0 )
~Q3WidgetStack ()
int addWidget ( QWidget * w, int id = -1 )
int id ( QWidget * widget ) const
void removeWidget ( QWidget * w )
QWidget * visibleWidget () const
QWidget * widget ( int id ) const

Reimplemented Public Functions

virtual QSize minimumSizeHint () const
virtual void setVisible ( bool visible )
virtual QSize sizeHint () const
  • 4 public functions inherited from Q3Frame
  • 14 public functions inherited from QFrame
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions inherited from QPaintDevice

Public Slots

void raiseWidget ( int id )
void raiseWidget ( QWidget * w )
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

void aboutToShow ( int id )
void aboutToShow ( QWidget * widget )

Protected Functions

virtual void setChildGeometries ()

Reimplemented Protected Functions

virtual void childEvent ( QChildEvent * e )
virtual bool event ( QEvent * e )
virtual void frameChanged ()
virtual void resizeEvent ( QResizeEvent * e )
  • 5 protected functions inherited from Q3Frame
  • 3 protected functions inherited from QFrame
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 2 properties inherited from Q3Frame
  • 6 properties inherited from QFrame
  • 58 properties inherited from QWidget
  • 1 property inherited from QObject
  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 1 protected slot inherited from QWidget

Detailed Description

The Q3WidgetStack class provides a stack of widgets of which only the top widget is user-visible.

The application programmer can move any widget to the top of the stack at any time using raiseWidget(), and add or remove widgets using addWidget() and removeWidget(). It is not sufficient to pass the widget stack as parent to a widget which should be inserted into the widgetstack.

visibleWidget() is the get equivalent of raiseWidget(); it returns a pointer to the widget that is currently at the top of the stack.

Q3WidgetStack also provides the ability to manipulate widgets through application-specified integer IDs. You can also translate from widget pointers to IDs using id() and from IDs to widget pointers using widget(). These numeric IDs are unique (per Q3WidgetStack, not globally), but Q3WidgetStack does not attach any additional meaning to them.

The default widget stack is frameless, but you can use the usual Q3Frame functions (such as setFrameStyle()) to add a frame.

Q3WidgetStack provides a signal, aboutToShow(), which is emitted just before a managed widget is shown.

See also Q3TabDialog, QTabWidget, QTabBar, and Q3Frame.

Member Function Documentation

Q3WidgetStack::Q3WidgetStack ( QWidget * parent, const char * name = 0, Qt::WindowFlags f = 0 )

Constructs an empty widget stack.

The parent, name and f arguments are passed to the Q3Frame constructor.

Q3WidgetStack::~Q3WidgetStack ()

Destroys the object and frees any allocated resources.

void Q3WidgetStack::aboutToShow ( int id ) [signal]

This signal is emitted just before a managed widget is shown if that managed widget has an ID != -1. The id parameter is the numeric ID of the widget.

If you call visibleWidget() in a slot connected to aboutToShow(), the widget it returns is the one that is currently visible, not the one that is about to be shown.

void Q3WidgetStack::aboutToShow ( QWidget * widget ) [signal]

This is an overloaded function.

This signal is emitted just before a managed widget is shown. The argument is a pointer to the widget.

If you call visibleWidget() in a slot connected to aboutToShow(), the widget returned is the one that is currently visible, not the one that is about to be shown.

int Q3WidgetStack::addWidget ( QWidget * w, int id = -1 )

Adds widget w to this stack of widgets, with ID id.

If you pass an id >= 0 this ID is used. If you pass an id of -1 (the default), the widgets will be numbered automatically. If you pass -2 a unique negative integer will be generated. No widget has an ID of -1. Returns the ID or -1 on failure (e.g. w is 0).

If you pass an id that is already used, then a unique negative integer will be generated to prevent two widgets having the same id.

If w already exists in the stack the widget will be removed first.

If w is not a child of this Q3WidgetStack moves it using reparent().

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

Reimplemented from QObject::childEvent().

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

Reimplemented from QObject::event().

void Q3WidgetStack::frameChanged () [virtual protected]

Reimplemented from Q3Frame::frameChanged().

int Q3WidgetStack::id ( QWidget * widget ) const

Returns the ID of the widget. Returns -1 if widget is 0 or is not being managed by this widget stack.

See also widget() and addWidget().

QSize Q3WidgetStack::minimumSizeHint () const [virtual]

Reimplemented from QWidget::minimumSizeHint().

void Q3WidgetStack::raiseWidget ( int id ) [slot]

Raises the widget with ID id to the top of the widget stack.

See also visibleWidget().

void Q3WidgetStack::raiseWidget ( QWidget * w ) [slot]

This is an overloaded function.

Raises widget w to the top of the widget stack.

void Q3WidgetStack::removeWidget ( QWidget * w )

Removes widget w from this stack of widgets. Does not delete w. If w is the currently visible widget, no other widget is substituted.

See also visibleWidget() and raiseWidget().

void Q3WidgetStack::resizeEvent ( QResizeEvent * e ) [virtual protected]

Reimplemented from QWidget::resizeEvent().

void Q3WidgetStack::setChildGeometries () [virtual protected]

Fixes up the children's geometries.

void Q3WidgetStack::setVisible ( bool visible ) [virtual]

Reimplemented from QWidget::setVisible().

QSize Q3WidgetStack::sizeHint () const [virtual]

Reimplemented from QWidget::sizeHint().

QWidget * Q3WidgetStack::visibleWidget () const

Returns the currently visible widget (the one at the top of the stack), or 0 if nothing is currently being shown.

See also aboutToShow(), id(), and raiseWidget().

QWidget * Q3WidgetStack::widget ( int id ) const

Returns the widget with ID id. Returns 0 if this widget stack does not manage a widget with ID id.

See also id() and addWidget().

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 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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
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