KToolBar Class Reference
from PyKDE4.kdeui import *
Inherits: QToolBar → QWidget → QObject
Detailed Description
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.
Methods | |
__init__ (self, QWidget parent, bool isMainToolBar=0, bool readConfig=1) | |
__init__ (self, QString objectName, QMainWindow parentWindow, Qt::ToolBarArea area, bool newLine=0, bool isMainToolBar=0, bool readConfig=1) | |
__init__ (self, QString objectName, QWidget parent, bool readConfig=1) | |
actionEvent (self, QActionEvent a0) | |
addXMLGUIClient (self, KXMLGUIClient client) | |
applySettings (self, KConfigGroup cg, bool forceGlobal=0) | |
bool | contextMenuEnabled (self) |
contextMenuEvent (self, QContextMenuEvent a0) | |
dragEnterEvent (self, QDragEnterEvent a0) | |
dragLeaveEvent (self, QDragLeaveEvent a0) | |
dragMoveEvent (self, QDragMoveEvent a0) | |
dropEvent (self, QDropEvent a0) | |
bool | eventFilter (self, QObject watched, QEvent event) |
int | iconSizeDefault (self) |
loadState (self, QDomElement element) | |
KMainWindow | mainWindow (self) |
mouseMoveEvent (self, QMouseEvent a0) | |
mousePressEvent (self, QMouseEvent a0) | |
mouseReleaseEvent (self, QMouseEvent a0) | |
saveSettings (self, KConfigGroup cg) | |
saveState (self, QDomElement element) | |
setContextMenuEnabled (self, bool enable=1) | |
setIconDimensions (self, int size) | |
setXMLGUIClient (self, KXMLGUIClient client) | |
slotMovableChanged (self, bool movable) | |
Static Methods | |
setToolBarsEditable (bool editable) | |
setToolBarsLocked (bool locked) | |
bool | toolBarsEditable () |
bool | toolBarsLocked () |
Qt::ToolButtonStyle | toolButtonStyleSetting () |
Method Documentation
__init__ | ( | self, | ||
QWidget | parent, | |||
bool | isMainToolBar=0, | |||
bool | readConfig=1 | |||
) |
Constructor.
This constructor takes care of adding the toolbar to the mainwindow, if parent is a QMainWindow.
Normally KDE applications do not call this directly, they either call KMainWindow.toolBar(name), or they use XML-GUI and specify toolbars using XML.
- Parameters:
-
parent The standard toolbar parent (usually a KMainWindow) isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply. readConfig whether to apply the configuration (global and application-specific)
__init__ | ( | self, | ||
QString | objectName, | |||
QMainWindow | parentWindow, | |||
Qt::ToolBarArea | area, | |||
bool | newLine=0, | |||
bool | isMainToolBar=0, | |||
bool | readConfig=1 | |||
) |
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.
- Parameters:
-
objectName The QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position parentWindow The window that should be the parent of this toolbar area The position of the toolbar. Usually Qt.TopToolBarArea. newLine If true, start a new line in the dock for this toolbar. isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply. readConfig whether to apply the configuration (global and application-specific)
__init__ | ( | self, | ||
QString | objectName, | |||
QWidget | parent, | |||
bool | readConfig=1 | |||
) |
Constructor.
This constructor takes care of adding the toolbar to the mainwindow, if parent is a QMainWindow.
Normally KDE applications do not call this directly, they either call KMainWindow.toolBar(name), or they use XML-GUI and specify toolbars using XML.
- Parameters:
-
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. parent The standard toolbar parent (usually a KMainWindow) readConfig whether to apply the configuration (global and application-specific)
actionEvent | ( | self, | ||
QActionEvent | a0 | |||
) |
addXMLGUIClient | ( | self, | ||
KXMLGUIClient | client | |||
) |
Adds an XML gui client that uses this toolbar
- Since:
- 4.8.1
applySettings | ( | self, | ||
KConfigGroup | cg, | |||
bool | forceGlobal=0 | |||
) |
Read the toolbar settings from group configGroup in config and apply them.
- Parameters:
-
forceGlobal is deprecated. In kde3 it used to mean "force global settings, i.e. ignore cg", but only for visibility/position/index, not for icon size etc. Only visibility is still controlled by this.
bool contextMenuEnabled | ( | self ) |
Returns the context menu enabled flag
- Returns:
- true if the context menu is disabled
- Deprecated:
- use contextMenuPolicy
contextMenuEvent | ( | self, | ||
QContextMenuEvent | a0 | |||
) |
dragEnterEvent | ( | self, | ||
QDragEnterEvent | a0 | |||
) |
dragLeaveEvent | ( | self, | ||
QDragLeaveEvent | a0 | |||
) |
dragMoveEvent | ( | self, | ||
QDragMoveEvent | a0 | |||
) |
dropEvent | ( | self, | ||
QDropEvent | a0 | |||
) |
bool eventFilter | ( | self, | ||
QObject | watched, | |||
QEvent | event | |||
) |
Reimplemented to support context menu activation on disabled tool buttons.
int iconSizeDefault | ( | self ) |
Returns the default size for this type of toolbar.
- Returns:
- the default size for this type of toolbar.
loadState | ( | self, | ||
QDomElement | element | |||
) |
Load state from an XML
- Parameters:
-
element, called by KXMLGUIBuilder.
KMainWindow mainWindow | ( | self ) |
Returns the main window that this toolbar is docked with.
mouseMoveEvent | ( | self, | ||
QMouseEvent | a0 | |||
) |
mousePressEvent | ( | self, | ||
QMouseEvent | a0 | |||
) |
mouseReleaseEvent | ( | self, | ||
QMouseEvent | a0 | |||
) |
saveSettings | ( | self, | ||
KConfigGroup | cg | |||
) |
Save the toolbar settings to group configGroup in config.
saveState | ( | self, | ||
QDomElement | element | |||
) |
Save state into an XML
- Parameters:
-
element, called by KXMLGUIBuilder.
setContextMenuEnabled | ( | self, | ||
bool | enable=1 | |||
) |
This allows you to enable or disable the context menu.
- Parameters:
-
enable If false, then the context menu will be disabled
- Deprecated:
- use setContextMenuPolicy
setIconDimensions | ( | self, | ||
int | size | |||
) |
Convenience function to set icon size
setXMLGUIClient | ( | self, | ||
KXMLGUIClient | client | |||
) |
Sets the XML gui client.
- Deprecated:
- use addXMLGUIClient.
slotMovableChanged | ( | self, | ||
bool | movable | |||
) |
Static Method Documentation
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.
setToolBarsLocked | ( | bool | locked | |
) |
Allows you to lock and unlock all toolbars (i.e., disallow/allow moving of the toobars).
bool toolBarsEditable | ( | ) |
Returns whether the toolbars are currently editable (drag & drop of actions).
bool toolBarsLocked | ( | ) |
Returns whether the toolbars are locked (i.e., moving of the toobars disallowed).
Qt::ToolButtonStyle toolButtonStyleSetting | ( | ) |
Returns the global setting for "Icon Text" for the main toolbar
- Returns:
- global setting for "Icon Text" for the main toolbar