1
/* This file is part of the KDE libraries
2
Copyright (C) 2004 Felix Berger <felixberger@beldesign.de>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
19
#ifndef KTOOLBARLABELACTION_H
20
#define KTOOLBARLABELACTION_H
25
* @short Class to display a label in a toolbar.
27
* KToolBarLabelAction is a convenience class for displaying a label in a
30
* It provides easy access to the label's #setBuddy(QAction*) and #buddy()
31
* methods and can be used as follows:
35
* KHistoryCombo* findCombo = new KHistoryCombo( true, this );
37
* KWidgetAction* action = new KWidgetAction( findCombo, i18n("Find Combo"),
38
* Qt::Key_F6, this, SLOT( slotFocus() ),
39
* actionCollection(), "find_combo");
41
* KAction *action = new KToolBarLabelAction( action, i18n( "Find "), "find_label" );
42
* action->setShortcut( Qt::Key_F6 );
43
* connect( action, SIGNAL( triggered() ), this, SLOT( slotFocus() ) );
47
* @author Felix Berger <felixberger@beldesign.de>
49
class KDEUI_EXPORT KToolBarLabelAction : public KAction
55
* Creates a toolbar label.
57
* @param text The label's and the action's text.
58
* @param parent This action's parent.
60
KToolBarLabelAction(const QString &text, QObject *parent);
63
* Creates a toolbar label setting a buddy for the label.
65
* @param buddy The action whose widget which is focused when the label's accelerator is
67
* @param text The label's and the action's text.
68
* @param parent This action's parent.
70
KToolBarLabelAction(QAction *buddy, const QString &text, QObject *parent);
73
* Destroys the toolbar label.
75
virtual ~KToolBarLabelAction();
78
* Sets the label's buddy to buddy.
80
* See QLabel#setBuddy() for details.
82
void setBuddy( QAction *buddy );
85
* Returns the label's buddy or 0 if no buddy is currently set.
87
* See QLabel#buddy() and QLabel#setBuddy() for more information.
89
QAction* buddy() const;
92
* Reimplemented from @see QActionWidgetFactory.
94
virtual QWidget* createWidget( QWidget* parent );
98
* This signal is emmitted whenever the text of this action
101
void textChanged( const QString &newText );
104
virtual bool event( QEvent* );