Qt:Документация 4.3.2/qtoolbar

Материал из Wiki.crossplatform.ru

Версия от 11:06, 14 ноября 2008; Root (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QToolBar Class Reference
[модуль QtGui ]

The QToolBar class provides a movable panel that contains a set of controls. More...

 #include <QToolBar>

Inherits QWidget.

[править] Свойства

  • 56 свойства унаследованных от QWidget
  • 1 свойство унаследованное от QObject

[править] Открытые функции

  • 201 открытых функций унаследованных от QWidget
  • 29 открытых функций унаследованных от QObject
  • 12 открытых функций унаследованных от QPaintDevice

[править] Открытые слоты

  • 19 открытых слотов унаследованных от QWidget
  • 1 открытый слот унаследованный от QObject

[править] Сигналы

  • 1 сигнал унаследованный от QWidget
  • 1 сигнал унаследованный от QObject

[править] Дополнительные унаследованные члены

  • 4 статических открытых члена унаследованных от QWidget
  • 5 статических открытых члена унаследованных от QObject
  • 38 защищенных функций унаследованных от QWidget
  • 7 защищенных функций унаследованных от QObject
  • 1 защищенная функция унаследованна от QPaintDevice
  • 1 защищенный слот унаследованный от QWidget

[править] Подробное описание

The QToolBar class provides a movable panel that contains a set of controls.

Toolbar buttons are added by adding actions, using addAction() or insertAction(). Groups of buttons can be separated using addSeparator() or insertSeparator(). If a toolbar button is not appropriate, a widget can be inserted instead using addWidget() or insertWidget(); examples of suitable widgets are QSpinBox, QDoubleSpinBox, and QComboBox. When a toolbar button is pressed it emits the actionTriggered() signal.

A toolbar can be fixed in place in a particular area (e.g. at the top of the window), or it can be movable ( isMovable()) between toolbar areas; see allowedAreas() and isAreaAllowed().

When a toolbar is resized in such a way that it is too small to show all the items it contains, an extension button will appear as the last item in the toolbar. Pressing the extension button will pop up a menu containing the items that does not currently fit in the toolbar.

When a QToolBar is not a child of a QMainWindow, it looses the ability to populate the extension pop up with widgets added to the toolbar using addWidget(). Please use widget actions created by inheriting QWidgetAction and implementing QWidgetAction::createWidget() instead. This is a known issue which will be fixed in a future release.

See also QToolButton, QMenu, QAction, and Application Example.


[править] Описание свойств

[править]
allowedAreas : Qt::ToolBarAreas

This property holds areas where the toolbar may be placed.

The default is Qt::AllToolBarAreas.

This property only makes sense if the toolbar is in a QMainWindow.

Функции доступа:

  • Qt::ToolBarAreas allowedAreas () const
  • void setAllowedAreas ( Qt::ToolBarAreas areas )

See also movable.

[править]
floatable : bool

This property holds whether the toolbar can be dragged and dropped as an independent window.

The default is true.

Функции доступа:

  • bool isFloatable () const
  • void setFloatable ( bool floatable )

[править]
floating : const bool

This property holds whether the toolbar is an independent window.

Функции доступа:

  • bool isFloating () const

See also QWidget::isWindow().

[править]
iconSize : QSize

This property holds size of icons in the toolbar.

The default size is determined by the application's style and is derived from the QStyle::PM_ToolBarIconSize pixel metric. It is the maximum size an icon can have. Icons of smaller size will not be scaled up.

Функции доступа:

  • QSize iconSize () const
  • void setIconSize ( const QSize & iconSize )

[править]
movable : bool

This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.

By default, this property is true.

This property only makes sense if the toolbar is in a QMainWindow.

Функции доступа:

  • bool isMovable () const
  • void setMovable ( bool movable )

See also allowedAreas.

[править]
orientation : Qt::Orientation

This property holds orientation of the toolbar.

The default is Qt::Horizontal.

This function should not be used when the toolbar is managed by QMainWindow. You can use QMainWindow::addToolBar() or QMainWindow::insertToolBar() if you wish to move a toolbar (that is already added to a main window) to another Qt::ToolBarArea.

Функции доступа:

  • Qt::Orientation orientation () const
  • void setOrientation ( Qt::Orientation orientation )

[править]
toolButtonStyle : Qt::ToolButtonStyle

This property holds the style of toolbar buttons.

This property defines the style of all tool buttons that are added as QActions. Note that if you add a QToolButton with the addWidget() method, it will not get this button style.

The default is Qt::ToolButtonIconOnly.

Функции доступа:

  • Qt::ToolButtonStyle toolButtonStyle () const
  • void setToolButtonStyle ( Qt::ToolButtonStyle toolButtonStyle )

[править] Описание функций-членов

[править]
QToolBar::QToolBar ( const QString & title, QWidget * parent = 0 )

Constructs a QToolBar with the given parent.

The given window title identifies the toolbar and is shown in the context menu provided by QMainWindow.

See also setWindowTitle().

[править]
QToolBar::QToolBar ( QWidget * parent = 0 )

Constructs a QToolBar with the given parent.

[править]
QToolBar::~QToolBar ()

Destroys the toolbar.

[править]
QAction * QToolBar::actionAt ( const QPoint & p ) const

Returns the action at point p. This function returns zero if no action was found.

See also QWidget::childAt().

[править]
QAction * QToolBar::actionAt ( int x, int y ) const

This is an overloaded member function, provided for convenience.

Returns the action at the point x, y. This function returns zero if no action was found.

[править]
void QToolBar::actionTriggered ( QAction * action ) [signal]

This signal is emitted when an action in this toolbar is triggered. This happens when the action's tool button is pressed, or when the action is triggered in some other way outside the tool bar. The parameter holds the triggered action.

[править]
void QToolBar::addAction ( QAction * action )

Appends the action action to the toolbar's list of actions.

See also QMenu::addAction() and QWidget::addAction().

[править]
QAction * QToolBar::addAction ( const QString & text )

This is an overloaded member function, provided for convenience.

Creates a new action with the given text. This action is added to the end of the toolbar.

[править]
QAction * QToolBar::addAction ( const QIcon & icon, const QString & text )

This is an overloaded member function, provided for convenience.

Creates a new action with the given icon and text. This action is added to the end of the toolbar.

[править]
QAction * QToolBar::addAction ( const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience.

Creates a new action with the given text. This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver.

[править]
QAction * QToolBar::addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience.

Creates a new action with the icon icon and text text. This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver.

[править]
QAction * QToolBar::addSeparator ()

Adds a separator to the end of the toolbar.

See also insertSeparator().

[править]
QAction * QToolBar::addWidget ( QWidget * widget )

Adds the given widget to the toolbar as the toolbar's last item.

If you add a QToolButton with this method, the tools bar's Qt::ToolButtonStyle will not be respected.

Note: You should use QAction::setVisible() to change the visibility of the widget. Using QWidget::setVisible(), QWidget::show() and QWidget::hide() does not work.

See also insertWidget().

[править]
void QToolBar::allowedAreasChanged ( Qt::ToolBarAreas allowedAreas ) [signal]

This signal is emitted when the collection of allowed areas for the toolbar is changed. The new areas in which the toolbar can be positioned are specified by allowedAreas.

See also allowedAreas.

[править]
void QToolBar::clear ()

Removes all actions from the toolbar.

See also removeAction().

[править]
void QToolBar::iconSizeChanged ( const QSize & iconSize ) [signal]

This signal is emitted when the icon size is changed. The iconSize parameter holds the toolbar's new icon size.

See also iconSize and QMainWindow::iconSize.

[править]
QAction * QToolBar::insertSeparator ( QAction * before )

Inserts a separator into the toolbar in front of the toolbar item associated with the before action.

See also addSeparator().

[править]
QAction * QToolBar::insertWidget ( QAction * before, QWidget * widget )

Inserts the given widget in front of the toolbar item associated with the before action.

Note: You should use QAction::setVisible() to change the visibility of the widget. Using QWidget::setVisible(), QWidget::show() and QWidget::hide() does not work.

See also addWidget().

[править]
bool QToolBar::isAreaAllowed ( Qt::ToolBarArea area ) const

Returns true if this toolbar is dockable in the given area; otherwise returns false.

[править]
void QToolBar::movableChanged ( bool movable ) [signal]

This signal is emitted when the toolbar becomes movable or fixed. If the toolbar can be moved, movable is true; otherwise it is false.

See also movable.

[править]
void QToolBar::orientationChanged ( Qt::Orientation orientation ) [signal]

This signal is emitted when the orientation of the toolbar changes. The new orientation is specified by the orientation given.

See also orientation.

[править]
QAction * QToolBar::toggleViewAction () const

Returns a checkable action that can be used to show or hide this toolbar.

The action's text is set to the toolbar's window title.

See also QAction::text and QWidget::windowTitle.

[править]
void QToolBar::toolButtonStyleChanged ( Qt::ToolButtonStyle toolButtonStyle ) [signal]

This signal is emitted when the tool button style is changed. The toolButtonStyle parameter holds the toolbar's new tool button style.

See also toolButtonStyle and QMainWindow::toolButtonStyle.

[править]
QWidget * QToolBar::widgetForAction ( QAction * action ) const

Returns the widget associated with the specified action.

This function was introduced in Qt 4.2.

See also addWidget().


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2