KToolBarEditor Class
The toolbar editing of KEditToolBar, without widgets. More...
- Header:
#include <KToolBarEditor> - CMake:
find_package(KF6 REQUIRED COMPONENTS XmlGui)
target_link_libraries(mytarget PRIVATE KF6::XmlGui) - Inherits: QObject
List of all members, including inherited members
Public Types
Properties
- [read-only] availableActions : QAbstractItemModel* const
- [read-only] currentActions : QAbstractItemModel* const
- currentToolBar : int
- [read-only] toolBars : QStringList
Public Functions
- int insertAction(int availableRow, int currentRow, bool prepend = false)
- bool load(KXMLGUIFactory *factory, const QString &defaultToolBar = QString())
- bool load(KActionCollection *collection, const QString &resourceFile, bool global = true, const QString &defaultToolBar = QString())
- int moveAction(int currentRow, int afterRow)
- int moveDown(int currentRow)
- int moveUp(int currentRow)
- void rebuildClients()
- void removeAction(int currentRow)
- void restoreDefaults()
- void save()
- void setActionIcon(int currentRow, const QString &iconName)
- void setActionIconText(int currentRow, const QString &text, bool textAlongsideIconHidden)
- void setCurrentToolBar(int index)
Signals
Detailed Description
Loads the toolbars of a KXMLGUIFactory's clients (or of one resource file), lists the current toolbar's actions and the actions that can be added to it as item models, and changes the clients' XML as KEditToolBar does: insert, remove and move actions, change an action's icon and icon text, save, and restore the defaults. KEditToolBar's widget and QML toolbar editors both use it.
Rows are those of currentActions() and availableActions(); -1 means none.
Member Type Documentation
enum KToolBarEditor::Role
The item models' roles, besides Qt::DisplayRole (the text, role name "text") and Qt::DecorationRole (the action's QIcon, role name "icon").
| Constant | Value | Description |
|---|---|---|
KToolBarEditor::NameRole |
Qt::UserRole + 1 |
The element's name. |
KToolBarEditor::TagRole |
258 |
The element's tag: Action, Separator, Spacer, Merge or ActionList. |
KToolBarEditor::StatusTextRole |
259 |
The help text shown for a selected element. |
KToolBarEditor::IconNameRole |
260 |
The name of the action's icon. |
KToolBarEditor::TextAlongsideIconHiddenRole |
261 |
Whether the text is hidden when the toolbar shows text alongside icons. |
Property Documentation
[read-only] availableActions : QAbstractItemModel* const
The separator, the expanding spacer and the client's actions not in the toolbar, sorted by text.
Access functions:
QAbstractItemModel*availableActions() const
[read-only] currentActions : QAbstractItemModel* const
The toolbar's elements in their order.
Access functions:
QAbstractItemModel*currentActions() const
currentToolBar : int
The index in toolBars() of the toolbar being edited.
Access functions:
intcurrentToolBar() constvoidsetCurrentToolBar(intindex)
Notifier signal:
voidcurrentToolBarChanged()
[read-only] toolBars : QStringList
The user-visible names of the editable toolbars, in the factory's order.
Access functions:
QStringListtoolBars() const
Notifier signal:
voidtoolBarsChanged()
Member Function Documentation
[signal] void KToolBarEditor::changed()
Emitted for every change the user made.
[invokable] int KToolBarEditor::insertAction(int availableRow, int currentRow, bool prepend = false)
Puts the available element at availableRow into the toolbar after the element at currentRow, or at its start (prepend) or end when currentRow is -1. Returns the new row of the inserted element.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
bool KToolBarEditor::load(KXMLGUIFactory *factory, const QString &defaultToolBar = QString())
Loads the toolbars of every client of factory, selecting defaultToolBar (by name) or the first. Returns false if this editor was already loaded.
bool KToolBarEditor::load(KActionCollection *collection, const QString &resourceFile, bool global = true, const QString &defaultToolBar = QString())
Loads the toolbars of resourceFile (merged with ui_standards.rc if global) with the actions of collection. Returns false if this editor was already loaded.
[invokable] int KToolBarEditor::moveAction(int currentRow, int afterRow)
Moves the element at currentRow to after the element at afterRow (its row before the move), or to the start when afterRow is -1. Returns its new row.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] int KToolBarEditor::moveDown(int currentRow)
Moves the element at currentRow one place down. Returns its new row.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] int KToolBarEditor::moveUp(int currentRow)
Moves the element at currentRow one place up. Returns its new row.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::rebuildClients()
Removes and re-adds every client of the factory, so they read their XML again.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::removeAction(int currentRow)
Takes the element at currentRow out of the toolbar.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::restoreDefaults()
Deletes the local XML files, rebuilds the GUI and loads the toolbars again.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::save()
Saves the changed clients' local XML files and rebuilds the factory's GUI.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::setActionIcon(int currentRow, const QString &iconName)
Gives the action at currentRow the icon named iconName.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void KToolBarEditor::setActionIconText(int currentRow, const QString &text, bool textAlongsideIconHidden)
Gives the action at currentRow the icon text text (trimmed), shown or hidden alongside its icon.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void KToolBarEditor::setCurrentToolBar(int index)
Selects the toolbar at index and reloads its lists, also when it is already the current one.
Note: Setter function for property currentToolBar.
See also currentToolBar()