Version: 6.3.1
Data Structures | Public Types | Signals | Public Member Functions | Data Fields | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends

QtxListAction Class Reference

Action with associated list of items. More...

#include <QtxListAction.h>

Inheritance diagram for QtxListAction:
Inheritance graph

Data Structures

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.
 QtxListAction (const QString &, int, QObject *)
 Constructor.
 QtxListAction (const QString &, const QString &, int, QObject *)
 Constructor.
 QtxListAction (const QIcon &, const QString &, int, QObject *)
 Constructor.
 QtxListAction (const QString &, const QIcon &, const QString &, int, QObject *)
 Constructor.
virtual ~QtxListAction ()
 Destructor.
int popupMode () const
 Get popup mode.
void setPopupMode (const int)
 Set popup mode.
QStringList names () const
 Get current list of names.
void addNames (const QStringList &, bool=true)
 Add names to the list.
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.
int linesNumber () const
 Get maximum numer of lines shown without activation of vertical scroll bar.
int charsNumber () const
 Get maximum numer of characters in the line.
void setLinesNumber (const int)
 Set maximum numer of lines shown without activation of vertical scroll bar.
void setCharsNumber (const int)
 Set maximum numer of characters in the line.
virtual bool eventFilter (QObject *, QEvent *)
 Customize action events.
QString shortcutActionName () const
 Return shortcut action name for the action.
void setShortcutActionName (const QString &)
 Set shortcut action name to the action.

Data Fields

enum QtxListAction:: { ... }  PopupMode

Protected Member Functions

virtual QWidgetcreateWidget (QWidget *)
 Create action widget.
virtual void deleteWidget (QWidget *)
 Destroy action widget.
virtual void addedTo (QWidget *)
 Called when the action is added to the widget.
virtual void removedFrom (QWidget *)
 Called when the action is removed from the widget.
virtual void customEvent (QEvent *)
 Process notification events.

Private Slots

void onChanged ()
 Called the action contents is changed.
void onMultiple (const int)
 Called when multiple items are selected.
void onSingle (bool=false)
 Called when a user click action button.
void onTriggered (bool=false)
 Called when user activates an items in the popup sub menu.

Private Member Functions

void initialize ()
 Initialize the action.

Private Attributes

ListFramemyFrame
 list of actions shown as submenu

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

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

References Item, and SubMenu.

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

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

QStringList QtxListAction::names ( ) const
Returns:
list of names

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

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

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

int QtxListAction::linesNumber ( ) const
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.

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::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.triggered ( int  ) [signal]
void QtxListAction::onChanged ( ) [private, slot]
void QtxListAction::onMultiple ( const int  numActions) [private, slot]

References myFrame, and triggered().

void QtxListAction::onSingle ( bool  = false) [private, slot]
Parameters:
on(not used)

References onMultiple().

void QtxListAction::onTriggered ( bool  = false) [private, slot]
Parameters:
on(not used)

References triggered().

QWidget * QtxListAction::createWidget ( QWidget parent) [protected, virtual]

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) [protected, virtual]

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
void QtxListAction::initialize ( ) [private]
bool QtxAction::eventFilter ( QObject o,
QEvent e 
) [virtual, inherited]

Sends a notification event to the action when it is added to the widget or removed from it in order to perform custom processing.

Parameters:
oobject
eevent
Returns:
true if further event processing should be stopped
See also:
customEvent(), addedTo(), removedFrom()
QString QtxAction::shortcutActionName ( ) const [inherited]
Returns:
shortcut action name
See also:
setShortcutActionName()

References QtxAction.myShortcutActionName.

void QtxAction::setShortcutActionName ( const QString &  shortcutAction) [inherited]

Shortcut action name is used for shortcuts customization.

Parameters:
shortcutActionshortcut action name
See also:
shortcutActionName()

References QtxAction.myShortcutActionName.

void QtxAction::addedTo ( QWidget ) [protected, virtual, inherited]

This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.

Parameters:
wwidget (should be menu or toolbar)
See also:
removedFrom()

Reimplemented in LightApp_ModuleAction, QtxActionSet, QtxDockAction, QtxWorkspaceAction, and QtxWorkstackAction.

void QtxAction::removedFrom ( QWidget ) [protected, virtual, inherited]

This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.

Parameters:
wwidget (should be menu or toolbar)
See also:
addedTo()

Reimplemented in LightApp_ModuleAction, QtxActionSet, QtxDockAction, QtxWorkspaceAction, and QtxWorkstackAction.

void QtxAction::customEvent ( QEvent e) [protected, virtual, inherited]

Calls addedTo() method when the action is added to the widget and removedFrom() when it is removed from the widget in order to perform custom processing.

Parameters:
enoification event
See also:
eventFilter(), addedTo(), removedFrom()

References QtxAction.addedTo(), QtxAction.ActionNotify.isAdded(), QtxAction.removedFrom(), and QtxAction.ActionNotify.widget().


Friends And Related Function Documentation

friend class QtxListAction::ListFrame [friend]

Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS