Action with associated list of items. More...
#include <QtxListAction.h>
Classes | |
class | ListFrame |
Expanding frame with action list and comment. More... | |
class | ListWidget |
List of actions. More... | |
class | ScrollEvent |
Event for the scrolling in the list of actions. More... | |
Public Types | |
enum | { Item, SubMenu } |
Popup mode. More... | |
Signals | |
void | triggered (int) |
Public Member Functions | |
QtxListAction (QObject *=0) | |
Constructor. More... | |
QtxListAction (const QString &, int, QObject *) | |
Constructor. More... | |
QtxListAction (const QString &, const QString &, int, QObject *) | |
Constructor. More... | |
QtxListAction (const QIcon &, const QString &, int, QObject *) | |
Constructor. More... | |
QtxListAction (const QString &, const QIcon &, const QString &, int, QObject *) | |
Constructor. More... | |
virtual | ~QtxListAction () |
Destructor. More... | |
int | popupMode () const |
Get popup mode. More... | |
void | setPopupMode (const int) |
Set popup mode. More... | |
QStringList | names () const |
Get current list of names. More... | |
void | addNames (const QStringList &, bool=true) |
Add names to the list. More... | |
void | setComment (const QString &, const QString &=QString()) |
Set the format Qt string for comments displayed under the list of actions for one action and for several actions. More... | |
int | linesNumber () const |
Get maximum numer of lines shown without activation of vertical scroll bar. More... | |
int | charsNumber () const |
Get maximum numer of characters in the line. More... | |
void | setLinesNumber (const int) |
Set maximum numer of lines shown without activation of vertical scroll bar. More... | |
void | setCharsNumber (const int) |
Set maximum numer of characters in the line. More... | |
Public Member Functions inherited from QtxAction | |
QtxAction (QObject *=0, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
virtual | ~QtxAction () |
Destructor. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Customize action events. More... | |
QString | shortcutActionName () const |
Return shortcut action name for the action. More... | |
void | setShortcutActionName (const QString &) |
Set shortcut action name to the action. More... | |
Public Attributes | |
enum QtxListAction:: { ... } | PopupMode |
Protected Member Functions | |
virtual QWidget * | createWidget (QWidget *) |
Create action widget. More... | |
virtual void | deleteWidget (QWidget *) |
Destroy action widget. More... | |
Protected Member Functions inherited from QtxAction | |
virtual void | addedTo (QWidget *) |
Called when the action is added to the widget. More... | |
virtual void | removedFrom (QWidget *) |
Called when the action is removed from the widget. More... | |
virtual void | customEvent (QEvent *) |
Process notification events. More... | |
Private Slots | |
void | onChanged () |
Called the action contents is changed. More... | |
void | onMultiple (const int) |
Called when multiple items are selected. More... | |
void | onSingle (bool=false) |
Called when a user click action button. More... | |
void | onTriggered (bool=false) |
Called when user activates an items in the popup sub menu. More... | |
Private Member Functions | |
void | initialize () |
Initialize the action. More... | |
Private Attributes | |
ListFrame * | myFrame |
list of actions shown as submenu More... | |
Friends | |
class | QtxListAction::ListFrame |
This class can be helpuful, for example, for creation of Undo/Redo toolbar items which show list of available commands in the popup list box.
anonymous enum |
QtxListAction::QtxListAction | ( | QObject * | parent = 0 | ) |
parent | parent object |
References initialize().
menuText | menu text |
accel | key accelerator |
parent | parent object |
References initialize().
QtxListAction::QtxListAction | ( | const QString & | text, |
const QString & | menuText, | ||
int | accel, | ||
QObject * | parent | ||
) |
text | action description text (tooltip) |
menuText | menu text |
accel | key accelerator |
parent | parent object |
References initialize().
QtxListAction::QtxListAction | ( | const QIcon & | icon, |
const QString & | menuText, | ||
int | accel, | ||
QObject * | parent | ||
) |
icon | action icon |
menuText | menu text |
accel | key accelerator |
parent | parent object |
References initialize().
QtxListAction::QtxListAction | ( | const QString & | text, |
const QIcon & | icon, | ||
const QString & | menuText, | ||
int | accel, | ||
QObject * | parent | ||
) |
text | action description text (tooltip) |
icon | action icon |
menuText | menu text |
accel | key accelerator |
parent | parent object |
References initialize().
|
virtual |
References myFrame.
void QtxListAction::addNames | ( | const QStringList & | names, |
bool | clear = true |
||
) |
Truncates each name to fit the frame width. Method setCharsNumber() can be used to change the frame width (in characters).
names | list of names to be added |
clear | if true , remove the old contents from the list |
References QtxListAction::ListFrame::addNames(), QtxListAction::ListFrame::clear(), myFrame, and onChanged().
int QtxListAction::charsNumber | ( | ) | const |
If the name length is greater than this value, it will be truncated.
References QtxListAction::ListFrame::charsNumber(), and myFrame.
This function is called whenever the action is added to a container widget that supports custom widgets like menu or toolbar.
parent | container widget the action is added to |
References myFrame, names(), and onSingle().
|
protectedvirtual |
This function is called whenever the action is removed from a container widget that supports custom widgets like menu or toolbar.
widget | container widget the action is removed from |
|
private |
int QtxListAction::linesNumber | ( | ) | const |
References QtxListAction::ListFrame::linesNumber(), and myFrame.
QStringList QtxListAction::names | ( | ) | const |
References myFrame, and QtxListAction::ListFrame::names().
|
privateslot |
References myFrame, QtxListAction::ListFrame::names(), onTriggered(), and triggered().
|
privateslot |
References myFrame, and triggered().
|
privateslot |
on | (not used) |
References onMultiple().
|
privateslot |
on | (not used) |
References triggered().
int QtxListAction::popupMode | ( | ) | const |
void QtxListAction::setCharsNumber | ( | const int | nchars | ) |
If the name length is greater than this value, it will be truncated.
maxChars | number of characters (5 by default) |
References myFrame, and QtxListAction::ListFrame::setCharsNumber().
Example: "Undo %1 actions" format string will work as "Undo 3 actions" when 3 actions are selected. The default format string is "%1".
c | single action comment format |
c | multiple actions comment format |
References myFrame, QtxListAction::ListFrame::setMultipleComment(), and QtxListAction::ListFrame::setSingleComment().
void QtxListAction::setLinesNumber | ( | const int | nlines | ) |
nlines | number of lines (5 by default) |
References myFrame, and QtxListAction::ListFrame::setLinesNumber().
void QtxListAction::setPopupMode | ( | const int | mode | ) |
mode | new popup mode (QtxListAction::PopupMode) |
References Item, onChanged(), and popupMode().
|
signal |
|
friend |
|
private |
enum { ... } QtxListAction::PopupMode |