• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

KToolBar Class Reference

Floatable toolbar with auto resize. More...

#include <ktoolbar.h>

Inheritance diagram for KToolBar:

Inheritance graph
[legend]

List of all members.


Public Types

enum  BarPosition {
  Unmanaged, Floating, Top, Bottom,
  Right, Left, Flat
}
enum  BarStatus { Toggle, Show, Hide }
enum  IconText { IconOnly = 0, IconTextRight, TextOnly, IconTextBottom }

Public Slots

virtual void setIconText (const QString &txt)

Signals

void clicked (int id)
void doubleClicked (int id)
void highlighted (int id)
void highlighted (int id, bool isHighlighted)
void modechange ()
void moved (BarPosition)
void pressed (int)
void released (int)
void toggled (int)
void toolbarDestroyed ()

Public Member Functions

void addConnection (int id, const char *signal, const QObject *receiver, const char *slot)
void alignItemRight (int id, bool right=true)
KAnimWidget * animatedWidget (int id)
void applySettings (KConfig *config, const QString &configGroup)
void applySettings (KConfig *config, const QString &configGroup, bool force)
BarPosition barPos () const
void changeComboItem (int id, const QString &text, int index=-1)
void clear ()
void clearCombo (int id)
bool contextMenuEnabled () const
int count () const
bool enable (BarStatus stat) KDE_DEPRECATED
void enableFloating (bool flag) KDE_DEPRECATED
void enableMoving (bool flag=true) KDE_DEPRECATED
bool fullSize () const
KToolBarButton * getButton (int id)
KComboBox * getCombo (int id)
QString getComboItem (int id, int index=-1) const
KLineEdit * getLined (int id)
QString getLinedText (int id) const
QWidget * getWidget (int id)
void hide ()
void hideItem (int id)
bool highlight () const
int iconSize () const
int iconSizeDefault () const
IconText iconText () const
int idAt (int index)
int insertAnimatedWidget (int id, QObject *receiver, const char *slot, const QString &icons, int index=-1)
int insertButton (const QPixmap &pixmap, int id, QPopupMenu *popup, bool enabled, const QString &_text, int index=-1)
int insertButton (const QString &icon, int id, QPopupMenu *popup, bool enabled, const QString &_text, int index=-1)
int insertButton (const QPixmap &pixmap, int id, const char *signal, const QObject *receiver, const char *slot, bool enabled=true, const QString &text=QString::null, int index=-1)
int insertButton (const QPixmap &pixmap, int id, bool enabled=true, const QString &text=QString::null, int index=-1)
int insertButton (const QString &icon, int id, const char *signal, const QObject *receiver, const char *slot, bool enabled=true, const QString &text=QString::null, int index=-1, KInstance *_instance=KGlobal::instance())
int insertButton (const QString &icon, int id, bool enabled=true, const QString &text=QString::null, int index=-1, KInstance *_instance=KGlobal::instance())
int insertCombo (const QString &text, int id, bool writable, const char *signal, QObject *receiver, const char *slot, bool enabled=true, const QString &tooltiptext=QString::null, int size=70, int index=-1, QComboBox::Policy policy=QComboBox::AtBottom)
int insertCombo (const QStringList &list, int id, bool writable, const char *signal, const QObject *receiver, const char *slot, bool enabled=true, const QString &tooltiptext=QString::null, int size=70, int index=-1, QComboBox::Policy policy=QComboBox::AtBottom)
void insertComboItem (int id, const QString &text, int index)
void insertComboList (int id, const QStringList &list, int index)
int insertLined (const QString &text, int id, const char *signal, const QObject *receiver, const char *slot, bool enabled=true, const QString &toolTipText=QString::null, int size=70, int index=-1)
int insertLineSeparator (int index=-1, int id=-1)
int insertSeparator (int index=-1, int id=-1)
int insertWidget (int id, int width, QWidget *_widget, int index=-1)
bool isButtonOn (int id) const
int itemIndex (int id)
 KToolBar (QMainWindow *parentWindow, QWidget *dock, bool newLine=false, const char *name=0, bool honorStyle=false, bool readConfig=true)
 KToolBar (QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine=false, const char *name=0, bool honorStyle=false, bool readConfig=true)
 KToolBar (QWidget *parent, const char *name=0, bool honorStyle=false, bool readConfig=true)
