Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Slots | Public Member Functions | Private Member Functions | Private Attributes
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]

List of all members.

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

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

Here is the call graph for this function:

Destructs the button menu.

References _buttonGroup, _buttonList, and _groupBox.


Member Function Documentation

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:

References _buttonList.

Referenced by wheelEvent().

Here is the caller graph for this function:

QAbstractButton* CAMenuToolButton::getButton ( int  buttonId) [inline]

References _buttonGroup.

References _layoutMargin.

Referenced by CAMenuToolButton().

Here is the caller graph for this function:

int CAMenuToolButton::margin ( ) [inline]

References _margin.

Referenced by setLayoutMargin(), and setMargin().

Here is the caller graph for this function:

References _numIconsRow.

Referenced by addButton().

Here is the caller graph for this function:

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:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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:

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:

void CAMenuToolButton::setNumIconsPerRow ( int  numIconsRow) [inline]

References _numIconsRow.

Referenced by CAMenuToolButton().

Here is the caller graph for this function:

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:

void CAMenuToolButton::showButtons ( ) [virtual]

Set the current button, then show the popup widget.

Reimplemented from CAToolButton.

References _buttonGroup, and CAToolButton::currentId().

Here is the call graph for this function:

int CAMenuToolButton::spacing ( ) [inline]

References _spacing.

Referenced by CAMenuToolButton(), and setSpacing().

Here is the caller graph for this function:

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

Here is the call graph for this function:


Member Data Documentation

QGridLayout* CAMenuToolButton::_boxLayout [private]

Referenced by addButton(), and CAMenuToolButton().

QButtonGroup* CAMenuToolButton::_buttonGroup [private]
QHash<QString, int> CAMenuToolButton::_buttonIds [private]

Referenced by addButton(), and CAMenuToolButton().

Referenced by addButton(), and CAMenuToolButton().

QGroupBox* CAMenuToolButton::_groupBox [private]

Referenced by layoutMargin(), and setLayoutMargin().

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

QGridLayout* CAMenuToolButton::_menuLayout [private]

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


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