|
Canorus
0.7
|
Tool button with a menu at the side and a button box when clicked on. More...
#include <menutoolbutton.h>

Public Slots | |
| void | onButtonPressed (int) |
Public Member Functions | |
| CAMenuToolButton (QString title, int numIconsRow=4, QWidget *parent=0) | |
| ~CAMenuToolButton () | |
| void | addButton (const QIcon icon, int buttonId, const QString toolTip="") |
| QAbstractButton * | getButton (int buttonId) |
| QList< QToolButton * > | buttonList () |
| int | spacing () |
| int | layoutMargin () |
| int | margin () |
| int | numIconsPerRow () |
| void | setSpacing (int spacing) |
| void | setLayoutMargin (int margin) |
| void | setMargin (int margin) |
| void | setNumIconsPerRow (int numIconsRow) |
| void | setCurrentId (int id, bool triggerSignal=false) |
| void | showButtons () |
Private Member Functions | |
| void | wheelEvent (QWheelEvent *) |
Private Attributes | |
| QButtonGroup * | _buttonGroup |
| QGroupBox * | _groupBox |
| QGridLayout * | _boxLayout |
| QGridLayout * | _menuLayout |
| QList< QToolButton * > | _buttonList |
| QHash< QString, int > | _buttonIds |
| int | _buttonXPos |
| int | _buttonYPos |
| int | _numIconsRow |
| int | _spacing |
| int | _margin |
| int | _layoutMargin |
Tool button with a menu at the side and a button box when clicked on.
This widget looks like a button with a small dropdown arrow at the side which opens a button group box of various elements. User can add buttons by calling addButton(QIcon icon, int Id). When the element is selected, the action's icon is switched to the selected element's and a signal toggled(bool checked, int id) is emitted.
The class primarily consists of 3 elements:
| CAMenuToolButton::CAMenuToolButton | ( | QString | title, |
| int | numIconsRow = 4, |
||
| QWidget * | parent = 0 |
||
| ) |
Constructs the button menu with the given title and parent.
References _boxLayout, _buttonGroup, _buttonXPos, _buttonYPos, _groupBox, layoutMargin(), onButtonPressed(), CAToolButton::setDefaultAction(), setLayoutMargin(), setMargin(), setNumIconsPerRow(), CAToolButton::setPopupWidget(), setSpacing(), and spacing().

Destructs the button menu.
References _buttonGroup, _buttonList, and _groupBox.
| void CAMenuToolButton::addButton | ( | const QIcon | icon, |
| int | buttonId, | ||
| const QString | toolTip = "" |
||
| ) |
Adds a Tool button to the menu with the given icon and buttonId.
References _boxLayout, _buttonGroup, _buttonList, _buttonXPos, _buttonYPos, _groupBox, _margin, _spacing, and numIconsPerRow().
Referenced by CAMainWin::createCustomActions().


| QList<QToolButton*> CAMenuToolButton::buttonList | ( | ) | [inline] |
| QAbstractButton* CAMenuToolButton::getButton | ( | int | buttonId | ) | [inline] |
References _buttonGroup.
| int CAMenuToolButton::layoutMargin | ( | ) | [inline] |
References _layoutMargin.
Referenced by CAMenuToolButton().

| int CAMenuToolButton::margin | ( | ) | [inline] |
References _margin.
Referenced by setLayoutMargin(), and setMargin().

| int CAMenuToolButton::numIconsPerRow | ( | ) | [inline] |
| void CAMenuToolButton::onButtonPressed | ( | int | id | ) | [slot] |
Hides the buttons menu, changes the current id and emits the toggled() signal.
References _buttonGroup, CAToolButton::hideButtons(), setCurrentId(), and CAToolButton::toggled().
Referenced by CAMenuToolButton().