void loadState (const QDomElement &e)
int maxHeight () KDE_DEPRECATED
int maxWidth () KDE_DEPRECATED
QSize minimumSize () const
QSize minimumSizeHint () const
void positionYourself (bool force=false)
void removeComboItem (int id, int index)
void removeItem (int id)
void removeItemDelayed (int id)
void saveSettings (KConfig *config, const QString &configGroup)
void saveState (QDomElement &e)
void saveState ()
void setAutoRepeat (int id, bool flag=true)
void setBarPos (BarPosition bpos)
void setButton (int id, bool flag)
void setButtonIcon (int id, const QString &_icon)
void setButtonIconSet (int id, const QIconSet &iconset)
void setButtonPixmap (int id, const QPixmap &_pixmap)
void setCurrentComboItem (int id, int index)
void setDelayedPopup (int id, QPopupMenu *_popup, bool toggle=false)
void setEnableContextMenu (bool enable=true)
void setFlat (bool flag)
void setFullSize (bool flag=true)
void setIconSize (int size, bool update)
void setIconSize (int size)
void setIconText (IconText it, bool update)
void setIconText (IconText it)
void setItemAutoSized (int id, bool yes=true)
void setItemEnabled (int id, bool enabled)
void setItemNoStyle (int id, bool no_style=true)
void setLinedText (int id, const QString &text)
void setMaxHeight (int h) KDE_DEPRECATED
void setMaxWidth (int dw) KDE_DEPRECATED
void setStretchableWidget (QWidget *w)
void setText (const QString &txt)
void setTitle (const QString &_title)
void setToggle (int id, bool flag=true)
void setXMLGUIClient (KXMLGUIClient *client)
void show ()
void showItem (int id)
QSize sizeHint () const
QSizePolicy sizePolicy () const
QString text () const
void toggleButton (int id)
void updateRects (bool=false)
virtual ~KToolBar ()

Static Public Member Functions

static bool highlightSetting ()
static IconText iconTextSetting ()
static bool transparentSetting ()

Protected Member Functions

void applyAppearanceSettings (KConfig *config, const QString &_configGroup, bool forceGlobal=false)
void childEvent (QChildEvent *e)
bool event (QEvent *e)
void mousePressEvent (QMouseEvent *)
void resizeEvent (QResizeEvent *e)
QString settingsGroup () const
void showEvent (QShowEvent *e)
virtual void virtual_hook (int id, void *data)

Properties

BarPosition barPos
bool fullSize
int iconSize
IconText iconText
QString text

Detailed Description

Floatable toolbar with auto resize.

A KDE-style toolbar.

KToolBar can be dragged around in and between different docks.

A KToolBar can contain all sorts of widgets.

KToolBar can be used as a standalone widget, but KMainWindow provides easy factories and management of one or more toolbars. Once you have a KToolBar object, you can insert items into it with the insert... methods, or remove them with the removeItem() method. This can be done at any time; the toolbar will be automatically updated. There are also many methods to set per-child properties like alignment and toggle behavior.

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>.

Definition at line 103 of file ktoolbar.h.


Member Enumeration Documentation

enum KToolBar::BarPosition

Possible bar positions.

Enumerator:
Unmanaged 
Floating 
Top 
Bottom 
Right 
Left 
Flat 

Definition at line 123 of file ktoolbar.h.

enum KToolBar::BarStatus

The state of the status bar.

Deprecated:
Enumerator:
Toggle 
Show 
Hide 

Definition at line 119 of file ktoolbar.h.

enum KToolBar::IconText

Enumerator:
IconOnly 
IconTextRight 
TextOnly 
IconTextBottom 

Definition at line 114 of file ktoolbar.h.


Constructor & Destructor Documentation

KToolBar::KToolBar ( QWidget *  parent,
const char *  name = 0,
bool  honorStyle = false,
bool  readConfig = true 
)

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.

Parameters:
parent The standard toolbar parent (usually a KMainWindow)
name The standard internal name
honorStyle If true, then global settings for IconSize and IconText will be honored
readConfig whether to apply the configuration (global and application-specific)

Definition at line 195 of file ktoolbar.cpp.

KToolBar::KToolBar ( QMainWindow *  parentWindow,
QMainWindow::ToolBarDock  dock,
bool  newLine = false,
const char *  name = 0,
bool  honorStyle = false,
bool  readConfig = true 
)

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.

Parameters:
parentWindow The window that should be the parent of this toolbar
dock The position of the toolbar. Usually QMainWindow::Top.
newLine If true, start a new line in the dock for this toolbar.
name The standard internal name
honorStyle If true, then global settings for IconSize and IconText will be honored
readConfig whether to apply the configuration (global and application-specific)

Definition at line 204 of file ktoolbar.cpp.

KToolBar::KToolBar ( QMainWindow *  parentWindow,
QWidget *  dock,
bool  newLine = false,
const char *  name = 0,
bool  honorStyle = false,
bool  readConfig = true 
)

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.

Parameters:
parentWindow The window that should be the parent of this toolbar
dock Another widget than the mainwindow to dock toolbar to.
newLine If true, start a new line in the dock for this toolbar.
name The standard internal name
honorStyle If true, then global settings for IconSize and IconText will be honored
readConfig whether to apply the configuration (global and application-specific)

Definition at line 212 of file ktoolbar.cpp.

KToolBar::~KToolBar (  )  [virtual]

Destructor.

Definition at line 220 of file ktoolbar.cpp.


Member Function Documentation

