KToolBar Class

Header: #include <KToolBar>

Public Functions

KToolBar(QWidget *parent, bool isMainToolBar = false, bool readConfig = true)
KToolBar(const QString &objectName, QWidget *parent, bool readConfig = true)
KToolBar(const QString &objectName, QMainWindow *parentWindow, Qt::ToolBarArea area, bool newLine = false, bool isMainToolBar = false, bool readConfig = true)
virtual ~KToolBar() override
void addXMLGUIClient(KXMLGUIClient *client)
void applySettings(const KConfigGroup &cg)
int iconSizeDefault() const
void loadState(const QDomElement &element)
KMainWindow *mainWindow() const
void removeXMLGUIClient(KXMLGUIClient *client)
void saveSettings(KConfigGroup &cg)
void saveState(QDomElement &element) const
void setIconDimensions(int size)

Reimplemented Public Functions

virtual bool eventFilter(QObject *watched, QEvent *event) override

Static Public Members

void emitToolbarStyleChanged()
void setToolBarsEditable(bool editable)
void setToolBarsLocked(bool locked)
bool toolBarsEditable()
bool toolBarsLocked()

Detailed Description

* @class KToolBar ktoolbar.h KToolBar * * @short Floatable toolbar with auto resize. * * A KDE-style toolbar. * * KToolBar can be used as a standalone widget, but KMainWindow * provides easy factories and management of one or more toolbars. * * KToolBar uses a global config group to load toolbar settings on * construction. It will reread this config group on a * KApplication::appearanceChanged() signal. * * KToolBar respects Kiosk settings (see the KAuthorized namespace in the * KConfig framework). In particular, system administrators can prevent users * from moving toolbars with the "movable_toolbars" action, and from showing or * hiding toolbars with the "options_show_toolbar" action. For example, to * disable both, add the following the application or global configuration: * @verbatim [KDE Action Restrictions][$i] movable_toolbars=false options_show_toolbar=false @endverbatim * * If you can't depend on KXmlGui but still want to integrate better with KDE, * you can use QToolBar and: * - Set ToolButtonStyle to Qt::ToolButtonFollowStyle, this will make QToolBar * use the settings for "Main Toolbar" * - Additionally set QToolBar::setProperty("otherToolbar", true) to use settings * for "Other toolbars"; settings from "Other toolbars" will only work on widget * styles derived from KStyle * * @author Reginald Stadlbauer <reggie@kde.org> * @author Stephan Kulow <coolo@kde.org> * @author Sven Radej <radej@kde.org> * @author Hamish Rodda <rodda@kde.org>

Member Function Documentation

[explicit] KToolBar::KToolBar(QWidget *parent, bool isMainToolBar = false, bool readConfig = true)

Constructor.

This constructor takes care of adding the toolbar to the mainwindow, if @p parent is a QMainWindow.

Normally KDE applications do not call this directly, they either call KMainWindow::toolBar(), or they use XML-GUI and specify toolbars using XML.

@param parent The standard toolbar parent (usually a KMainWindow) @param isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply. @param readConfig whether to apply the configuration (global and application-specific)

[explicit] KToolBar::KToolBar(const QString &objectName, QWidget *parent, bool readConfig = true)

Constructor.

This constructor takes care of adding the toolbar to the mainwindow, if @p parent is a QMainWindow.

Normally KDE applications do not call this directly, they either call KMainWindow::toolBar(), or they use XML-GUI and specify toolbars using XML.

@param objectName The QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position, and so that KToolBar can find out if it's the main toolbar. @param parent The standard toolbar parent (usually a KMainWindow) @param readConfig whether to apply the configuration (global and application-specific)

KToolBar::KToolBar(const QString &objectName, QMainWindow *parentWindow, Qt::ToolBarArea area, bool newLine = false, bool isMainToolBar = false, bool readConfig = true)

Alternate constructor with additional arguments, e.g. to choose in which area the toolbar should be auto-added. This is rarely used in KDE. When using XMLGUI you can specify this as an xml attribute instead.

@param objectName The QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position @param parentWindow The window that should be the parent of this toolbar @param area The position of the toolbar. Usually Qt::TopToolBarArea. @param newLine If true, start a new line in the dock for this toolbar. @param isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply. @param readConfig whether to apply the configuration (global and application-specific)

[override virtual noexcept] KToolBar::~KToolBar()

Destroys the toolbar.

void KToolBar::addXMLGUIClient(KXMLGUIClient *client)

Adds an XML gui client that uses this toolbar @since 4.8.1

void KToolBar::applySettings(const KConfigGroup &cg)

Read the toolbar settings from group @p cg and apply them.

[static] void KToolBar::emitToolbarStyleChanged()

Emits a D-Bus signal to tell all toolbars in all applications, that the user settings have changed. @since 5.0

[override virtual] bool KToolBar::eventFilter(QObject *watched, QEvent *event)

Reimplemented to support context menu activation on disabled tool buttons.

int KToolBar::iconSizeDefault() const

Returns the default size for this type of toolbar.

@return the default size for this type of toolbar.

void KToolBar::loadState(const QDomElement &element)

Load state from an XML @param element, called by KXMLGUIBuilder.

KMainWindow *KToolBar::mainWindow() const

Returns the main window that this toolbar is docked with.

void KToolBar::removeXMLGUIClient(KXMLGUIClient *client)

Removes an XML gui client that uses this toolbar @since 4.8.5

void KToolBar::saveSettings(KConfigGroup &cg)

Save the toolbar settings to group @p cg.

void KToolBar::saveState(QDomElement &element) const

Save state into an XML @param element, called by KXMLGUIBuilder.

void KToolBar::setIconDimensions(int size)

Convenience function to set icon size

[static] void KToolBar::setToolBarsEditable(bool editable)

Enable or disable toolbar editing via drag & drop of actions. This is called by KEditToolBar and should generally be set to disabled whenever KEditToolBar is not active.

See also toolBarsEditable().

[static] void KToolBar::setToolBarsLocked(bool locked)

Allows you to lock and unlock all toolbars (i.e., disallow/allow moving of the toobars).

See also toolBarsLocked().

[static] bool KToolBar::toolBarsEditable()

Returns whether the toolbars are currently editable (drag & drop of actions).

See also setToolBarsEditable().

[static] bool KToolBar::toolBarsLocked()

Returns whether the toolbars are locked (i.e., moving of the toobars disallowed).

See also setToolBarsLocked().