Pages
API Documentation
On this page

KToolBarLabelAction Class

Class to display a label in a toolbar. More...

  • Header: #include <KToolBarLabelAction>
  • CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
    target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
  • Inherits: QWidgetAction

List of all members, including inherited members

Public Functions

Signals

Detailed Description

KToolBarLabelAction is a convenience class for displaying a label in a toolbar.

It provides easy access to the label's #setBuddy(QAction*) and #buddy() methods and can be used as follows:

KHistoryComboBox *findCombo = new KHistoryComboBox(true, this);

KWidgetAction *action = new KWidgetAction(findCombo, i18n("Find Combo"),
                                           Qt::Key_F6, this, SLOT( slotFocus()),
                                           actionCollection(), "find_combo");

QAction *action = new KToolBarLabelAction(action, i18n("Find "), "find_label");
action->setShortcut(Qt::Key_F6);
connect(action, &QAction::triggered, this, [this]() { slotFocus(); });

Member Function Documentation

KToolBarLabelAction::KToolBarLabelAction(const QString &text, QObject *parent)

Creates a toolbar label.

text The label's and the action's text.

parent This action's parent.

KToolBarLabelAction::KToolBarLabelAction(QAction *buddy, const QString &text, QObject *parent)

Creates a toolbar label setting a buddy for the label.

buddy The action whose widget which is focused when the label's accelerator is typed.

text The label's and the action's text.

parent This action's parent.

QAction *KToolBarLabelAction::buddy() const

Returns the label's buddy or a null pointer if no buddy is currently set.

See QLabel::buddy() and QLabel::setBuddy() for more information.

See also setBuddy()

void KToolBarLabelAction::setBuddy(QAction *buddy)

Sets the label's buddy to buddy.

See QLabel::setBuddy() for details.

See also buddy()

[signal] void KToolBarLabelAction::textChanged(const QString &newText)

This signal is emitted whenever the text of this action is changed.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.