void KToolBar::addConnection ( int  id,
const char *  signal,
const QObject *  receiver,
const char *  slot 
)

Adds connections to items.

It is important that you know the id of particular item. Nothing happens if you forget id.

Definition at line 456 of file ktoolbar.cpp.

void KToolBar::alignItemRight ( int  id,
bool  right = true 
)

Align item to the right.

This works only if toolbar is set to full width.

See also:
setFullWidth()

Definition at line 638 of file ktoolbar.cpp.

KAnimWidget * KToolBar::animatedWidget ( int  id  ) 

This will return a pointer to the animated widget with the given id, if it exists.

See also:
insertAnimatedWidget
Parameters:
id The id for the widget you want to get a pointer to
Returns:
A pointer to the current animated widget or 0L

Definition at line 428 of file ktoolbar.cpp.

void KToolBar::applyAppearanceSettings ( KConfig *  config,
const QString &  _configGroup,
bool  forceGlobal = false 
) [protected]

Definition at line 1513 of file ktoolbar.cpp.

void KToolBar::applySettings ( KConfig *  config,
const QString &  configGroup 
)

Definition at line 1635 of file ktoolbar.cpp.

void KToolBar::applySettings ( KConfig *  config,
const QString &  configGroup,
bool  force 
)

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

Even default settings are re-applied if force is set.

Definition at line 1640 of file ktoolbar.cpp.

BarPosition KToolBar::barPos (  )  const

Returns the toolbar position.

Returns:
position of toolbar.

void KToolBar::changeComboItem ( int  id,
const QString &  text,
int  index = -1 
)

Changes item index in combobox id to text.

index = -1 refers current item (one displayed in the button).

Definition at line 588 of file ktoolbar.cpp.

void KToolBar::childEvent ( QChildEvent *  e  )  [protected]

Definition at line 1269 of file ktoolbar.cpp.

void KToolBar::clear (  ) 

Remove all items.

The toolbar is redrawn after it.

Reimplemented from QToolBar.

Definition at line 665 of file ktoolbar.cpp.

void KToolBar::clearCombo ( int  id  ) 

Clears the combobox id.

Does not delete it or hide it.

Definition at line 596 of file ktoolbar.cpp.

void KToolBar::clicked ( int  id  )  [signal]

Emitted when button id is clicked.

bool KToolBar::contextMenuEnabled (  )  const

Returns the context menu enabled flag.

Returns:
true if the context menu is disabled

Definition at line 926 of file ktoolbar.cpp.

int KToolBar::count (  )  const

Returns the total number of items in the toolbar.

Returns:
the total number of items in the toolbar

Definition at line 955 of file ktoolbar.cpp.

void KToolBar::doubleClicked ( int  id  )  [signal]

Emitted when button id is double-clicked.

Note: you will always recive two clicked() , pressed() and released() signals. There is no way to avoid it - at least no easy way. If you need to resolve this all you can do is set up timers which wait for QApplication::doubleClickInterval() to expire. If in that time you don't get this signal, you may belive that button was only clicked and not double-clicked. And please note that butons with popup menus do not emit this signal, but those with delayed popup do.

bool KToolBar::enable ( BarStatus  stat  ) 

Show, hide, or toggle toolbar.

This method is provided for compatibility only, please use show() and/or hide() instead.

See also:
BarStatus
Deprecated:

Definition at line 784 of file ktoolbar.cpp.

void KToolBar::enableFloating ( bool  flag  ) 

Use setMovingEnabled(bool) instead.

Deprecated:

Definition at line 826 of file ktoolbar.cpp.

void KToolBar::enableMoving ( bool  flag = true  ) 

Enable or disable moving of toolbar.

Deprecated:
use setMovingEnabled(bool) instead.

Definition at line 754 of file ktoolbar.cpp.

bool KToolBar::event ( QEvent *  e  )  [protected]

Definition at line 1711 of file ktoolbar.cpp.

bool KToolBar::fullSize (  )  const

Returns the full-size mode enabled flag.

Returns:
true if the full-size mode is enabled.

KToolBarButton * KToolBar::getButton ( int  id  ) 

Returns a pointer to KToolBarButton.

Example:

 KToolBarButton * button = toolbar->getButton(button_id);
That way you can get access to other public methods that KToolBarButton provides.

Using this method is not recommended.

Definition at line 629 of file ktoolbar.cpp.

KComboBox * KToolBar::getCombo ( int  id  ) 

Returns a pointer to the combobox with id.

Returns:
a pointer to the combobox with id.
Example:
 KComboBox *combo = toolbar->getCombo(combo_id);
That way you can get access to other public methods that KComboBox provides.

Definition at line 611 of file ktoolbar.cpp.

QString KToolBar::getComboItem ( int  id,
int  index = -1 
) const

Returns text of item index from combobox id.

Returns:
text of item index from combobox id.
index = -1 refers to current item.

