|KMoreToolsMenuItem (const KMoreToolsMenuItem &)=delete|
|QAction *||action () const|
|KMoreTools::MenuSection||defaultLocation () const|
|QString||id () const|
|QString||initialItemText () const|
|KMoreToolsMenuItem &||operator= (const KMoreToolsMenuItem &)=delete|
|KMoreToolsService *||registeredService () const|
|void||setId (const QString &id)|
|void||setInitialItemText (const QString &itemText)|
Represents a menu item of a service (application, tool or variant of the same service with different parameters).
The service might be installed or not.
The corresponding QAction will be created for installed services.
- that for not-installed services action() returns nullptr.
Member Function Documentation
|QAction * KMoreToolsMenuItem::action||(||)||const|
Case 1KMoreToolsMenuBuilder::addMenuItem was called with KKmoreToolsService* argument.
the corresponding QAction which will be added to the actual menu when underlying service is installed or else - if not installed - nullptr.
So you can change the created action as you desire.
We return nullptr because not-installed services will get a submenu with other items like opening a website instead of an single action.
To change the item's text even for not-installed services use initialItemText()
Note, that once the method was invoked the first time the action is created an then reused.
KMoreToolsMenuBuilder::addMenuItem was called with QAction* argument. The added action will be returned.
- See also
Auto-generated unique id that tries to be as stable as possible even if the menu gets restructured after the user did some customization that was persisted in a config file.
- It is possible to add the same service more than once (and then hopefully change the action text). When the order of those are changed, the id will not be consistent (because internally an increasing number is used) If you have issues with this you can solve this by manually calling setId (e.g. 'desktopEntryName' + 'x').
|KMoreToolsService * KMoreToolsMenuItem::registeredService||(||)||const|
|void KMoreToolsMenuItem::setId||(||const QString &||id||)|
|void KMoreToolsMenuItem::setInitialItemText||(||const QString &||itemText||)|
Sets the initial text of a menu item.
Menu items of a non-installed service will get this text. If the service is installed and you would like to change the item text, you can retrieve the created QAction (action()) and modify the text using QAction's methods (QAction::setText()).
- See also
The documentation for this class was generated from the following files: