# class KToolBar

###

Module | kdeui
Namespace |
Class | KToolBar
Inherits | QToolBar

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.

Author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>, Hamish Rodda <rodda@kde.org>.

### methods

- KToolBar (parent, honorStyle, readConfig)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget |
  honorStyle | bool | 0
  readConfig | bool | 1

  Normal constructor. This constructor is used by the XML-GUI. If you use it, you need to call QMainWindow.addToolBar to specify the position of the toolbar. So it's simpler to use the other constructor.

  The toolbar will read in various global config settings for things like icon size and text position, etc. However, some of the settings will be honored only if honorStyle is set to true. All other toolbars will be IconOnly and use Medium icons.

  parent - The standard toolbar parent (usually a KMainWindow)

  honorStyle - If true, then global settings for IconSize and IconText will be honored

  readConfig - whether to apply the configuration (global and application-specific)

- KToolBar (objectName, parentWindow, area, newLine, honorStyle, readConfig)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  objectName | QString |
  parentWindow | QMainWindow |
  area | Qt.ToolBarArea |
  newLine | bool | 0
  honorStyle | bool | 0
  readConfig | bool | 1

  Constructor for non-XML-GUI applications.

  The toolbar will read in various global config settings for things like icon size and text position, etc. However, some of the settings will be honored only if honorStyle is set to true. All other toolbars will be IconOnly and use Medium icons.

  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.

  honorStyle - If true, then global settings for IconSize and IconText will be honored

  readConfig - whether to apply the configuration (global and application-specific)

- KToolBar (a0, a1, a2)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |
  a1 | bool | 0
  a2 | bool | 1

- actionEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QActionEvent |

- applySettings (cg, force)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  cg | KConfigGroup |
  force | bool | 0

  Read the toolbar settings from group configGroup in config and apply them. Even default settings are re-applied if force is set.

- contextMenuEnabled ( )

  returns bool

  Returns the context menu enabled flag Returns true if the context menu is disabled Deprecated use contextMenuPolicy

- contextMenuEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QContextMenuEvent |

- dragEnterEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDragEnterEvent |

- dragLeaveEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDragLeaveEvent |

- dragMoveEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDragMoveEvent |

- dropEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDropEvent |

- eventFilter (watched, event)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  watched | QObject |
  event | QEvent |

  Reimplemented to support context menu activation on disabled tool buttons.

- iconSizeDefault ( )

  returns int

  Returns the default size for this type of toolbar.

  Returns the default size for this type of toolbar.

- loadState (element)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  element | QDomElement |

  Load state from an XML element, - called by KXMLGUIBuilder.

- mainWindow ( )

  returns KMainWindow

  Returns the main window that this toolbar is docked with.

- mouseMoveEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

- mousePressEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

- mouseReleaseEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

- saveSettings (cg)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  cg | KConfigGroup |

  Save the toolbar settings to group configGroup in config.

- saveState (element)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  element | QDomElement |

  Save state into an XML element, - called by KXMLGUIBuilder.

- setContextMenuEnabled (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool | 1

  This allows you to enable or disable the context menu.

  enable - If false, then the context menu will be disabled Deprecated use setContextMenuPolicy

- setIconDimensions (size)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  size | int |

  Convenience function to set icon size

- setToolBarsEditable (editable)

  returns Nothing
  static

  Argument | Type | Default
  --- | --- | ---
  editable | bool |

  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 (locked)

  returns Nothing
  static

  Argument | Type | Default
  --- | --- | ---
  locked | bool |

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

- setXMLGUIClient (client)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  client | KXMLGUIClient |

  Sets the XML gui client.

- slotMovableChanged (movable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  movable | bool |

- toolBarsEditable ( )

  returns bool
  static

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

- toolBarsLocked ( )

  returns bool
  static

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

- toolButtonStyleSetting ( )

  returns Qt.ToolButtonStyle
  static

  Returns the global setting for "Icon Text" Returns global setting for "Icon Text"