Canorus 0.0
Public Slots | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CAMenuToolButton Class Reference

Tool button with a menu at the side and a button box when clicked on. More...

#include <menutoolbutton.h>

Inheritance diagram for CAMenuToolButton:
Inheritance graph
[legend]

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)
 
const QList< QToolButton * > & buttonList () const
 
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 ()
 
- Public Member Functions inherited from CAToolButton
 CAToolButton (QWidget *parent)
 
virtual ~CAToolButton ()
 
int currentId ()
 
virtual void setCurrentId (int id)
 
bool buttonsVisible ()
 
void setDefaultAction (QAction *)
 
virtual void showButtons ()
 
virtual void hideButtons ()
 

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
 

Additional Inherited Members

- Signals inherited from CAToolButton
void toggled (bool checked, int id)
 
- Protected Member Functions inherited from CAToolButton
CAMainWinmainWin ()
 
void setMainWin (CAMainWin *m)
 
void setPopupWidget (QWidget *w)
 
virtual void wheelEvent (QWheelEvent *)=0
 
void mousePressEvent (QMouseEvent *)
 
QPoint calculateTopLeft (QSize widgetSize)
 
- Protected Attributes inherited from CAToolButton
CAMainWin_mainWin
 
int _currentId
 
CAToolButtonPopup_popupWidget
 

Detailed Description

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:

Constructor & Destructor Documentation

◆ CAMenuToolButton()

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(), setLayoutMargin(), setMargin(), setNumIconsPerRow(), CAToolButton::setPopupWidget(), setSpacing(), and spacing().

Here is the call graph for this function:

◆ ~CAMenuToolButton()

CAMenuToolButton::~CAMenuToolButton ( )

Destructs the button menu.

References _buttonGroup, _buttonList, and _groupBox.

Member Function Documentation

◆ addButton()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buttonList()

const QList< QToolButton * > & CAMenuToolButton::buttonList ( ) const
inline

References _buttonList.

Referenced by wheelEvent().

Here is the caller graph for this function:

◆ getButton()

QAbstractButton * CAMenuToolButton::getButton ( int  buttonId)
inline

References _buttonGroup.

◆ layoutMargin()

int CAMenuToolButton::layoutMargin ( )
inline

References _layoutMargin.

Referenced by CAMenuToolButton().

Here is the caller graph for this function:

◆ margin()

int CAMenuToolButton::margin ( )
inline

References _margin.

Referenced by setLayoutMargin(), and setMargin().

Here is the caller graph for this function:

◆ numIconsPerRow()

int CAMenuToolButton::numIconsPerRow ( )
inline

References _numIconsRow.

Referenced by addButton().

Here is the caller graph for this function:

◆ onButtonPressed

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentId()

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, CAToolButton::setCurrentId(), and CAToolButton::toggled().

Referenced by CAMainWin::on_uiDynamicCustomText_returnPressed(), CAMainWin::on_uiTimeSigBeat_valueChanged(), CAMainWin::on_uiTimeSigBeats_valueChanged(), onButtonPressed(), CAMainWin::scoreViewKeyPress(), CAMainWin::setupCustomUi(), CAMainWin::updateDynamicToolBar(), CAMainWin::updateFBMToolBar(), CAMainWin::updateFermataToolBar(), CAMainWin::updateFingeringToolBar(), CAMainWin::updateFMToolBar(), CAMainWin::updatePlayableToolBar(), CAMainWin::updateRepeatMarkToolBar(), CAMainWin::updateTempoToolBar(), CAMainWin::updateVoiceToolBar(), and wheelEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLayoutMargin()

void CAMenuToolButton::setLayoutMargin ( int  margin)
inline

References _layoutMargin, and margin().

Referenced by CAMenuToolButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMargin()

void CAMenuToolButton::setMargin ( int  margin)
inline

References _margin, and margin().

Referenced by CAMenuToolButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNumIconsPerRow()

void CAMenuToolButton::setNumIconsPerRow ( int  numIconsRow)
inline

References _numIconsRow.

Referenced by CAMenuToolButton().

Here is the caller graph for this function:

◆ setSpacing()

void CAMenuToolButton::setSpacing ( int  spacing)
inline

References _spacing, and spacing().

Referenced by CAMenuToolButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showButtons()

void CAMenuToolButton::showButtons ( )
virtual

Set the current button, then show the popup widget.

Reimplemented from CAToolButton.

References _buttonGroup, CAToolButton::currentId(), and CAToolButton::showButtons().

Here is the call graph for this function:

◆ spacing()

int CAMenuToolButton::spacing ( )
inline

References _spacing.

Referenced by CAMenuToolButton(), and setSpacing().

Here is the caller graph for this function:

◆ wheelEvent()

void CAMenuToolButton::wheelEvent ( QWheelEvent *  event)
privatevirtual

Cycle through properties using the mouse wheel.

Implements CAToolButton.

References _buttonGroup, buttonList(), CAToolButton::currentId(), setCurrentId(), and CAToolButton::toggled().

Here is the call graph for this function:

Member Data Documentation

◆ _boxLayout

QGridLayout* CAMenuToolButton::_boxLayout
private

Referenced by addButton(), and CAMenuToolButton().

◆ _buttonGroup

QButtonGroup* CAMenuToolButton::_buttonGroup
private

◆ _buttonIds

QHash<QString, int> CAMenuToolButton::_buttonIds
private

◆ _buttonList

QList<QToolButton*> CAMenuToolButton::_buttonList
private

◆ _buttonXPos

int CAMenuToolButton::_buttonXPos
private

Referenced by addButton(), and CAMenuToolButton().

◆ _buttonYPos

int CAMenuToolButton::_buttonYPos
private

Referenced by addButton(), and CAMenuToolButton().

◆ _groupBox

QGroupBox* CAMenuToolButton::_groupBox
private

◆ _layoutMargin

int CAMenuToolButton::_layoutMargin
private

Referenced by layoutMargin(), and setLayoutMargin().

◆ _margin

int CAMenuToolButton::_margin
private

Referenced by addButton(), margin(), and setMargin().

◆ _menuLayout

QGridLayout* CAMenuToolButton::_menuLayout
private

◆ _numIconsRow

int CAMenuToolButton::_numIconsRow
private

◆ _spacing

int CAMenuToolButton::_spacing
private

Referenced by addButton(), setSpacing(), and spacing().


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