Definition at line 604 of file ktoolbar.cpp.

KLineEdit * KToolBar::getLined ( int  id  ) 

Returns a pointer to KToolBarLined with id.

Returns:
a pointer to KToolBarLined with id.
Example:
 KLineEdit * lined = toolbar->getKToolBarLined(lined_id);
That way you can get access to other public methods that KLineEdit provides. KLineEdit is the same thing as QLineEdit plus completion signals.

Definition at line 620 of file ktoolbar.cpp.

QString KToolBar::getLinedText ( int  id  )  const

Returns the line editor text.

Returns:
the line editor text.

Definition at line 550 of file ktoolbar.cpp.

QWidget * KToolBar::getWidget ( int  id  ) 

Returns a pointer to the widget corresponding to id.

Returns:
a pointer to the widget corresponding to id.
Wrong ids are not tested. You can do with this whatever you want, except change its height (hardcoded). If you change its width you will probably have to call QToolBar::updateRects(true)
See also:
QWidget

updateRects()

Definition at line 650 of file ktoolbar.cpp.

void KToolBar::hide (  ) 

Definition at line 1418 of file ktoolbar.cpp.

void KToolBar::hideItem ( int  id  ) 

Hide item id.

Definition at line 713 of file ktoolbar.cpp.

bool KToolBar::highlight (  )  const

Definition at line 1413 of file ktoolbar.cpp.

void KToolBar::highlighted ( int  id  )  [signal]

This signal is emitted when item id gets highlighted/unhighlighted (i.e when mouse enters/exits).

Note that this signal is emitted from all buttons (normal, disabled and toggle) even when there is no visible change in buttons (i.e., buttons do not raise when mouse enters).

void KToolBar::highlighted ( int  id,
bool  isHighlighted 
) [signal]

This signal is emitted when item id gets highlighted/unhighlighted (i.e when mouse enters/exits).

Note that this signal is emitted from all buttons (normal, disabled and toggle) even when there is no visible change in buttons (i.e., buttons do not raise when mouse enters). The parameter isHighlighted is true when mouse enters and false when mouse exits.

bool KToolBar::highlightSetting (  )  [static]

Returns the global setting for "Highlight buttons under mouse".

Returns:
global setting for "Highlight buttons under mouse"

Definition at line 1482 of file ktoolbar.cpp.

int KToolBar::iconSize (  )  const

Returns the current icon size for buttons.

Returns:
the current icon size for buttons.

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 912 of file ktoolbar.cpp.

IconText KToolBar::iconText (  )  const

Returns the current text style for buttons.

Returns:
the current text style for buttons.

KToolBar::IconText KToolBar::iconTextSetting (  )  [static]

Returns the global setting for "Icon Text".

Returns:
global setting for "Icon Text"

Definition at line 1498 of file ktoolbar.cpp.

int KToolBar::idAt ( int  index  ) 

Returns the id of the item at the given index.

Since:
3.2

Definition at line 735 of file ktoolbar.cpp.

int KToolBar::insertAnimatedWidget ( int  id,
QObject *  receiver,
const char *  slot,
const QString &  icons,
int  index = -1 
)

Inserts an animated widget.

A KAnimWidget will be created internally using the icon name you provide. This will emit a signal (clicked()) whenever the animation widget is clicked.

See also:
animatedWidget()
Parameters:
id The id for this toolbar item
receiver The parent of your slot
slot The slot to receive the clicked() signal
icons The name of the animation icon group to use
index The item index
Returns:
The item index

Definition at line 416 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QPixmap &  pixmap,
int  id,
QPopupMenu *  popup,
bool  enabled,
const QString &  _text,
int  index = -1 
)

Inserts a button with popupmenu.

Button will have small triangle. You have to connect to popup's signals. The signals KButton::pressed(), KButton::released(), KButton::clicked() or KButton::doubleClicked() are not emmited by this button (see setDelayedPopup() for that). You can add custom popups which inherit QPopupMenu to get popups with tables, drawings etc. Just don't fiddle with events there.

Definition at line 319 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QString &  icon,
int  id,
QPopupMenu *  popup,
bool  enabled,
const QString &  _text,
int  index = -1 
)

Inserts a button with popupmenu.

Button will have small triangle. You have to connect to popup's signals. The signals KButton::pressed(), KButton::released(), KButton::clicked() or KButton::doubleClicked() are not emmited by this button (see setDelayedPopup() for that). You can add custom popups which inherit QPopupMenu to get popups with tables, drawings etc. Just don't fiddle with events there.

Definition at line 307 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QPixmap &  pixmap,
int  id,
const char *  signal,
const QObject *  receiver,
const char *  slot,
bool  enabled = true,
const QString &  text = QString::null,
int  index = -1 
)

This is the same as above, but with specified signals and slots to which this button will be connected.

You can add more signals with addConnection().

