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  · 

Q3ToolBar Class Reference

The Q3ToolBar class provides a movable panel containing widgets such as tool buttons. More...

 #include <Q3ToolBar>

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: Q3DockWindow.

Properties

Public Functions

Q3ToolBar ( const QString & label, Q3MainWindow * parent, Qt::ToolBarDock dock = Qt::DockTop, bool newLine = false, const char * name = 0 )
Q3ToolBar ( const QString & label, Q3MainWindow * mainWindow, QWidget * parent, bool newLine = false, const char * name = 0, Qt::WindowFlags f = 0 )
Q3ToolBar ( Q3MainWindow * parent = 0, const char * name = 0 )
~Q3ToolBar ()
void addSeparator ()
virtual void clear ()
QString label () const
Q3MainWindow * mainWindow () const
virtual void setLabel ( const QString & )
virtual void setStretchableWidget ( QWidget * w )

Reimplemented Public Functions

virtual bool event ( QEvent * e )
virtual QSize minimumSizeHint () const
virtual void setOrientation ( Qt::Orientation o )
virtual void setVisible ( bool visible )
  • 35 public functions inherited from Q3DockWindow
  • 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

Reimplemented Protected Functions

virtual void resizeEvent ( QResizeEvent * e )
  • 7 protected functions inherited from Q3DockWindow
  • 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

  • 4 public slots inherited from Q3DockWindow
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 3 signals inherited from Q3DockWindow
  • 1 signal inherited from QWidget
  • 1 signal inherited from QObject
  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 7 protected functions inherited from Q3DockWindow
  • 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
  • 1 protected slot inherited from QWidget

Detailed Description

The Q3ToolBar class provides a movable panel containing widgets such as tool buttons.

A toolbar is a panel that contains a set of controls, usually represented by small icons. It's purpose is to provide quick access to frequently used commands or options. Within a Q3MainWindow the user can drag toolbars within and between the dock areas. Toolbars can also be dragged out of any dock area to float freely as top-level windows.

Q3ToolBar is a specialization of QDockWindow, and so provides all the functionality of a QDockWindow.

To use Q3ToolBar you simply create a Q3ToolBar as a child of a Q3MainWindow, create a number of QToolButton widgets (or other widgets) in left to right (or top to bottom) order and call addSeparator() when you want a separator. When a toolbar is floated the caption used is the label given in the constructor call. This can be changed with setLabel().

You may use most widgets within a toolbar, with QToolButton and QComboBox being the most common. But note that the toolbar's actions must be Q3Actions.

If you create a new widget on an already visible Q3ToolBar, this widget will automatically become visible without needing a show() call. (This differs from every other Qt widget container. We recommend calling show() anyway since we hope to fix this anomaly in a future release.)

Q3ToolBars, like QDockWindows, are located in Q3DockAreas or float as top-level windows. Q3MainWindow provides four Q3DockAreas (top, left, right and bottom). When you create a new toolbar (as in the example above) as a child of a Q3MainWindow the toolbar will be added to the top dock area. You can move it to another dock area (or float it) by calling Q3MainWindow::moveDockWindow(). Dock areas lay out their windows in lines.

If the main window is resized so that the area occupied by the toolbar is too small to show all its widgets a little arrow button (which looks like a right-pointing chevron, '&#187;') will appear at the right or bottom of the toolbar depending on its orientation. Clicking this button pops up a menu that shows the 'overflowing' items. QToolButtons are represented in the menu using their textLabel property, other QAbstractButton subclasses are represented using their text property, and QComboBoxes are represented as submenus, with the caption text being used in the submenu item.

Usually a toolbar will get precisely the space it needs. However, with setHorizontalStretchable(), setVerticalStretchable() or setStretchableWidget() you can tell the main window to expand the toolbar to fill all available space in the specified orientation.

The toolbar arranges its buttons either horizontally or vertically (see orientation() for details). Generally, Q3DockArea will set the orientation correctly for you, but you can set it yourself with setOrientation() and track any changes by connecting to the orientationChanged() signal.

You can use the clear() method to remove all items from a toolbar.

Toolbar (dock window)

A floating QToolbar (dock window)

See also QToolButton and Q3MainWindow.

Property Documentation

label : QString

This property holds the toolbar's label.

If the toolbar is floated the label becomes the toolbar window's caption. There is no default label text.

Access functions:

QString label () const
virtual void setLabel ( const QString & )

Member Function Documentation

Q3ToolBar::Q3ToolBar ( const QString & label, Q3MainWindow * parent, Qt::ToolBarDock dock = Qt::DockTop, bool newLine = false, const char * name = 0 )

Constructs an empty toolbar.

The toolbar is called name and is a child of parent and is managed by parent. It is initially located in dock area dock and is labeled label. If newLine is true the toolbar will be placed on a new line in the dock area.

Q3ToolBar::Q3ToolBar ( const QString & label, Q3MainWindow * mainWindow, QWidget * parent, bool newLine = false, const char * name = 0, Qt::WindowFlags f = 0 )

Constructs an empty horizontal toolbar.

The toolbar is called name and is a child of parent and is managed by mainWindow. The label and newLine parameters are passed straight to Q3MainWindow::addDockWindow(). name and the widget flags f are passed on to the Q3DockWindow constructor.

Use this constructor if you want to create torn-off (undocked, floating) toolbars or toolbars in the status bar.

Q3ToolBar::Q3ToolBar ( Q3MainWindow * parent = 0, const char * name = 0 )

This is an overloaded function.

Constructs an empty toolbar called name, with parent parent, in its parent's top dock area, without any label and without requiring a newline.

Q3ToolBar::~Q3ToolBar ()

Destructor.

void Q3ToolBar::addSeparator ()

Adds a separator to the right/bottom of the toolbar.

void Q3ToolBar::clear () [virtual]

Deletes all the toolbar's child widgets.

bool Q3ToolBar::event ( QEvent * e ) [virtual]

Reimplemented from QObject::event().

Q3MainWindow * Q3ToolBar::mainWindow () const

Returns a pointer to the Q3MainWindow which manages this toolbar.

QSize Q3ToolBar::minimumSizeHint () const [virtual]

Reimplemented from QWidget::minimumSizeHint().

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

Reimplemented from QWidget::resizeEvent().

void Q3ToolBar::setOrientation ( Qt::Orientation o ) [virtual]

Reimplemented from Q3DockWindow::setOrientation().

void Q3ToolBar::setStretchableWidget ( QWidget * w ) [virtual]

Sets the widget w to be expanded if this toolbar is requested to stretch.

The request to stretch might occur because Q3MainWindow right-justifies the dock area the toolbar is in, or because this toolbar's isVerticalStretchable() or isHorizontalStretchable() is set to true.

If you call this function and the toolbar is not yet stretchable, setStretchable() is called.

See also Q3MainWindow::setRightJustification(), setVerticalStretchable(), and setHorizontalStretchable().

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

Reimplemented from QWidget::setVisible().

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 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. 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
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

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