Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos protegidos | Propiedades | Amigas
Referencia de la Clase QToolBar

The QToolBar class provides a movable panel containing widgets such as tool buttons. Más...

#include <qtoolbar.h>

Diagrama de herencias de QToolBar
QDockWindow QDockWindow QFrame QFrame QFrame QFrame QWidget QWidget QWidget QWidget QWidget QWidget QWidget QWidget QDesignerToolBar

Lista de todos los miembros.

Métodos públicos

 QToolBar (const QString &label, QMainWindow *, ToolBarDock=DockTop, bool newLine=FALSE, const char *name=0)
 QToolBar (const QString &label, QMainWindow *, QWidget *, bool newLine=FALSE, const char *name=0, WFlags f=0)
 QToolBar (QMainWindow *parent=0, const char *name=0)
 ~QToolBar ()
void addSeparator ()
void show ()
void hide ()
QMainWindowmainWindow () const
virtual void setStretchableWidget (QWidget *)
bool event (QEvent *e)
virtual void setLabel (const QString &)
QString label () const
virtual void clear ()
QSize minimumSize () const
QSize minimumSizeHint () const
void setOrientation (Orientation o)
void setMinimumSize (int minw, int minh)
 QToolBar (const QString &label, QMainWindow *, ToolBarDock=DockTop, bool newLine=FALSE, const char *name=0)
 QToolBar (const QString &label, QMainWindow *, QWidget *, bool newLine=FALSE, const char *name=0, WFlags f=0)
 QToolBar (QMainWindow *parent=0, const char *name=0)
 ~QToolBar ()
void addSeparator ()
void show ()
void hide ()
QMainWindowmainWindow () const
virtual void setStretchableWidget (QWidget *)
bool event (QEvent *e)
virtual void setLabel (const QString &)
QString label () const
virtual void clear ()
QSize minimumSize () const
QSize minimumSizeHint () const
void setOrientation (Orientation o)
void setMinimumSize (int minw, int minh)

Métodos protegidos

void resizeEvent (QResizeEvent *e)
void styleChange (QStyle &)
void resizeEvent (QResizeEvent *e)
void styleChange (QStyle &)

Propiedades

QString label
 the toolbar's label.

Amigas

class QMainWindow

Descripción detallada

The QToolBar 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 QMainWindow 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.

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

To use QToolBar you simply create a QToolBar as a child of a QMainWindow, 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().

action/application.cpp new QToolBar fileSaveAction

This extract from the application/application.cpp example shows the creation of a new toolbar as a child of a QMainWindow and adding two QActions.

You may use most widgets within a toolbar, with QToolButton and QComboBox being the most common.

If you create a new widget on an already visible QToolBar, 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.)

QToolBars, like QDockWindows, are located in {QDockArea}s or float as top-level windows. QMainWindow provides four QDockAreas (top, left, right and bottom). When you create a new toolbar (as in the example above) as a child of a QMainWindow the toolbar will be added to the top dock area. You can move it to another dock area (or float it) by calling QMainWindow::moveDockWindow(). QDock 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 QButton 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, QDockArea 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.

qdockwindow.png Toolbar (dock window) A floating QToolbar (dock window)

Ver también:
QToolButton QMainWindow Parts of Isys on Visual Design GUI Design Handbook: Tool Bar.

Documentación del constructor y destructor

