kwave
18.07.70
|
#include <MultiStateWidget.h>
Public Slots | |
void | setState (int newstate) |
void | switchState (bool on) |
void | nextState () |
Signals | |
void | clicked (int id) |
Public Member Functions | |
MultiStateWidget (QWidget *parent, int id) | |
virtual | ~MultiStateWidget () Q_DECL_OVERRIDE |
void | setID (int id) |
void | addPixmap (const QString &filename) |
Private Member Functions | |
virtual void | mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE |
virtual void | paintEvent (QPaintEvent *) Q_DECL_OVERRIDE |
Private Attributes | |
int | m_current_index |
int | m_identifier |
QVector< QPixmap > | m_pixmaps |
Definition at line 36 of file MultiStateWidget.h.
Kwave::MultiStateWidget::MultiStateWidget | ( | QWidget * | parent, |
int | id | ||
) |
Constructor
parent | the parent widget |
id | identifier |
Definition at line 32 of file MultiStateWidget.cpp.
|
virtual |
void Kwave::MultiStateWidget::addPixmap | ( | const QString & | filename | ) |
Adds a the content of pixmap file as pixmap for the next state. The file is found through the KStandardDirs mechanism. Adding a file for a second or further time is not possible, in this case the pixmap will not be loaded and the return value will be the id of the existing version.
filename | name of the file to be added, without path. |
Definition at line 51 of file MultiStateWidget.cpp.
Referenced by Kwave::TrackView::TrackView().
|
signal |
Signals that the widget has changed it's state.
id | identifier of this widget's instance |
Referenced by nextState().
|
privatevirtual |
reacts to the mouse release (click)
Definition at line 83 of file MultiStateWidget.cpp.
References nextState().
|
slot |
advance to the next state, with wrap-around to zero
Definition at line 76 of file MultiStateWidget.cpp.
References clicked(), m_current_index, m_identifier, and setState().
Referenced by mouseReleaseEvent().
|
privatevirtual |
repaints the pixmap
Definition at line 91 of file MultiStateWidget.cpp.
References m_current_index, and m_pixmaps.
void Kwave::MultiStateWidget::setID | ( | int | id | ) |
Sets the number that will passed as argument to the "clicked" signal.
id | new identifier |
Definition at line 45 of file MultiStateWidget.cpp.
References m_identifier.
|
slot |
Activates a new state, with wrap-around on overflows, limited to [ 0 ... m_pixmaps.count()-1 ].
newstate | index of the new state [0...N] |
Definition at line 63 of file MultiStateWidget.cpp.
References m_current_index, and m_pixmaps.
Referenced by nextState(), and switchState().
|
slot |
For widgets that have only two states (on and off), this selects state 1 or 0
on | if true, switch on (state 1), otherwise switch off (state 0) |
Definition at line 70 of file MultiStateWidget.cpp.
References setState().
Referenced by Kwave::TrackView::TrackView().
|
private |
index of the current state
Definition at line 111 of file MultiStateWidget.h.
Referenced by nextState(), paintEvent(), and setState().
|
private |
identifier used for the clicked() signal
Definition at line 114 of file MultiStateWidget.h.
Referenced by nextState(), and setID().
|
private |
list of QPixmaps
Definition at line 117 of file MultiStateWidget.h.
Referenced by addPixmap(), paintEvent(), setState(), and ~MultiStateWidget().