| void CAMenuToolButton::setCurrentId | ( | int | id, |
| bool | triggerSignal = false |
||
| ) |
Sets the currently selected item by passing the item index. The current icon of the button is changed to the item ones. The current tool tip is also changed.
Does not change the current item, if the item is not part of the button box. If triggerSignal is False (default) it doesn't emit toggled(), otherwise it does.
References _buttonGroup, and CAToolButton::toggled().
Referenced by CAMainWin::on_uiDynamicCustomText_returnPressed(), CAMainWin::on_uiTimeSigBeat_valueChanged(), CAMainWin::on_uiTimeSigBeats_valueChanged(), onButtonPressed(), CAMainWin::scoreViewPortKeyPress(), CAMainWin::setupCustomUi(), CAMainWin::updateDynamicToolBar(), CAMainWin::updateFermataToolBar(), CAMainWin::updateFingeringToolBar(), CAMainWin::updateFMToolBar(), CAMainWin::updatePlayableToolBar(), CAMainWin::updateRepeatMarkToolBar(), CAMainWin::updateTempoToolBar(), CAMainWin::updateVoiceToolBar(), and wheelEvent().


| void CAMenuToolButton::setLayoutMargin | ( | int | margin | ) | [inline] |
References _layoutMargin, and margin().
Referenced by CAMenuToolButton().


| void CAMenuToolButton::setMargin | ( | int | margin | ) | [inline] |
References _margin, and margin().
Referenced by CAMenuToolButton().


| void CAMenuToolButton::setNumIconsPerRow | ( | int | numIconsRow | ) | [inline] |
References _numIconsRow.
Referenced by CAMenuToolButton().

| void CAMenuToolButton::setSpacing | ( | int | spacing | ) | [inline] |
References _spacing, and spacing().
Referenced by CAMenuToolButton().


| void CAMenuToolButton::showButtons | ( | ) | [virtual] |
Set the current button, then show the popup widget.
Reimplemented from CAToolButton.
References _buttonGroup, and CAToolButton::currentId().

| int CAMenuToolButton::spacing | ( | ) | [inline] |
References _spacing.
Referenced by CAMenuToolButton(), and setSpacing().

| void CAMenuToolButton::wheelEvent | ( | QWheelEvent * | event | ) | [private, virtual] |
Cycle through properties using the mouse wheel.
Implements CAToolButton.
References _buttonGroup, buttonList(), CAToolButton::currentId(), setCurrentId(), and CAToolButton::toggled().

QGridLayout* CAMenuToolButton::_boxLayout [private] |
Referenced by addButton(), and CAMenuToolButton().
QButtonGroup* CAMenuToolButton::_buttonGroup [private] |
Referenced by addButton(), CAMenuToolButton(), getButton(), onButtonPressed(), setCurrentId(), showButtons(), wheelEvent(), and ~CAMenuToolButton().
QHash<QString, int> CAMenuToolButton::_buttonIds [private] |
QList<QToolButton*> CAMenuToolButton::_buttonList [private] |
Referenced by addButton(), buttonList(), and ~CAMenuToolButton().
int CAMenuToolButton::_buttonXPos [private] |
Referenced by addButton(), and CAMenuToolButton().
int CAMenuToolButton::_buttonYPos [private] |
Referenced by addButton(), and CAMenuToolButton().
QGroupBox* CAMenuToolButton::_groupBox [private] |
Referenced by addButton(), CAMenuToolButton(), and ~CAMenuToolButton().
int CAMenuToolButton::_layoutMargin [private] |
Referenced by layoutMargin(), and setLayoutMargin().
int CAMenuToolButton::_margin [private] |
Referenced by addButton(), margin(), and setMargin().
QGridLayout* CAMenuToolButton::_menuLayout [private] |
int CAMenuToolButton::_numIconsRow [private] |
Referenced by numIconsPerRow(), and setNumIconsPerRow().
int CAMenuToolButton::_spacing [private] |
Referenced by addButton(), setSpacing(), and spacing().
1.8.0