Parameters:
pixmap The name of the icon to use as the active pixmap
id The id of this button
signal The signal to connect to
receiver The slot's parent
slot The slot to receive the signal specified in that argument.
enabled Enable or disable the button at startup
text The tooltip or toolbar text (depending on state)
index The position of the button. (-1 = at end).
Returns:
The item index.

Definition at line 293 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QPixmap &  pixmap,
int  id,
bool  enabled = true,
const QString &  text = QString::null,
int  index = -1 
)

Inserts a button (a KToolBarButton) with the specified pixmap.

This pixmap will be used as the "active" one and the disabled and default ones will be autogenerated.

It is recommended that you use the insertButton function that allows you to specify the icon name rather then the pixmap itself. Specifying the icon name is much more flexible.

You should connect to one or more signals in KToolBar: clicked() , pressed() , released() , or highlighted() and if the button is a toggle button ( setToggle() ) toggled() . Those signals have id of a button that caused the signal. If you want to bind a popup to button, see setButton().

Parameters:
pixmap The active pixmap
id The id of this button
enabled Enable or disable the button at startup
text The tooltip or toolbar text (depending on state)
index The position of the button. (-1 = at end).
Returns:
The item index.

Definition at line 282 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QString &  icon,
int  id,
const char *  signal,
const QObject *  receiver,
const char *  slot,
bool  enabled = true,
const QString &  text = QString::null,
int  index = -1,
KInstance *  _instance = KGlobal::instance() 
)

This is the same as above, but with specified signals and slots to which this button will be connected.

You can add more signals with addConnection().

Parameters:
icon The name of the icon to use as the active pixmap
id The id of this button
signal The signal to connect to
receiver The slot's parent
slot The slot to receive the signal specified in that argument.
enabled Enable or disable the button at startup
text The tooltip or toolbar text (depending on state)
index The position of the button. (-1 = at end).
_instance instance this button will belong to
Returns:
The item index.

Definition at line 269 of file ktoolbar.cpp.

int KToolBar::insertButton ( const QString &  icon,
int  id,
bool  enabled = true,
const QString &  text = QString::null,
int  index = -1,
KInstance *  _instance = KGlobal::instance() 
)

Insert a button (a KToolBarButton) with a pixmap.

The pixmap is loaded by the button itself based on the global icon settings.

You should connect to one or more signals in KToolBar: clicked() , pressed() , released() , or highlighted() and if the button is a toggle button ( setToggle() ) toggled() . Those signals have id of a button that caused the signal. If you want to bind a popup to button, see setButton().

Parameters:
icon The name of the icon to use as the active pixmap
id The id of this button
enabled Enable or disable the button at startup
text The tooltip or toolbar text (depending on state)
index The position of the button. (-1 = at end).
_instance instance this button will belong to
Returns:
The item index.

Definition at line 257 of file ktoolbar.cpp.

int KToolBar::insertCombo ( const QString &  text,
int  id,
bool  writable,
const char *  signal,
QObject *  receiver,
const char *  slot,
bool  enabled = true,
const QString &  tooltiptext = QString::null,
int  size = 70,
int  index = -1,
QComboBox::Policy  policy = QComboBox::AtBottom 
)

Insert a KComboBox with text.

The rest is the same as above.

See also:
setItemAutoSized()

KComboBox

Returns:
Item index.

Definition at line 374 of file ktoolbar.cpp.

int KToolBar::insertCombo ( const QStringList &  list,
int  id,
bool  writable,
const char *  signal,
const QObject *  receiver,
const char *  slot,
bool  enabled = true,
const QString &  tooltiptext = QString::null,
int  size = 70,
int  index = -1,
QComboBox::Policy  policy = QComboBox::AtBottom 
)

Inserts a KComboBox with list.

Can be writable, but cannot contain pixmaps. By default inserting policy is AtBottom, i.e. typed items are placed at the bottom of the list. Can be autosized. If the size argument is specified as -1, the width of the combobox is automatically computed.

See also:
setFullWidth()

setItemAutoSized()

KComboBox

Returns:
Item index.

Definition at line 350 of file ktoolbar.cpp.

void KToolBar::insertComboItem ( int  id,
const QString &  text,
int  index 
)

Inserts text in combobox id at position index.

Definition at line 557 of file ktoolbar.cpp.

void KToolBar::insertComboList ( int  id,
const QStringList &  list,
int  index 
)

Inserts list in combobox id at position index.

Definition at line 564 of file ktoolbar.cpp.

int KToolBar::insertLined ( const QString &  text,
int  id,
const char *  signal,
const QObject *  receiver,
const char *  slot,
bool  enabled = true,
const QString &  toolTipText = QString::null,
int  size = 70,
int  index = -1 
)

Inserts a KLineEdit.

You have to specify signals and slots to which KLineEdit will be connected. KLineEdit has all slots QLineEdit has, plus signals KLineEdit::completion and KLineEdit::textRotation KLineEdit can be set to autoresize itself to full free width in toolbar, that is to last right aligned item. For that, toolbar must be set to full width (which it is by default).