QToolBar::QToolBar ( const QString label,
QMainWindow parent,
QMainWindow::ToolBarDock  dock = 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.

QToolBar::QToolBar ( const QString label,
QMainWindow mainWindow,
QWidget parent,
bool  newLine = FALSE,
const char *  name = 0,
WFlags  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 QMainWindow::addDockWindow(). name and the widget flags f are passed on to the QDockWindow constructor.

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

QToolBar::QToolBar ( QMainWindow parent = 0,
const char *  name = 0 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Constructs an empty toolbar called name, with parent parent, in its parent's top dock area, without any label and without requiring a newline.

QToolBar::~QToolBar ( )
QToolBar::QToolBar ( const QString label,
QMainWindow ,
ToolBarDock  = DockTop,
bool  newLine = FALSE,
const char *  name = 0 
)
QToolBar::QToolBar ( const QString label,
QMainWindow ,
QWidget ,
bool  newLine = FALSE,
const char *  name = 0,
WFlags  f = 0 
)
QToolBar::QToolBar ( QMainWindow parent = 0,
const char *  name = 0 
)
QToolBar::~QToolBar ( )

Documentación de las funciones miembro

void QToolBar::addSeparator ( )

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

void QToolBar::addSeparator ( )
void QToolBar::clear ( void  ) [virtual]

Deletes all the toolbar's child widgets.

Reimplementado en QDesignerToolBar.

virtual void QToolBar::clear ( ) [virtual]

Reimplementado en QDesignerToolBar.

bool QToolBar::event ( QEvent e) [virtual]

Reimplementado de QDockWindow.

bool QToolBar::event ( QEvent e) [virtual]

Reimplementado de QDockWindow.

void QToolBar::hide ( ) [virtual]

Hides the widget.

You almost never have to reimplement this function. If you need to do something after a widget is hidden, use hideEvent() instead.

Ver también:
hideEvent(), isHidden(), show(), showMinimized(), isVisible(), close()

Reimplementado de QWidget.

void QToolBar::hide ( ) [virtual]

Reimplementado de QWidget.

QString QToolBar::label ( ) const
QString QToolBar::label ( ) const
QMainWindow * QToolBar::mainWindow ( ) const

Returns a pointer to the QMainWindow which manages this toolbar.

QMainWindow* QToolBar::mainWindow ( ) const
QSize QToolBar::minimumSize ( ) const

Reimplementado de QDockWindow.

QSize QToolBar::minimumSize ( ) const

Reimplementado de QDockWindow.

QSize QToolBar::minimumSizeHint ( ) const [virtual]

Reimplementado de QDockWindow.

QSize QToolBar::minimumSizeHint ( ) const [virtual]

Reimplementado de QDockWindow.

void QToolBar::resizeEvent ( QResizeEvent e) [protected, virtual]

Reimplementado de QDockWindow.

void QToolBar::resizeEvent ( QResizeEvent e) [protected, virtual]

Reimplementado de QDockWindow.

virtual void QToolBar::setLabel ( const QString ) [virtual]
void QToolBar::setLabel ( const QString label) [virtual]
void QToolBar::setMinimumSize ( int  minw,
int  minh 
) [virtual]

Sets the minimum size of the widget to w by h pixels.

The widget cannot be resized to a smaller size than the minimum widget size. The widget's size is forced to the minimum size if the current size is smaller.

If you use a layout inside the widget, the minimum size will be set by the layout and not by setMinimumSize, unless you set the layouts resize mode to QLayout::FreeResize.

Ver también:
minimumSize(), setMaximumSize(), setSizeIncrement(), resize(), size(), QLayout::setResizeMode()

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This function corresponds to setMinimumSize( QSize(minw, minh) ). Sets the minimum width to minw and the minimum height to minh.

Reimplementado de QWidget.

void QToolBar::setMinimumSize ( int  minw,
int  minh 
) [virtual]

Reimplementado de QWidget.

void QToolBar::setOrientation ( Orientation  o)
void QToolBar::setOrientation ( Orientation  o)
virtual void QToolBar::setStretchableWidget ( QWidget ) [virtual]
void QToolBar::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 QMainWindow 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.

Ver también:
QMainWindow::setRightJustification(), setVerticalStretchable(), setHorizontalStretchable()
void QToolBar::show ( ) [virtual]

Shows the widget and its child widgets.

If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown.

You almost never have to reimplement this function. If you need to change some settings before a widget is shown, use showEvent() instead. If you need to do some delayed initialization use polish().

Ver también:
showEvent(), hide(), showMinimized(), showMaximized(), showNormal(), isVisible(), polish()

Reimplementado de QWidget.

void QToolBar::show ( ) [virtual]

.

Reimplementado de QWidget.

void QToolBar::styleChange ( QStyle ) [protected, virtual]

Reimplementado de QFrame.

void QToolBar::styleChange ( QStyle old) [protected, virtual]

Reimplementado de QFrame.


Documentación de las funciones relacionadas y clases amigas

QMainWindow [friend]

Reimplementado de QDockWindow.


Documentación de propiedades

QString QToolBar::label [read, write]

the toolbar's label.

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


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'