Version: 9.15.0
QtxListAction Class Reference

Action with associated list of items. More...

#include <QtxListAction.h>

Inheritance diagram for QtxListAction:
Inheritance graph

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 (QObject *, bool, const QString &, const QString &, const QString &=QString(), const QIcon &=QIcon())
 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
 
void setShortcutActionName (const QString &)
 
const QString & ID () const
 Unique for the entire application ID. More...
 
void setID (const QString &theID)
 

Public Attributes

enum QtxListAction:: { ... }  PopupMode
 Popup mode. More...
 

Protected Member Functions

virtual QWidgetcreateWidget (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

ListFramemyFrame
 list of actions shown as submenu More...
 

Friends

class QtxListAction::ListFrame
 

Detailed Description

Action with associated list of items.

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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Popup mode.

Enumerator
Item 

action is added to popup menu as menu item

SubMenu 

action is added to popup menu as sub menu with list of items

Constructor & Destructor Documentation

◆ QtxListAction() [1/5]

QtxListAction::QtxListAction ( QObject parent = 0)

Constructor.

Parameters
parentparent object

References initialize().

◆ QtxListAction() [2/5]

QtxListAction::QtxListAction ( const QString &  menuText,
int  accel,
QObject parent 
)

Constructor.

Parameters
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

◆ QtxListAction() [3/5]

QtxListAction::QtxListAction ( const QString &  text,
const QString &  menuText,
int  accel,
QObject parent 
)

Constructor.

Parameters
textaction description text (tooltip)
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

◆ QtxListAction() [4/5]

QtxListAction::QtxListAction ( const QIcon &  icon,
const QString &  menuText,
int  accel,
QObject parent 
)

Constructor.

Parameters
iconaction icon
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

◆ QtxListAction() [5/5]

QtxListAction::QtxListAction ( const QString &  text,
const QIcon &  icon,
const QString &  menuText,
int  accel,
QObject parent 
)

Constructor.

Parameters
textaction description text (tooltip)
iconaction icon
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

◆ ~QtxListAction()

QtxListAction::~QtxListAction ( )
virtual

Destructor.

References myFrame.

Member Function Documentation

◆ addNames()

void QtxListAction::addNames ( const QStringList &  names,
bool  clear = true 
)

Add names to the list.

Truncates each name to fit the frame width. Method setCharsNumber() can be used to change the frame width (in characters).

Parameters
nameslist of names to be added
clearif true, remove the old contents from the list
See also
setCharsNumber()

References QtxListAction::ListFrame::addNames(), QtxListAction::ListFrame::clear(), myFrame, names(), and onChanged().

◆ charsNumber()

int QtxListAction::charsNumber ( ) const

Get maximum numer of characters in the line.

If the name length is greater than this value, it will be truncated.

Returns
number of characters
See also
setCharsNumber(), linesNumber(), setLinesNumber()

References QtxListAction::ListFrame::charsNumber(), and myFrame.

◆ createWidget()

QWidget * QtxListAction::createWidget ( QWidget parent)
protectedvirtual

Create action widget.

This function is called whenever the action is added to a container widget that supports custom widgets like menu or toolbar.

Parameters
parentcontainer widget the action is added to
Returns
tool button for toolbar and 0 otherwise

References myFrame, names(), and onSingle().

◆ deleteWidget()

void QtxListAction::deleteWidget ( QWidget widget)
protectedvirtual

Destroy action widget.

This function is called whenever the action is removed from a container widget that supports custom widgets like menu or toolbar.

Parameters
widgetcontainer widget the action is removed from

◆ initialize()

void QtxListAction::initialize ( )
private

◆ linesNumber()

int QtxListAction::linesNumber ( ) const

Get maximum numer of lines shown without activation of vertical scroll bar.

Returns
number of lines
See also
setLinesNumber(), charsNumber(), setCharsNumber()

References QtxListAction::ListFrame::linesNumber(), and myFrame.

◆ names()

QStringList QtxListAction::names ( ) const

Get current list of names.

Returns
list of names

References myFrame, and QtxListAction::ListFrame::names().

◆ onChanged

void QtxListAction::onChanged ( )
privateslot

Called the action contents is changed.

References myFrame, QtxListAction::ListFrame::names(), onTriggered(), and triggered().

◆ onMultiple

void QtxListAction::onMultiple ( const int  numActions)
privateslot

Called when multiple items are selected.

References myFrame, and triggered().

◆ onSingle

void QtxListAction::onSingle ( bool  = false)
privateslot

Called when a user click action button.

Parameters
on(not used)

References onMultiple().

◆ onTriggered

void QtxListAction::onTriggered ( bool  = false)
privateslot

Called when user activates an items in the popup sub menu.

Parameters
on(not used)

References triggered().

◆ popupMode()

int QtxListAction::popupMode ( ) const

Get popup mode.

Returns
current popup mode (QtxListAction::PopupMode)
See also
setPopupMode()

References Item, and SubMenu.

◆ setCharsNumber()

void QtxListAction::setCharsNumber ( const int  nchars)

Set maximum numer of characters in the line.

If the name length is greater than this value, it will be truncated.

Parameters
maxCharsnumber of characters (5 by default)
See also
charsNumber(), linesNumber(), setLinesNumber()

References myFrame, and QtxListAction::ListFrame::setCharsNumber().

◆ setComment()

void QtxListAction::setComment ( const QString &  c,
const QString &  sc = QString() 
)

Set the format Qt string for comments displayed under the list of actions for one action and for several actions.

Example: "Undo %1 actions" format string will work as "Undo 3 actions" when 3 actions are selected. The default format string is "%1".

Parameters
csingle action comment format
cmultiple actions comment format

References myFrame, QtxListAction::ListFrame::setMultipleComment(), and QtxListAction::ListFrame::setSingleComment().

◆ setLinesNumber()

void QtxListAction::setLinesNumber ( const int  nlines)

Set maximum numer of lines shown without activation of vertical scroll bar.

Parameters
nlinesnumber of lines (5 by default)
See also
linesNumber(), charsNumber(), setCharsNumber()

References myFrame, and QtxListAction::ListFrame::setLinesNumber().

◆ setPopupMode()

void QtxListAction::setPopupMode ( const int  mode)

Set popup mode.

Parameters
modenew popup mode (QtxListAction::PopupMode)
See also
popupMode()

References Item, onChanged(), and popupMode().

◆ triggered

void QtxListAction::triggered ( int  )
signal

Friends And Related Function Documentation

◆ QtxListAction::ListFrame

friend class QtxListAction::ListFrame
friend

Member Data Documentation

◆ myFrame

ListFrame* QtxListAction::myFrame
private

list of actions shown as submenu

◆ 

enum { ... } QtxListAction::PopupMode

Popup mode.


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