QGIS API Documentation 4.3.0-Master (3b7b3208a79)
Loading...
Searching...
No Matches
QgsToolButtonAction Class Reference

QWidgetAction for adding toolbuttons/actions to the toolbars which are not children of QMainWindow. More...

#include <qgstoolbuttonaction.h>

Inheritance diagram for QgsToolButtonAction:

Public Member Functions

 QgsToolButtonAction (QObject *parent=nullptr)
 Constructor for QgsToolButtonAction.
void addActions (const QList< QAction * > &actions)
 Appends actions to the button's list of actions.
QAction * defaultAction () const
 Returns the default action.
void setAutoRaise (bool autoRaise)
 Sets whether auto-raise is enabled.
void setDefaultAction (QAction *action)
 Sets the default action to action.
void setMenu (QMenu *menu)
 Associates a menu with this tool button.
void setPopupMode (QToolButton::ToolButtonPopupMode mode)
 Sets the popup mode to use for button's popup menu.
void setToolButtonStyle (Qt::ToolButtonStyle style)
 Sets the toolbutton style, e.g.

Protected Member Functions

QWidget * createWidget (QWidget *parent) override

Detailed Description

QWidgetAction for adding toolbuttons/actions to the toolbars which are not children of QMainWindow.

QgsToolButtonAction should be used to add buttons with dropdown menus to make them available in the toolbar extension popup.

Since
QGIS 4.4

Definition at line 40 of file qgstoolbuttonaction.h.

Constructor & Destructor Documentation

◆ QgsToolButtonAction()

QgsToolButtonAction::QgsToolButtonAction ( QObject * parent = nullptr)
explicit

Constructor for QgsToolButtonAction.

Parameters
parentparent widget

Definition at line 25 of file qgstoolbuttonaction.cpp.

Member Function Documentation

◆ addActions()

void QgsToolButtonAction::addActions ( const QList< QAction * > & actions)

Appends actions to the button's list of actions.

This is an alternative to setMenu(), the buttons build their popup menu from these actions. If a menu was set with setMenu() it takes precedence.

See also
setMenu()

Definition at line 88 of file qgstoolbuttonaction.cpp.

◆ createWidget()

QWidget * QgsToolButtonAction::createWidget ( QWidget * parent)
overrideprotected

Definition at line 129 of file qgstoolbuttonaction.cpp.

◆ defaultAction()

QAction * QgsToolButtonAction::defaultAction ( ) const

Returns the default action.

See also
setDefaultAction()

Definition at line 124 of file qgstoolbuttonaction.cpp.

◆ setAutoRaise()

void QgsToolButtonAction::setAutoRaise ( bool autoRaise)

Sets whether auto-raise is enabled.

Definition at line 32 of file qgstoolbuttonaction.cpp.

◆ setDefaultAction()

void QgsToolButtonAction::setDefaultAction ( QAction * action)

Sets the default action to action.

The buttons mirror the default action's icon, text, tooltip and state, and clicking a button triggers it.

Ownership of the action is not transferred.

See also
defaultAction()

Definition at line 105 of file qgstoolbuttonaction.cpp.

◆ setMenu()

void QgsToolButtonAction::setMenu ( QMenu * menu)

Associates a menu with this tool button.

The menu will be shown according to the button's popup mode. Ownership of the menu is not transferred.

See also
setPopupMode()
addActions()

Definition at line 74 of file qgstoolbuttonaction.cpp.

◆ setPopupMode()

void QgsToolButtonAction::setPopupMode ( QToolButton::ToolButtonPopupMode mode)

Sets the popup mode to use for button's popup menu.

See also
setMenu()
addActions()

Definition at line 46 of file qgstoolbuttonaction.cpp.

◆ setToolButtonStyle()

void QgsToolButtonAction::setToolButtonStyle ( Qt::ToolButtonStyle style)

Sets the toolbutton style, e.g.

icon only, text only, or text beside/below the icon.

Definition at line 60 of file qgstoolbuttonaction.cpp.


The documentation for this class was generated from the following files: