Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (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 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

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
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::QtxListAction ( QObject parent = 0)
Parameters
parentparent object

References initialize().

QtxListAction::QtxListAction ( const QString &  menuText,
int  accel,
QObject parent 
)
Parameters
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

QtxListAction::QtxListAction ( const QString &  text,
const QString &  menuText,
int  accel,
QObject parent 
)
Parameters
textaction description text (tooltip)
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

QtxListAction::QtxListAction ( const QIcon &  icon,
const QString &  menuText,
int  accel,
QObject parent 
)
Parameters
iconaction icon
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

QtxListAction::QtxListAction ( const QString &  text,
const QIcon &  icon,
const QString &  menuText,
int  accel,
QObject parent 
)
Parameters
textaction description text (tooltip)
iconaction icon
menuTextmenu text
accelkey accelerator
parentparent object

References initialize().

QtxListAction::~QtxListAction ( )
virtual

References myFrame.

Member Function Documentation

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

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, and onChanged().

int QtxListAction::charsNumber ( ) const

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.

QWidget * QtxListAction::createWidget ( QWidget parent)
protectedvirtual

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

void QtxListAction::deleteWidget ( QWidget widget)
protectedvirtual

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
int QtxListAction::linesNumber ( ) const
QStringList QtxListAction::names ( ) const
Returns
list of names

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

void QtxListAction::onChanged ( )
privateslot
void QtxListAction::onMultiple ( const int  numActions)
privateslot

References myFrame, and triggered().

void QtxListAction::onSingle ( bool  = false)
privateslot
Parameters
on(not used)

References onMultiple().

void QtxListAction::onTriggered ( bool  = false)
privateslot
Parameters
on(not used)

References triggered().

int QtxListAction::popupMode ( ) const
Returns
current popup mode (QtxListAction::PopupMode)
See Also
setPopupMode()

References Item, and SubMenu.

void QtxListAction::setCharsNumber ( const int  nchars)

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

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

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

void QtxListAction::setLinesNumber ( const int  nlines)
Parameters
nlinesnumber of lines (5 by default)
See Also
linesNumber(), charsNumber(), setCharsNumber()

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

void QtxListAction::setPopupMode ( const int  mode)
Parameters
modenew popup mode (QtxListAction::PopupMode)
See Also
popupMode()

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

void QtxListAction::triggered ( int  )
signal

Friends And Related Function Documentation

friend class QtxListAction::ListFrame
friend

Member Data Documentation

ListFrame* QtxListAction::myFrame
private
enum { ... } QtxListAction::PopupMode

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