• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KToolBar Class Reference

#include <ktoolbar.h>

Inheritance diagram for KToolBar:
QToolBar

Public Member Functions

 KToolBar (const QString &objectName, QMainWindow *parentWindow, Qt::ToolBarArea area, bool newLine=false, bool isMainToolBar=false, bool readConfig=true)
 
 KToolBar (const QString &objectName, QWidget *parent, bool readConfig=true)
 
 KToolBar (QWidget *parent, bool isMainToolBar=false, bool readConfig=true)
 
virtual ~KToolBar ()
 
void addXMLGUIClient (KXMLGUIClient *client)
 
void applySettings (const KConfigGroup &cg, bool forceGlobal=false)
 
bool contextMenuEnabled () const
 
bool eventFilter (QObject *watched, QEvent *event)
 
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 setContextMenuEnabled (bool enable=true)
 
void setIconDimensions (int size)
 
void setXMLGUIClient (KXMLGUIClient *client)
 

Static Public Member Functions

static void setToolBarsEditable (bool editable)
 
static void setToolBarsLocked (bool locked)
 
static bool toolBarsEditable ()
 
static bool toolBarsLocked ()
 
static Qt::ToolButtonStyle toolButtonStyleSetting ()
 

Protected Slots

virtual void slotMovableChanged (bool movable)
 

Protected Member Functions

virtual void actionEvent (QActionEvent *)
 
virtual void contextMenuEvent (QContextMenuEvent *)
 
virtual void dragEnterEvent (QDragEnterEvent *)
 
virtual void dragLeaveEvent (QDragLeaveEvent *)
 
virtual void dragMoveEvent (QDragMoveEvent *)
 