See also:
setFullWidth()

setItemAutoSized()

KLineEdit

Returns:
Item index.

Definition at line 331 of file ktoolbar.cpp.

int KToolBar::insertLineSeparator ( int  index = -1,
int  id = -1 
)

Inserts a line separator into the toolbar with the given id.

Returns:
the separator's index

Definition at line 401 of file ktoolbar.cpp.

int KToolBar::insertSeparator ( int  index = -1,
int  id = -1 
)

Inserts a separator into the toolbar with the given id.

Returns:
the separator's index

Definition at line 394 of file ktoolbar.cpp.

int KToolBar::insertWidget ( int  id,
int  width,
QWidget *  _widget,
int  index = -1 
)

Inserts a user-defined widget.

The widget must have this toolbar as its parent.

Widget must have a QWidget for base class. Widget can be autosized to full width. If you forget about it, you can get a pointer to this widget with getWidget().

See also:
setItemAutoSized()
Returns:
Item index.

Definition at line 409 of file ktoolbar.cpp.

bool KToolBar::isButtonOn ( int  id  )  const

Returns true if button is on and is a toggle button.

Returns:
true if button is on and is a toggle button
See also:
setToggle()

Definition at line 535 of file ktoolbar.cpp.

int KToolBar::itemIndex ( int  id  ) 

Returns the index of the item id.

Returns:
the index of the item id.
Since:
3.2

Definition at line 729 of file ktoolbar.cpp.

void KToolBar::loadState ( const QDomElement &  e  ) 

Load state from an XML element, called by KXMLGUIBuilder.

Definition at line 1774 of file ktoolbar.cpp.

int KToolBar::maxHeight (  ) 

Returns the value set with setMaxHeight().

Deprecated:
Use maximumHeight() instead.
Returns:
the value set with setMaxHeight().

Definition at line 802 of file ktoolbar.cpp.

int KToolBar::maxWidth (  ) 

Returns the value set with setMaxWidth().

Use maximumWidth() instead.

Returns:
the value set with setMaxWidth().
Deprecated:

Definition at line 814 of file ktoolbar.cpp.

QSize KToolBar::minimumSize (  )  const

Definition at line 1403 of file ktoolbar.cpp.

QSize KToolBar::minimumSizeHint ( void   )  const

Definition at line 1408 of file ktoolbar.cpp.

void KToolBar::modechange (  )  [signal]

This signal is emitted when toolbar detects changing of following parameters: highlighting, button-size, button-mode.

This signal is internal, aimed to buttons.

For internal use only.

void KToolBar::mousePressEvent ( QMouseEvent *  m  )  [protected]

Definition at line 1155 of file ktoolbar.cpp.

void KToolBar::moved ( BarPosition   )  [signal]

Emitted when toolbar changes position, or when an item is removed from toolbar.

If you subclass KMainWindow and reimplement KMainWindow::resizeEvent() be sure to connect to this signal. Note: You can connect this signal to a slot that doesn't take parameter.

void KToolBar::positionYourself ( bool  force = false  ) 

For internal use only.

Definition at line 2005 of file ktoolbar.cpp.

void KToolBar::pressed ( int   )  [signal]

Emitted when button id is pressed.

void KToolBar::released ( int   )  [signal]

Emits when button id is released.

void KToolBar::removeComboItem ( int  id,
int  index 
)

Removes item index from combobox id.

Definition at line 572 of file ktoolbar.cpp.

void KToolBar::removeItem ( int  id  ) 

Remove item id.

Item is deleted. Toolbar is redrawn after it.

Definition at line 678 of file ktoolbar.cpp.

void KToolBar::removeItemDelayed ( int  id  ) 

Remove item id.

Item is deleted when toolbar is redrawn.

Definition at line 694 of file ktoolbar.cpp.

void KToolBar::resizeEvent ( QResizeEvent *  e  )  [protected]

Definition at line 1428 of file ktoolbar.cpp.

void KToolBar::saveSettings ( KConfig *  config,
const QString &  configGroup 
)

Save the toolbar settings to group configGroup in config.

Definition at line 1042 of file ktoolbar.cpp.

void KToolBar::saveState ( QDomElement &  e  ) 

Definition at line 1975 of file ktoolbar.cpp.

void KToolBar::saveState (  ) 

Instruct the toolbar to save it's current state to either the app config file or to the XML-GUI resource file (whichever has precedence).

Definition at line 961 of file ktoolbar.cpp.

void KToolBar::setAutoRepeat ( int  id,
bool  flag = true 
)

Turns a button into an autorepeat button.

Toggle buttons, buttons with menus, or buttons with delayed menus cannot be made into autorepeat buttons. Moreover, you can and will receive only the signal clicked(), but not pressed() or released(). When the user presses this button, you will receive the signal clicked(), and if the button is still pressed after some time, you will receive more clicked() signals separated by regular intervals. Since this uses QButton::setAutoRepeat() , I can't quantify 'some'.

Definition at line 503 of file ktoolbar.cpp.

void KToolBar::setBarPos ( BarPosition  bpos  ) 

Set position of toolbar.

See also:
BarPosition()

Definition at line 760 of file ktoolbar.cpp.

void KToolBar::setButton ( int  id,
bool  flag 
)

Sets a toggle button state.

If the button is a toggle button (see setToggle()) this will set its state flag. This will also emit the signal KButton::toggled().

See also:
setToggle()

Definition at line 527 of file ktoolbar.cpp.

void KToolBar::setButtonIcon ( int  id,
const QString &  _icon 
)

Sets the icon for a button.

Can be used while button is visible.

Definition at line 480 of file ktoolbar.cpp.

void KToolBar::setButtonIconSet ( int  id,
const QIconSet &  iconset 
)

Sets a button icon from a QIconSet.

Can be used while button is visible.

Definition at line 487 of file ktoolbar.cpp.

void KToolBar::setButtonPixmap ( int  id,
const QPixmap &  _pixmap 
)

Sets button pixmap.

Can be used while button is visible.

Definition at line 472 of file ktoolbar.cpp.

void KToolBar::setCurrentComboItem ( int  id,
int  index 
)

Sets item index to be current item in combobox id.

Definition at line 580 of file ktoolbar.cpp.

void KToolBar::setDelayedPopup ( int  id,
QPopupMenu *  _popup,
bool  toggle = false 
)

Sets a delayed popup for a button.

Delayed popup is what you see in Netscape Navigator's Previous and Next buttons: If you click them you go back or forth. If you press them long enough, you get a history-menu. This is exactly what we do here.

You will insert a normal button with connection (or use signals from toolbar):

 bar->insertButton(icon, id, SIGNAL(clicked ()), this,
                   SLOT (slotClick()), true, "click or wait for popup");
And then add a delayed popup:
 bar->setDelayedPopup (id, historyPopup);

Don't add delayed popups to buttons which have normal popups.

You may add popups which are derived from QPopupMenu. You may add popups that are already in the menu bar or are submenus of other popups.

Definition at line 495 of file ktoolbar.cpp.

void KToolBar::setEnableContextMenu ( bool  enable = true  ) 

This allows you to enable or disable the context menu.

Parameters:
enable If false, then the context menu will be disabled

Definition at line 920 of file ktoolbar.cpp.

void KToolBar::setFlat ( bool  flag  ) 

Definition at line 940 of file ktoolbar.cpp.

void KToolBar::setFullSize ( bool  flag = true  ) 

Set toolbar to full parent size (default).

In full size mode the bar extends over the parent's full width or height. If the mode is disabled the toolbar tries to take as much space as it needs without wrapping, but it does not exceed the parent box. You can force a certain width or height with setMaxWidth() or setMaxHeight().

If you want to use right-aligned items or auto-sized items you must use full size mode.

Definition at line 741 of file ktoolbar.cpp.

void KToolBar::setIconSize ( int  size,
bool  update 
)

Same as setIconText(int size) but allows you to disable the toolbar update.

Parameters:
size The size to use
update If true, then the toolbar will be updated after this

Definition at line 878 of file ktoolbar.cpp.

void KToolBar::setIconSize ( int  size  ) 

Set the icon size to load.

Usually you should not call this, the icon size is taken care of by KIconLoader and globally configured. By default, the toolbar will load icons of size 32 for main toolbars and 22 for other toolbars

See also:
KIconLoader.
Parameters:
size The size to use

Definition at line 873 of file ktoolbar.cpp.

virtual void KToolBar::setIconText ( const QString &  txt  )  [inline, virtual, slot]

Definition at line 1082 of file ktoolbar.h.

void KToolBar::setIconText ( IconText  it,
bool  update 
)

Similar to setIconText(IconText it) but allows you to disable or enable updating.

If update is false, then the buttons will not be updated. This is useful only if you know that you will be forcing an update later.

Definition at line 837 of file ktoolbar.cpp.

void KToolBar::setIconText ( IconText  it  ) 

Set the kind of painting for buttons.

Choose from:

  • IconOnly (only icons),
  • IconTextRight (icon and text, text is left from icons),
  • TextOnly (only text),
  • IconTextBottom (icons and text, text is under icons).
    See also:
    IconText

Definition at line 831 of file ktoolbar.cpp.

void KToolBar::setItemAutoSized ( int  id,
bool  yes = true 
)

Set item autosized.

This works only if the toolbar is set to full width. Only one item can be autosized, and it has to be the last left-aligned item. Items that come after this must be right aligned. Items that can be right aligned are Lineds, Frames, Widgets and Combos. An autosized item will resize itself whenever the toolbar geometry changes to the last right-aligned item (or to end of toolbar if there are no right-aligned items.)

See also:
setFullWidth()

alignItemRight()

Definition at line 657 of file ktoolbar.cpp.

void KToolBar::setItemEnabled ( int  id,
bool  enabled 
)

Enables/disables item.

Definition at line 464 of file ktoolbar.cpp.

void KToolBar::setItemNoStyle ( int  id,
bool  no_style = true 
)

This will inform a toolbar button to ignore certain style changes.

Specifically, it will ignore IconText (always IconOnly) and will not allow image effects to apply.

Parameters:
id The button to exclude from styles
no_style If true, then it is excluded (default: true).

Definition at line 932 of file ktoolbar.cpp.

void KToolBar::setLinedText ( int  id,
const QString &  text 
)

Sets the text of a line editor.

Cursor is set at end of text.

Definition at line 542 of file ktoolbar.cpp.

void KToolBar::setMaxHeight ( int  h  ) 

Use setMaximumHeight() instead.

Deprecated:

Definition at line 797 of file ktoolbar.cpp.

void KToolBar::setMaxWidth ( int  dw  ) 

Use setMaximumWidth() instead.

Set maximal width of horizontal (top or bottom) toolbar.

Deprecated:

Definition at line 808 of file ktoolbar.cpp.

void KToolBar::setStretchableWidget ( QWidget *  w  ) 

Reimplemented from QToolBar.

Definition at line 1331 of file ktoolbar.cpp.

void KToolBar::setText ( const QString &  txt  ) 

Assign a (translated) text to this toolbar.

This is used for the tooltip on the handle, and when listing the toolbars.

Definition at line 1133 of file ktoolbar.cpp.

QString KToolBar::settingsGroup (  )  const [protected]

Definition at line 1027 of file ktoolbar.cpp.

void KToolBar::setTitle ( const QString &  _title  ) 

Set title for toolbar when it floats.

Titles are however not (yet) visible. You can't change toolbar's title while it's floating.

Definition at line 820 of file ktoolbar.cpp.

void KToolBar::setToggle ( int  id,
bool  flag = true 
)

Turns button into a toggle button if flag is true.

Definition at line 511 of file ktoolbar.cpp.

void KToolBar::setXMLGUIClient ( KXMLGUIClient *  client  ) 

Definition at line 1128 of file ktoolbar.cpp.

void KToolBar::show ( void   ) 

Definition at line 1423 of file ktoolbar.cpp.

void KToolBar::showEvent ( QShowEvent *  e  )  [protected]

Definition at line 1325 of file ktoolbar.cpp.

void KToolBar::showItem ( int  id  ) 

Show item id.

Definition at line 721 of file ktoolbar.cpp.

QSize KToolBar::sizeHint ( void   )  const

Definition at line 1345 of file ktoolbar.cpp.

QSizePolicy KToolBar::sizePolicy (  )  const

Definition at line 1337 of file ktoolbar.cpp.

QString KToolBar::text (  )  const

Returns the toolbar's text.

Returns:
the toolbar's text.

void KToolBar::toggleButton ( int  id  ) 

Toggles a togglebutton.

If the button is a toggle button (see setToggle()) the button state will be toggled. This will also cause the toolbar to emit the signal KButton::toggled() with parameter id. You must connect to this signal, or use addConnection() to connect directly to the button signal KButton::toggled().

Definition at line 519 of file ktoolbar.cpp.

void KToolBar::toggled ( int   )  [signal]

Emitted when a toggle button changes state.

Emitted also if you change state with setButton() or toggleButton() If you make a button normal again, with setToggle(false), this signal won't be emitted.

void KToolBar::toolbarDestroyed (  )  [signal]

This signal is emitted when the toolbar is getting deleted, and before ~KToolbar finishes (so it's still time to remove widgets from the toolbar).

Used by KWidgetAction.

Since:
3.2

bool KToolBar::transparentSetting (  )  [static]

Returns the global setting for "Toolbars transparent when moving".

Returns:
global setting for "Toolbars transparent when moving"

Definition at line 1490 of file ktoolbar.cpp.

void KToolBar::updateRects ( bool  = false  )  [inline]

Definition at line 953 of file ktoolbar.h.

void KToolBar::virtual_hook ( int  id,
void *  data 
) [protected, virtual]

Definition at line 2255 of file ktoolbar.cpp.


Property Documentation

KToolBar::BarPosition KToolBar::barPos [read, write]

Definition at line 108 of file ktoolbar.h.

bool KToolBar::fullSize [read, write]

Definition at line 109 of file ktoolbar.h.

int KToolBar::iconSize [read, write]

Definition at line 110 of file ktoolbar.h.

KToolBar::IconText KToolBar::iconText [read, write]

Definition at line 107 of file ktoolbar.h.

QString KToolBar::text [read, write]

Definition at line 111 of file ktoolbar.h.


The documentation for this class was generated from the following files:
  • ktoolbar.h
  • ktoolbar.cpp

kdeui

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal