|
Canorus
0.7
|
Tool button with a menu at the side. More...
#include <toolbutton.h>

Signals | |
| void | toggled (bool checked, int id) |
Public Member Functions | |
| CAToolButton (QWidget *parent) | |
| virtual | ~CAToolButton () |
| int | currentId () |
| virtual void | setCurrentId (int id) |
| bool | buttonsVisible () |
| void | setDefaultAction (QAction *) |
| virtual void | showButtons () |
| virtual void | hideButtons () |
Protected Member Functions | |
| CAMainWin * | mainWin () |
| void | setMainWin (CAMainWin *m) |
| void | setPopupWidget (QWidget *w) |
| virtual void | wheelEvent (QWheelEvent *)=0 |
| void | mousePressEvent (QMouseEvent *) |
| QPoint | calculateTopLeft (QSize widgetSize) |
Protected Attributes | |
| CAMainWin * | _mainWin |
| int | _currentId |
| CAToolButtonPopup * | _popupWidget |
Private Slots | |
| void | handleToggled (bool checked) |
| void | handleTriggered () |
Tool button with a menu at the side.
Copyright (c) 2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.
This widget looks like a button with a small dropdown arrow at the side which opens a
custom widget (also called "buttons") where user chooses from various actions then.
When the element is selected, the action's icon is replaced with the previous icon on
the toolbutton and a signal toggled(bool checked, int id) is emitted.
\remarks Subclasses must call setPopupWidget() on the floating widget once it's initialized. Showing/hiding is handled in CAToolButton. Subclasses can connect to the show() or hide() signals, which are emitted just before showing or hiding the widget.| CAToolButton::CAToolButton | ( | QWidget * | parent | ) |
| CAToolButton::~CAToolButton | ( | ) | [virtual] |
References _popupWidget.
| bool CAToolButton::buttonsVisible | ( | ) | [inline] |
References _popupWidget.
Referenced by mousePressEvent().

| QPoint CAToolButton::calculateTopLeft | ( | QSize | size | ) | [protected] |
This function returns the absolute top-left coordinate where the popup menu or whichever widget should appear when the users clicks on the button.
The problem is that the popup widget should be completely visible in whichever part of the screen the toolbutton is located. Popup widget should also always stick to one corner of the toolbutton.
Parameter size is the width and height needed for the whole widget to appear.
References mainWin().
Referenced by showButtons().


| int CAToolButton::currentId | ( | ) | [inline] |
References _currentId.
Referenced by handleToggled(), handleTriggered(), CAMainWin::scoreViewPortMousePress(), CAMenuToolButton::showButtons(), CAMainWin::updateDynamicToolBar(), CAMainWin::updateFermataToolBar(), CAMainWin::updateFingeringToolBar(), CAMainWin::updateInstrumentToolBar(), CAMainWin::updatePlayableToolBar(), CAMainWin::updateRepeatMarkToolBar(), CAMainWin::updateTempoToolBar(), and CAMenuToolButton::wheelEvent().

| void CAToolButton::handleToggled | ( | bool | checked | ) | [private, slot] |
Emits toggled( bool, int ) signal.
References currentId(), and toggled().
Referenced by setDefaultAction().


| void CAToolButton::handleTriggered | ( | ) | [private, slot] |
Emits toggled( bool, int ) signal.
References currentId(), and toggled().
Referenced by setDefaultAction().


| void CAToolButton::hideButtons | ( | ) | [virtual] |
Hides the popup widget if it's set
References _popupWidget.
Referenced by mousePressEvent(), CAMenuToolButton::onButtonPressed(), and CAUndoToolButton::onListWidgetItemClicked().

| CAMainWin* CAToolButton::mainWin | ( | ) | [inline, protected] |
References _mainWin.
Referenced by calculateTopLeft(), and CAUndoToolButton::showButtons().

| void CAToolButton::mousePressEvent | ( | QMouseEvent * | e | ) | [protected] |
This function is overriden here in order to show buttons when clicked on the arrow.
References buttonsVisible(), hideButtons(), and showButtons().

| virtual void CAToolButton::setCurrentId | ( | int | id | ) | [inline, virtual] |
References _currentId.
Referenced by CAUndoToolButton::CAUndoToolButton().

| void CAToolButton::setDefaultAction | ( | QAction * | a | ) |
Sets the new default action a and connects some signals to custom slots made by CAMenuToolButton. Also calls QToolButton::setDefaultAction().
Reimplemented in CAUndoToolButton.
References handleToggled(), handleTriggered(), and toggled().
Referenced by CAMenuToolButton::CAMenuToolButton(), and CAMainWin::setupCustomUi().


| void CAToolButton::setMainWin | ( | CAMainWin * | m | ) | [inline, protected] |
| void CAToolButton::setPopupWidget | ( | QWidget * | w | ) | [inline, protected] |
References _popupWidget, and CAToolButtonPopup::setWidget().
Referenced by CAMenuToolButton::CAMenuToolButton(), and CAUndoToolButton::CAUndoToolButton().


| void CAToolButton::showButtons | ( | ) | [virtual] |
Shows the popup widget if it's set
Reimplemented in CAMenuToolButton, and CAUndoToolButton.
References _popupWidget, calculateTopLeft(), and CAToolButtonPopup::sizeHint().
Referenced by mousePressEvent().


| void CAToolButton::toggled | ( | bool | checked, |
| int | id | ||
| ) | [signal] |
Referenced by handleToggled(), handleTriggered(), CAMenuToolButton::onButtonPressed(), CAUndoToolButton::onListWidgetItemClicked(), CAMenuToolButton::setCurrentId(), setDefaultAction(), and CAMenuToolButton::wheelEvent().

| virtual void CAToolButton::wheelEvent | ( | QWheelEvent * | ) | [protected, pure virtual] |
Implemented in CAMenuToolButton, and CAUndoToolButton.
int CAToolButton::_currentId [protected] |
Referenced by currentId(), and setCurrentId().
CAMainWin* CAToolButton::_mainWin [protected] |
Referenced by mainWin(), and setMainWin().
CAToolButtonPopup* CAToolButton::_popupWidget [protected] |
Referenced by buttonsVisible(), CAToolButton(), hideButtons(), setPopupWidget(), showButtons(), and ~CAToolButton().
1.8.0