/*!
\class Qtx
- \brief Set of helpful utility functions.
-
- The class implements set of static functions which can be used for different purpuses:
- - define tab order for set of widgets: setTabOrder()
- - align one widget to the other widget: alignWidget()
- - remove extra separators from menu or toolbar: simplifySeparators()
- - retrieve directory, file name and extension parts of the path: dir(), file(), extension()
- - get temporary directory name: tmpDir()
- - create and remove directory (recursively): mkDir(), rmDir()
+ \brief A set of helpful utility functions.
+
+ The class implements a set of the static functions which can be used
+ for the different purposes:
+ - specify tab order for the set of widgets: setTabOrder()
+ - align one widget to the coordinates of the another one: alignWidget()
+ - remove extra separators from the menu or toolbar: simplifySeparators()
+ - retrieve directory, file name and extension parts of the path:
+ dir(), file(), extension()
+ - get the path to the temporary directory: tmpDir()
+ - create or remove a directory (recursively): mkDir(), rmDir()
- convert text file from DOS to UNIX native format: dos2unix()
- - convert picture to the gray scale: grayscale()
- - and other
+ - convert a picture to the gray scale: grayscale()
+ - other
*/
/*!
return QDir().rename( QString( temp ), absName );
}
+/*!
+ \brief Create path completer which can be used in the widgets
+ to provide auto completions.
+
+ Create an instance of QCompleter class and returns the pointer on it.
+ The calling function is responsible to the desstroying of the created
+ completer object.
+
+ The QCompleter class provides completions based on a item model and can be
+ used in such as QLineEdit and QComboBox.
+ When the user starts typing a word, QCompleter suggests possible ways of
+ completing the word, based on a word list.
+
+ \param type path type (Qtx::PathType)
+ \param filter file/directory filters (list of wildcards, separated by ";;")
+ \return a pointer to the created completer
+*/
QCompleter* Qtx::pathCompleter( const PathType type, const QString& filter )
{
QStringList extList;
#ifndef QTX_H
#define QTX_H
-#if defined QTX_EXPORTS
#if defined WIN32
-#define QTX_EXPORT _declspec( dllexport )
+# if defined QTX_EXPORTS
+# define QTX_EXPORT _declspec( dllexport )
+# else
+# define QTX_EXPORT _declspec( dllimport )
+# endif
#else
-#define QTX_EXPORT
-#endif
-#else
-#if defined WIN32
-#define QTX_EXPORT _declspec( dllimport )
-#else
-#define QTX_EXPORT
-#endif
+# define QTX_EXPORT
#endif
#if defined SOLARIS
AlignOutBottom = AlignOutTop << 2 //!< align top side of one widget to the bottom side of another widget
} AlignmentFlags;
- typedef enum { PT_OpenFile, PT_SaveFile, PT_Directory } PathType;
+ //! Path type, indicates required directory/file operation
+ typedef enum {
+ PT_OpenFile, //!< the file is opened
+ PT_SaveFile, //!< the file is saved
+ PT_Directory //!< the directory path is required
+ } PathType;
static QString toQString( const char*, const int = -1 );
static QString toQString( const short*, const int = -1 );
#include <QActionEvent>
#include <QApplication>
+/*!
+ \class QtxAction::ActionNotify
+ \brief Notify event used to signalize about event adding/removing.
+ \internal
+*/
+
class QtxAction::ActionNotify : public QEvent
{
public:
/*!
\class QtxAction
\brief Generic action class.
+
+ The class QtxAction inherits QWidgetAction class and can be used
+ as base class when implementing any custom menu/toolbar actions.
+ It is necessary to subclass from QtxAction and redefine virtual
+ callback methods addedTo(), removedFrom() (which are called automatically
+ when the action is added to the widget and removed from it) to customize
+ the action behavior.
*/
/*!
\brief Constructor.
- Create an action.
+ Creates an action owned by \a parent.
+ Parameter \a toggle can be used to make the action checkable.
\param parent parent object
- \param name action name (in terms of QObject)
- \param toggle if \c true the action is a toggle action
+ \param toggle if \c true the action will be a toggle action
*/
QtxAction::QtxAction( QObject* parent, bool toggle )
: QWidgetAction( parent )
/*!
\brief Constructor.
- Create an action.
+ Creates an action owned by \a parent. Parameters \a text,
+ \a icon, \a menuText and \a accel specify the action's attributes.
+ Parameter \a toggle can be used to make the action checkable.
\param text tooltip text
\param icon iconset
\param menuText menu text
\param accel shortcut key sequence
\param parent parent object
- \param name action name (in terms of QObject)
- \param toggle if \c true the action is a toggle action
+ \param toggle if \c true the action will be a toggle action
*/
QtxAction::QtxAction( const QString& text, const QIcon& icon,
const QString& menuText, int accel, QObject* parent, bool toggle )
/*!
\brief Constructor.
- Create an action.
+ Creates an action owned by \a parent. Parameters \a text,
+ \a menuText and \a accel specify the action's attributes.
+ Parameter \a toggle can be used to make the action checkable.
\param text tooltip text
\param menuText menu text
\param accel shortcut key sequence
\param parent parent object
- \param name action name (in terms of QObject)
\param toggle if \c true the action is a toggle action
*/
QtxAction::QtxAction( const QString& text, const QString& menuText,
/*!
\brief Destructor.
-
- Does nothing for the moment.
*/
QtxAction::~QtxAction()
{
}
/*!
- \brief Event filter.
+ \brief Customize action events.
- Redefined from QObject. Calls virtual methods when the action is added to
+ Sends a notification event to the action when it is added to
the widget or removed from it in order to perform custom processing.
+
\param o object
\param e event
- \return default implementation
+ \return \c true if further event processing should be stopped
+ \sa customEvent(), addedTo(), removedFrom()
*/
bool QtxAction::eventFilter( QObject* o, QEvent* e )
{
/*!
\brief Called when the action is added to the widget.
- Base implementation does nothing. Can be redefined in the successor
- class to customize the behavior.
+ This method can be redefined in the subclasses to customize
+ the action behavior. Base implementation does nothing.
- \param w widget (menu or toolbar)
+ \param w widget (should be menu or toolbar)
+ \sa removedFrom()
*/
-void QtxAction::addedTo( QWidget* )
+void QtxAction::addedTo( QWidget* /*w*/ )
{
}
/*!
\brief Called when the action is removed from the widget.
- Base implementation does nothing. Can be redefined in the successor
- class to customize the behavior.
+ This method can be redefined in the subclasses to customize
+ the action behavior. Base implementation does nothing.
- \param w widget (menu or toolbar)
+ \param w widget (should be menu or toolbar)
+ \sa addedTo()
*/
-void QtxAction::removedFrom( QWidget* )
+void QtxAction::removedFrom( QWidget* /*w*/ )
{
}
+/*!
+ \brief Process notification events.
+
+ 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.
+
+ \param e noification event
+ \sa eventFilter(), addedTo(), removedFrom()
+*/
void QtxAction::customEvent( QEvent* e )
{
ActionNotify* ae = (ActionNotify*)e;
/*!
\class QtxActionMenuMgr::MenuNode
- \internal
\brief Represents a menu item inside main menu structure.
+ \internal
*/
-class QtxActionMenuMgr::MenuNode {
+class QtxActionMenuMgr::MenuNode
+{
public:
MenuNode();
MenuNode( MenuNode*, const int, const int, const int );
/*!
\brief Default constructor.
+ \internal
*/
QtxActionMenuMgr::MenuNode::MenuNode()
: parent( 0 ), id( -1 ), idx( -1 ), group( -1 ), visible( true )
/*!
\brief Constructor.
+ \internal
\param p parent menu node
\param _id menu node ID
\param _idx menu node index
/*!
\brief Destructor.
+ \internal
*/
QtxActionMenuMgr::MenuNode::~MenuNode()
{
Methods show(), hide() allow displaying/erasing of specified menu items.
Actions can be grouped with help of group identificator. Inside the popup
- or main menu bar menu items are ordered by the group ID (ascending).
+ or main menu bar menu items are ordered by the group identifier (ascending).
Menu manager automatically optimizes the menu by removing extra separators,
hiding empty popup menus etc.
}
/*!
- \brief Check if an action with given ID \a actId is visible to
- the parent action with given ID \a place.
+ \brief Check if an action with \a actId identifier is visible to
+ the parent action with \a place identifier.
\param actId action ID
\param place some parent action ID
- \return \c true if an action is visible
+ \return \c true if an action is visible to the parent
+ \sa setVisible()
*/
bool QtxActionMenuMgr::isVisible( const int actId, const int place ) const
{
}
/*!
- \brief Set action visibility flag.
+ \brief Set action's visibility flag.
\param actId action ID
\param place some parent action ID
- \param on visibility state
+ \param v new visibility state
+ \sa isVisible()
*/
void QtxActionMenuMgr::setVisible( const int actId, const int place, const bool v )
{
\brief Insert action to the menu.
Insert an action to the named menu. The \a menus parameter represents
- the menu name: it is a sequence of strings, separated by '|' symbol.
- For example, "File|Edit" means File->Edit submenu.
+ the menu name: it can be a sequence of strings, separated by '|' symbol.
+ For example, "File|Edit" means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param id action ID
\brief Insert action to the menu.
Insert an action to the named menu. The \a menus parameter represents
- the menu name: it is a sequence of strings, separated by '|' symbol.
- For example, "File|Edit" means File->Edit submenu.
+ the menu name: it can be a sequence of strings, separated by '|' symbol.
+ For example, "File|Edit" means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param a action
Insert an action to the named menu. The \a menus parameter represents
the menu names list.
For example, string list consisting from two items "File" and "Edit"
- means File->Edit submenu.
+ means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param id action ID
Insert an action to the named menu. The \a menus parameter represents
the menu names list.
For example, string list consisting from two items "File" and "Edit"
- means File->Edit submenu.
+ means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param a action
\brief Create and insert menu item action to the menu.
Insert an action to the named menu. The \a menus parameter represents
- the menu name: it is a sequence of strings, separated by '|' symbol.
- For example, "File|Edit" means File->Edit submenu.
+ the menu name: it can be a sequence of strings, separated by '|' symbol.
+ For example, "File|Edit" means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param title menu text
Insert an action to the named menu. The \a menus parameter represents
the menu names list.
For example, string list consisting from two items "File" and "Edit"
- means File->Edit submenu.
+ means \c File->Edit submenu.
If submenu doesn't exist, it will be created.
\param title menu text
/*!
\brief Show menu item with given \a id.
\param id menu action ID
+ \sa hide()
*/
void QtxActionMenuMgr::show( const int id )
{
/*!
\brief Hide menu item with given \a id.
\param id menu action ID
+ \sa show()
*/
void QtxActionMenuMgr::hide( const int id )
{
\brief Get visibility status for menu item with given \a id.
\param id menu action ID
\return \c true if an item is shown
+ \sa setShown()
*/
bool QtxActionMenuMgr::isShown( const int id ) const
{
\brief Set visibility status for menu item with given \a id.
\param id menu action ID
\param on new visibility status
+ \sa isShown()
*/
void QtxActionMenuMgr::setShown( const int id, const bool on )
{
}
/*!
- \brief Change menu title fot the action with given \a id.
+ \brief Change menu title for the action with given \a id.
\param id menu action ID
\param title new menu title
*/
myMenu = 0;
}
+
/*!
- \brief Returns the menu widget.
+ \fn void QtxActionMenuMgr::menuAboutToShow( QMenu* m )
+ \brief Emitted when the menu is about to be shown.
+ \param m menu being shown
+*/
+
+/*!
+ \fn void QtxActionMenuMgr::menuAboutToHide( QMenu* m )
+ \brief Emitted when the menu is about to be hidden.
+ \param m menu being hidden
+*/
+
+/*!
+ \brief Get the menu widget.
+ \return menu widget (QMenuBar)
*/
QWidget* QtxActionMenuMgr::menuWidget() const
{
\param id menu action ID
\param pId parent menu item ID
\param rec if \c true perform recursive search
- \return menu node or 0 if not found
+ \return menu node or 0 if it is not found
*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, const int pId, const bool rec ) const
{
\param id menu action ID
\param startNode start menu node (if 0, search from root node)
\param rec if \c true perform recursive search
- \return menu node or 0 if not found
+ \return menu node or 0 if it is not found
*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode, const bool rec ) const
{
\param title menu item title
\param pId parent menu item ID
\param rec if \c true perform recursive search
- \return menu node or 0 if not found
+ \return menu node or 0 if it is not found
*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, const int pId, const bool rec ) const
{
\param title menu item title
\param startNode start menu node (if 0, search from root node)
\param rec if \c true perform recursive search
- \return menu node or 0 if not found
+ \return menu node or 0 if it is not found
*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, MenuNode* startNode, const bool rec ) const
{
/*!
\brief Get action by \a id.
\param id action ID
- \return action or 0 if not found
+ \return action or 0 if \a id is invalid
*/
QAction* QtxActionMenuMgr::itemAction( const int id ) const
{
/*!
\brief Get submenu action by \a id.
\param id submenu ID
- \return submenu action or 0 if not found
+ \return submenu action or 0 if action is not found
*/
QAction* QtxActionMenuMgr::menuAction( const int id ) const
{
/*!
\brief Get submenu action by \a id.
\param id submenu ID
- \return submenu action or 0 if not found
+ \return submenu action or 0 if it is not found
*/
int QtxActionMenuMgr::menuActionId( QAction* a ) const
{
/*!
\brief Get menu widget for the given \a node.
\param node menu node
- \return popup menu or main menu corresponding to the menu node (or 0 if not found)
+ \return popup menu or main menu corresponding to the menu node
+ (or 0 if it is not found)
*/
-QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node) const
+QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node ) const
{
if ( !node || node == myRoot )
return myMenu;
/*!
\brief Get menu by the specified identifier.
\param id menu item ID
- \return \c menu poiter or 0 if menu is not found
+ \return menu pointer or 0 if menu is not found
*/
QMenu* QtxActionMenuMgr::findMenu( const int id ) const
{
*/
QtxActionMenuMgr::MenuCreator::MenuCreator( QtxActionMgr::Reader* r, QtxActionMenuMgr* mgr )
: QtxActionMgr::Creator( r ),
-myMgr( mgr )
+ myMgr( mgr )
{
}
/*!
- \brief Creator destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionMenuMgr::MenuCreator::~MenuCreator()
{
return res;
}
-
-/*!
- \fn void QtxActionMenuMgr::menuAboutToShow( QMenu* m )
- \brief Emitted when the menu is about to be shown.
- \param m menu being shown
-*/
-
-/*!
- \fn void QtxActionMenuMgr::menuAboutToHide( QMenu* m )
- \brief Emitted when the menu is about to be hidden.
- \param m menu being hidden
-*/
static qtx_actionlist qtx_separator_actions;
/*!
- \internal
\brief Clean all cashed separator actions.
- */
+ \internal
+*/
void qtxSeparatorActionCleanup()
{
for ( qtx_actionlist::iterator it = qtx_separator_actions.begin(); it != qtx_separator_actions.end(); ++it )
/*!
\class QtxActionMgr::SeparatorAction
- \internal
\brief Separator action class.
+ \internal
*/
class QtxActionMgr::SeparatorAction : public QtxAction
};
/*!
- \brief Separator action constructor.
+ \brief Constructor.
+ \internal
\param parent parent object
*/
QtxActionMgr::SeparatorAction::SeparatorAction( QObject* parent )
}
/*!
- \brief Separator action destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionMgr::SeparatorAction::~SeparatorAction()
{
}
-
/*!
\class QtxActionMgr
- \brief Manages a set of actions accessible by unique ID.
+ \brief Manages a set of actions accessible by unique identifier.
- Base class for menu, toolbar action containers and popup menu creators.
+ Base class for menu, toolbar actions containers and popup menu creators.
+
+ Actions are registered in the manager with the registerAction() method
+ and unregistered from it with the unRegisterAction() method.
+
+ Functions action() and actionId() allow getting action by its identifier
+ and vice versa. Method contains() returns \c true if the action with
+ the specified identifier is already registered.
+
+ To get total number of the registered actions can be retrieved by
+ the method count(). Function isEmpty() returns \c true if manager does not
+ contains any actions. The list of all actions identifiers can be retrieved
+ with the idList() function.
+
+ The method separator() allows creating a separator action which can be
+ used in the menus or toolbars to separate logical groups of actions.
+
+ To enable/disable any action by its identifier, use setEnabled() method.
*/
/*!
- \brief Action manager constructor.
+ \brief Constructor.
\param parent parent object
*/
QtxActionMgr::QtxActionMgr( QObject* parent )
}
/*!
- \brief Action manager destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionMgr::~QtxActionMgr()
{
}
/*!
- \brief Register action in the internal map.
+ \brief Register an action in the internal map.
- If \a userId is less than 0, the ID for the action is generated automatically.
- If action with given \a userId is already registered, it will be re-registered.
+ If \a userId is less than 0, the identifier for the action
+ is generated automatically. If action with given \a userId
+ is already registered, it will be re-registered.
\param a action to be registered
\param userId action ID
\return action ID (the same as userId or generated one)
+ \sa unRegisterAction()
*/
int QtxActionMgr::registerAction( QAction* a, const int userId )
{
/*!
\brief Unregister action from internal map.
\param id action ID
+ \sa registerAction()
*/
void QtxActionMgr::unRegisterAction( const int id )
{
}
/*!
- \brief Get action by \a id.
+ \brief Get action by specified identifier.
\param id action ID
- \return action (0 if action is not found)
+ \return action (or 0 if \a id is invalid)
+ \sa actionId()
*/
QAction* QtxActionMgr::action( const int id ) const
{
}
/*!
- \brief Get action ID.
+ \brief Get action identifier.
\param a action
- \return action ID (-1 if action is not found)
+ \return action ID (or -1 if action is not found)
+ \sa action()
*/
int QtxActionMgr::actionId( const QAction* a ) const
{
/*!
\brief Check if an action with given \a id is registered in the action manager.
\param id action ID
- \return \c true if internal map contains action with such ID
+ \return \c true if internal map contains action with such identifier
*/
bool QtxActionMgr::contains( const int id ) const
{
}
/*!
- \brief Get number of registered actions.
+ \brief Get total number of registered actions.
\return number of actions in the internal map
+ \sa isEmpty()
*/
int QtxActionMgr::count() const
{
/*!
\brief Check if there are no actions registered in the action manager.
\return \c true if internal map is empty
+ \sa count()
*/
bool QtxActionMgr::isEmpty() const
{
}
/*!
- \brief Get all registered actions IDs.
- \param list of actions IDs to be fiiled in
+ \brief Get all registered actions identifiers.
+ \return list of actions identifiers
*/
-void QtxActionMgr::idList( QIntList& lst ) const
+QIntList QtxActionMgr::idList() const
{
- lst = myActions.keys();
+ return myActions.keys();
}
/*!
\brief Check if update is enabled.
\return \c true if update is enabled
+ \sa setUpdatesEnabled(), update()
*/
bool QtxActionMgr::isUpdatesEnabled() const
{
/*!
\brief Enable/disable update operation.
\param upd new state
+ \sa isUpdatesEnabled(), update()
*/
void QtxActionMgr::setUpdatesEnabled( const bool upd )
{
}
/*!
- \brief Check if an action with given ID \a actId is visible to
- the parent action with given ID \a place.
+ \brief Check if an action with \a actId identifier is visible to
+ the parent action with \a place identifier.
+ This method can be redefined in subclasses.
Base implementatin always returns \c true.
\param actId action ID
\param place some parent action ID
- \return \c true if an action is visible
+ \return \c true if an action is visible to the parent
+ \sa setVisible()
*/
bool QtxActionMgr::isVisible( const int /*actId*/, const int /*place*/ ) const
{
}
/*!
- \brief Set action visibility flag.
+ \brief Set action's visibility flag.
+ This method can be redefined in subclasses.
Base implementatin does nothing.
\param actId action ID
\param place some parent action ID
- \param on visibility state
+ \param v new visibility state
+ \sa isVisible()
*/
-void QtxActionMgr::setVisible( const int /*actId*/, const int /*place*/, const bool /*on*/ )
+void QtxActionMgr::setVisible( const int /*actId*/, const int /*place*/, const bool /*v*/ )
{
}
/*!
\brief Update actions.
+ Calls virtual function internalUpdate to update the contents.
Does nothing if update is disabled.
- \sa isUpdatesEnabled(), internalUpdate()
+ \sa setUpdatesEnabled(), isUpdatesEnabled(), internalUpdate()
*/
void QtxActionMgr::update()
{
/*!
\brief Internal update.
- This method is called by update() function and should be redefined in successors.
+ This method is called by update() function and can be redefined
+ in subclasses to customize update operation. Base implementation
+ does nothing.
*/
void QtxActionMgr::internalUpdate()
{
}
/*!
- \brief Generate unique action ID.
+ \brief Generate unique action identifier.
\return new ID
*/
int QtxActionMgr::generateId() const
/*!
\brief Create new separator action.
- If \a own is \c true, that the caller is responsible for the action
- deleting. If \a own is \c false, new separator action is owned by the
- action manager which destroys it on application exit.
+ If \a own is \c true, then the caller is responsible for the action
+ destroying. If \a own is \c false, new separator action will be owned by the
+ action manager which will destroy it on application exit.
\param own ownership flag
\return new separator action
\brief Perform delayed update.
Does nothing if update is disabled.
+ \sa isUpdatesEnabled(), setUpdatesEnabled(), update()
*/
void QtxActionMgr::triggerUpdate()
{
\brief Internal content update operation.
Called automatically by onUpdateContent() when the delayed update
- id triggered. Default implementation does nothing.
+ is triggered. Base implementation does nothing.
\sa triggerUpdate(), onUpdateContent()
*/
void QtxActionMgr::updateContent()
-{}
+{
+}
/*!
\brief Called when delayed update is performed (via timer event).
- Calls virtual method updateContent() which can customize the
- content update operation.
+ Calls virtual method updateContent() which can be redefined in the
+ subclasses to customize the content update operation.
*/
void QtxActionMgr::onUpdateContent()
{
\brief Generic actions description files reader class.
This class is used to read files of some format to create actions
- and fill an action manager with actions automatically.
+ and fill an action manager with the actions automatically.
*/
/*!
- \brief Reader constructor.
-
- Does nothing for the moment.
+ \brief Constructor.
*/
QtxActionMgr::Reader::Reader()
{
}
/*!
- \brief Reader destructor
-
- Does nothing for the moment.
+ \brief Destructor
*/
QtxActionMgr::Reader::~Reader()
{
}
/*!
- \brief Get list of options.
+ \brief Get the list of options.
\return options list
*/
QStringList QtxActionMgr::Reader::options() const
/*!
\brief Get option value.
- If there is no such option the default value is returned.
+ If there is no such option the default value (\a def) is returned.
\param name option name
\param def default option value
\brief Read the file and fill and action manager with actions
by using help actions creator.
- Default implementation is pure virtual.
+ This method should be redefined in the subclasses.
\param fname XML file name
\param cr actions creator
- \return \c true in success and \c false in case of error
+ \return \c true on success and \c false in case of error
*/
/*!
\brief XML file reader.
This class is used to read files of XML format to create
- actions and fill an action manager with actions automatically.
+ actions and fill an action manager with actions automatically.
*/
/*!
- \brief XML reader constructor.
-
+ \brief Constructor.
\param root root XML tag name
\param item menu item XML tag name
\param dir resources directory (containing icons, etc)
}
/*!
- \brief XML reader destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionMgr::XMLReader::~XMLReader()
{
/*!
\brief Read the file and fill and action manager with actions
- by using help actions creator.
+ by using actions creator.
\param fname XML file name
\param cr actions creator
- \return \c true in success and \c false in case of error
+ \return \c true on success and \c false in case of error
*/
bool QtxActionMgr::XMLReader::read( const QString& fname, Creator& cr ) const
{
/*!
\brief Get integer attribute value from the attribute map.
- Returns default value if the attribute is not found.
+ Returns default value (\a def) if the attribute is not found.
\param attrs attributes map
\param name attribute name
/*!
\brief Get string attribute value from the attribute map.
- Returns default value if the attribute is not found.
+ Returns default value (\a def) if the attribute is not found.
\param attrs attributes map
\param name attribute name
}
/*!
- \brief Creator constructor.
+ \brief Constructor.
\param r action reader
*/
QtxActionMgr::Creator::Creator( QtxActionMgr::Reader* r )
}
/*!
- \brief Creator destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionMgr::Creator::~Creator()
{
}
/*!
- \brief Connect action to some specific slot(s)
+ \brief Connect action to some specific slot(s).
- Default implementation does nothing.
+ This method can be redefined in subclasses.
+ Base implementation does nothing.
\param a action
*/
/*!
\brief Load pixmap from the file.
\param fname file name
- \param pix uaed to return pixmap
+ \param pix used to return pixmap
\return \c true if pixmap is loaded successfully and \c false in case of error
*/
bool QtxActionMgr::Creator::loadPixmap( const QString& fname, QPixmap& pix ) const
const int pId )
\brief Create (and probably append to the action manager) new action.
- Default implementation is pure virtual.
+ This method should be redefined in the subclasses.
\param tag item tag name
\param subMenu \c true if this item is submenu
int count() const;
bool isEmpty() const;
- void idList( QIntList& ) const;
+ QIntList idList() const;
bool isUpdatesEnabled() const;
virtual void setUpdatesEnabled( const bool );
/*!
\brief Get list of child actions.
- \return list of assigned actions.
+ \return list of assigned actions
*/
QList<QAction*> QtxActionSet::actions() const
{
\brief Called when some action is activated by the user.
\param on toggled state (not used)
*/
-void QtxActionSet::onActionTriggered( bool )
+void QtxActionSet::onActionTriggered( bool /*on*/ )
{
QAction* a = ::qobject_cast<QAction*>( sender() );
if ( !a )
/*!
\brief Get action by specified identifier.
\param id action ID
- \return action or 0 if not found
+ \return action or 0 if it is not found
*/
QAction* QtxActionSet::action( int id ) const
{
/*!
\brief Get action identifier for the action.
\param a action
- \return action ID or -1 if not found
+ \return action ID or -1 if it is not found
*/
int QtxActionSet::actionId( QAction* a ) const
{
/*!
\class QtxActionToolMgr::ToolNode
- \internal
\brief Represents a toolbutton inside toolbar structure.
+ \internal
*/
/*!
\fn QtxActionToolMgr::ToolNode::ToolNode()
+ \internal
\brief Default constructor.
*/
/*!
\fn QtxActionToolMgr::ToolNode::ToolNode( const int _id )
\brief Constructor.
+ \internal
\param _id toolbar node ID
*/
-
/*!
\class QtxActionToolMgr
\brief Toolbar actions manager.
/*!
\brief Create toolbar and assign \a id to it.
- If \a tid is less than 0, the ID is generated automatically.
+ If \a tid is less than 0, the identifier is generated automatically.
If toolbar with given \a tid is already registered, the toolbar will not be created.
\param title toolbar title
\brief Search toolbar with given \a title owned by main window \mw.
\param title toolbar title
\param mw main window
- \return toolbar or 0 if not found
+ \return toolbar or 0 if it is not found
*/
QToolBar* QtxActionToolMgr::find( const QString& title, QMainWindow* mw ) const
{
\param title toolbar title
\return action ID
*/
-int QtxActionToolMgr::prepend( QAction* a, const QString& tname )
+int QtxActionToolMgr::prepend( QAction* a, const QString& title )
{
- return insert( a, tname, 0 );
+ return insert( a, title, 0 );
}
/*!
/*!
\brief Get toolbar by given \a tid.
\param tid toolbar ID
- \return toolbar or 0 if not found
+ \return toolbar or 0 if it is not found
*/
QToolBar* QtxActionToolMgr::toolBar( const int tid ) const
{
/*!
\brief Get toolbar by given \a title.
\param title toolbar title
- \return toolbar or 0 if not found
+ \return toolbar or 0 if it is not found
*/
QToolBar* QtxActionToolMgr::toolBar( const QString& title ) const
{
/*!
\brief Search toolbar by given \a name.
\param title toolbar title
- \return toolbar ID or -1 if not found
+ \return toolbar ID or -1 if it is not found
*/
int QtxActionToolMgr::find( const QString& title ) const
{
}
/*!
- \brief Get toolbar ID.
+ \brief Get toolbar identifier.
\param tb toolbar
\return toolbar ID or -1 if toolbar is not registered
*/
}
/*!
- \brief Remove extra separators from toolbar.
+ \brief Remove extra separators from the toolbar.
\param tb toolbar
*/
void QtxActionToolMgr::simplifySeparators( QToolBar* tb )
}
/*!
- \brief Show action (in all toolbars)
+ \brief Show action (in all toolbars).
\param id action ID
*/
void QtxActionToolMgr::show( const int id )
}
/*!
- \brief Hide action (in all toolbars)
+ \brief Hide action (in all toolbars).
\param id action ID
*/
void QtxActionToolMgr::hide( const int id )
}
/*!
- \brief Creator destructor.
-
- Does nothing for the moment.
+ \brief Destructor.
*/
QtxActionToolMgr::ToolCreator::~ToolCreator()
{