virtual void dropEvent (QDropEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 

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.

Author
Reginald Stadlbauer reggi.nosp@m.e@kd.nosp@m.e.org, Stephan Kulow coolo.nosp@m.@kde.nosp@m..org, Sven Radej radej.nosp@m.@kde.nosp@m..org, Hamish Rodda rodda.nosp@m.@kde.nosp@m..org.

Definition at line 53 of file ktoolbar.h.

Constructor & Destructor Documentation

◆ KToolBar() [1/3]

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

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
parentThe standard toolbar parent (usually a KMainWindow)
isMainToolBarTrue for the "main toolbar", false for other toolbars. Different settings apply.
readConfigwhether to apply the configuration (global and application-specific)

Definition at line 766 of file ktoolbar.cpp.

◆ KToolBar() [2/3]

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

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
objectNameThe 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.
parentThe standard toolbar parent (usually a KMainWindow)
readConfigwhether to apply the configuration (global and application-specific)

Definition at line 777 of file ktoolbar.cpp.

◆ KToolBar() [3/3]

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.

Parameters
objectNameThe QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position
parentWindowThe window that should be the parent of this toolbar
areaThe position of the toolbar. Usually Qt::TopToolBarArea.
newLineIf true, start a new line in the dock for this toolbar.
isMainToolBarTrue for the "main toolbar", false for other toolbars. Different settings apply.
readConfigwhether to apply the configuration (global and application-specific)

Definition at line 791 of file ktoolbar.cpp.

◆ ~KToolBar()

KToolBar::~KToolBar ( )
virtual

Destroys the toolbar.

Definition at line 808 of file ktoolbar.cpp.

Member Function Documentation

◆ actionEvent()

void KToolBar::actionEvent ( QActionEvent *  event)
protectedvirtual

Definition at line 1369 of file ktoolbar.cpp.

◆ addXMLGUIClient()

void KToolBar::addXMLGUIClient ( KXMLGUIClient *  client)

Adds an XML gui client that uses this toolbar.

Since
4.8.1

Definition at line 864 of file ktoolbar.cpp.

◆ applySettings()

void KToolBar::applySettings ( const KConfigGroup &  cg,
bool  forceGlobal = false 
)

Read the toolbar settings from group configGroup in config and apply them.

Parameters
forceGlobalis deprecated. In kde3 it used to mean "force global settings, i.e. ignore @p cg", but only for visibility/position/index, not for icon size etc. Only visibility is still controlled by this.

Definition at line 1041 of file ktoolbar.cpp.

◆ contextMenuEnabled()

bool KToolBar::contextMenuEnabled ( ) const

Returns the context menu enabled flag.

Returns
true if the context menu is disabled
Deprecated:
use contextMenuPolicy

Definition at line 822 of file ktoolbar.cpp.

◆ contextMenuEvent()

void KToolBar::contextMenuEvent ( QContextMenuEvent *  event)
protectedvirtual

Definition at line 874 of file ktoolbar.cpp.

◆ dragEnterEvent()

void KToolBar::dragEnterEvent ( QDragEnterEvent *  event)
protectedvirtual

Definition at line 1090 of file ktoolbar.cpp.

◆ dragLeaveEvent()

void KToolBar::dragLeaveEvent ( QDragLeaveEvent *  event)
protectedvirtual

Definition at line 1169 of file ktoolbar.cpp.

◆ dragMoveEvent()

void KToolBar::dragMoveEvent ( QDragMoveEvent *  event)
protectedvirtual

Definition at line 1132 of file ktoolbar.cpp.

◆ dropEvent()

void KToolBar::dropEvent ( QDropEvent *  event)
protectedvirtual

Definition at line 1184 of file ktoolbar.cpp.

◆ eventFilter()

bool KToolBar::eventFilter ( QObject *  watched,
QEvent *  event 
)

Reimplemented to support context menu activation on disabled tool buttons.

Definition at line 1272 of file ktoolbar.cpp.

◆ iconSizeDefault()

int KToolBar::iconSizeDefault ( ) const

Returns the default size for this type of toolbar.

Returns
the default size for this type of toolbar.

Definition at line 1079 of file ktoolbar.cpp.

◆ loadState()

void KToolBar::loadState ( const QDomElement &  element)

Load state from an XML.

Parameters
element,calledby KXMLGUIBuilder.

Definition at line 900 of file ktoolbar.cpp.

◆ mainWindow()

KMainWindow * KToolBar::mainWindow ( ) const

Returns the main window that this toolbar is docked with.

Definition at line 1068 of file ktoolbar.cpp.

◆ mouseMoveEvent()

void KToolBar::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 1221 of file ktoolbar.cpp.

◆ mousePressEvent()

void KToolBar::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 1207 of file ktoolbar.cpp.

◆ mouseReleaseEvent()

void KToolBar::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 1260 of file ktoolbar.cpp.

◆ removeXMLGUIClient()

void KToolBar::removeXMLGUIClient ( KXMLGUIClient *  client)

Removes an XML gui client that uses this toolbar.

Since
4.8.5

Definition at line 869 of file ktoolbar.cpp.

◆ saveSettings()

void KToolBar::saveSettings ( KConfigGroup &  cg)

Save the toolbar settings to group configGroup in config.

Definition at line 828 of file ktoolbar.cpp.

◆ saveState()

void KToolBar::saveState ( QDomElement &  element) const

Save state into an XML.

Parameters
element,calledby KXMLGUIBuilder.

Definition at line 1008 of file ktoolbar.cpp.

◆ setContextMenuEnabled()

void KToolBar::setContextMenuEnabled ( bool  enable = true)

This allows you to enable or disable the context menu.

Parameters
enableIf false, then the context menu will be disabled
Deprecated:
use setContextMenuPolicy

Definition at line 815 of file ktoolbar.cpp.

◆ setIconDimensions()

void KToolBar::setIconDimensions ( int  size)

Convenience function to set icon size.

Definition at line 1073 of file ktoolbar.cpp.

◆ setToolBarsEditable()

void KToolBar::setToolBarsEditable ( bool  editable)
static

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.

Definition at line 1410 of file ktoolbar.cpp.

◆ setToolBarsLocked()

void KToolBar::setToolBarsLocked ( bool  locked)
static

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

Definition at line 1417 of file ktoolbar.cpp.

◆ setXMLGUIClient()

void KToolBar::setXMLGUIClient ( KXMLGUIClient *  client)

Sets the XML gui client.

Deprecated:
use addXMLGUIClient.

Definition at line 857 of file ktoolbar.cpp.

◆ slotMovableChanged

void KToolBar::slotMovableChanged ( bool  movable)
protectedvirtualslot

Definition at line 1084 of file ktoolbar.cpp.

◆ toolBarsEditable()

bool KToolBar::toolBarsEditable ( )
static

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

Definition at line 1405 of file ktoolbar.cpp.

◆ toolBarsLocked()

bool KToolBar::toolBarsLocked ( )
static

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

Definition at line 1430 of file ktoolbar.cpp.

◆ toolButtonStyleSetting()

Qt::ToolButtonStyle KToolBar::toolButtonStyleSetting ( )
static

Returns the global setting for "Icon Text" for the main toolbar.

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

Definition at line 893 of file ktoolbar.cpp.


The documentation for this class was generated from the following files:
  • ktoolbar.h
  • ktoolbar.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal