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

KDEUI

  • kdeui
  • actions
kselectaction.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3 (C) 1999 Simon Hausmann <hausmann@kde.org>
4 (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5 (C) 2000 Kurt Granroth <granroth@kde.org>
6 (C) 2000 Michael Koch <koch@kde.org>
7 (C) 2001 Holger Freyther <freyther@kde.org>
8 (C) 2002 Ellis Whitehead <ellis@kde.org>
9 (C) 2003 Andras Mantia <amantia@kde.org>
10 (C) 2005-2006 Hamish Rodda <rodda@kde.org>
11 (C) 2006 Albert Astals Cid <aacid@kde.org>
12 (C) 2006 Clarence Dang <dang@kde.org>
13 (C) 2006 Michel Hermier <michel.hermier@gmail.com>
14 (C) 2007 Nick Shaforostoff <shafff@ukr.net>
15
16 This library is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License version 2 as published by the Free Software Foundation.
19
20 This library is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 Library General Public License for more details.
24
25 You should have received a copy of the GNU Library General Public License
26 along with this library; see the file COPYING.LIB. If not, write to
27 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 Boston, MA 02110-1301, USA.
29*/
30
31#ifndef KSELECTACTION_H
32#define KSELECTACTION_H
33
34#include <QtGui/QToolButton>
35
36#include <kaction.h>
37
38class KSelectActionPrivate;
39
51class KDEUI_EXPORT KSelectAction : public KAction
52{
53 Q_OBJECT
54 Q_PROPERTY( QAction* currentAction READ currentAction WRITE setCurrentAction )
55 Q_PROPERTY( bool editable READ isEditable WRITE setEditable )
56 Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth )
57 Q_PROPERTY( QString currentText READ currentText )
58 Q_ENUMS( ToolBarMode )
59 Q_PROPERTY( ToolBarMode toolBarMode READ toolBarMode WRITE setToolBarMode )
60 Q_PROPERTY( QToolButton::ToolButtonPopupMode toolButtonPopupMode READ toolButtonPopupMode WRITE setToolButtonPopupMode )
61 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
62 Q_PROPERTY( QStringList items READ items WRITE setItems )
63 Q_DECLARE_PRIVATE(KSelectAction)
64
65
66public:
72 explicit KSelectAction(QObject *parent);
73
86 KSelectAction(const QString& text, QObject *parent);
87
99 KSelectAction(const KIcon& icon, const QString& text, QObject *parent);
100
104 virtual ~KSelectAction();
105
106 enum ToolBarMode {
108 MenuMode,
111 ComboBoxMode
112 };
113
118 ToolBarMode toolBarMode() const;
119
123 void setToolBarMode(ToolBarMode mode);
124
131 QToolButton::ToolButtonPopupMode toolButtonPopupMode() const;
132
136 void setToolButtonPopupMode(QToolButton::ToolButtonPopupMode mode);
137
141 QActionGroup* selectableActionGroup() const;
142
147 QAction* currentAction() const;
148
154 int currentItem() const;
155
161 QString currentText() const;
162
166 QList<QAction*> actions() const;
167
171 QAction* action(int index) const;
172
177 QAction* action(const QString& text, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
178
186 bool setCurrentAction(QAction* action);
187
199 bool setCurrentItem(int index);
200
212 bool setCurrentAction(const QString& text, Qt::CaseSensitivity cs = Qt::CaseSensitive);
213
217 virtual void addAction(QAction* action);
218
227 KAction* addAction(const QString& text);
228
237 KAction* addAction(const KIcon& icon, const QString& text);
238
244 virtual QAction* removeAction(QAction* action);
245
250 void setItems( const QStringList &lst );
251
257 QStringList items() const;
258
263 bool isEditable() const;
264
269 void setEditable( bool );
270
275 int comboWidth() const;
276
282 void setComboWidth( int width );
283
288 void setMaxComboViewCount( int n );
289
295 void clear();
296
297 void removeAllActions();
298
309 void setMenuAccelsEnabled( bool b );
310
315 bool menuAccelsEnabled() const;
316
320 void changeItem( int index, const QString& text );
321
322Q_SIGNALS:
327 void triggered( QAction* action );
328
333 void triggered( int index );
334
339 void triggered( const QString& text );
340
341protected Q_SLOTS:
345 virtual void actionTriggered(QAction* action);
346
350 void slotToggled(bool);
351
352protected:
356 virtual QWidget *createWidget(QWidget *parent);
357
361 virtual void deleteWidget(QWidget *widget);
362
363 virtual bool event(QEvent *event);
364
365 virtual bool eventFilter (QObject *watched, QEvent *event);
366
374 KSelectAction(KSelectActionPrivate &dd, QObject *parent);
375
376 KSelectActionPrivate *d_ptr;
377
378private:
379 Q_PRIVATE_SLOT( d_func(), void _k_comboBoxDeleted(QObject*) )
380 Q_PRIVATE_SLOT( d_func(), void _k_comboBoxCurrentIndexChanged(int) )
381};
382
383#endif
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:217
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition: kicon.h:41
KSelectAction
Action for selecting one of several items.
Definition: kselectaction.h:52
KSelectAction::d_ptr
KSelectActionPrivate * d_ptr
Definition: kselectaction.h:376
KSelectAction::triggered
void triggered(int index)
This signal is emitted when an item is selected;.
KSelectAction::triggered
void triggered(QAction *action)
This signal is emitted when an item is selected;.
KSelectAction::triggered
void triggered(const QString &text)
This signal is emitted when an item is selected;.
KSelectAction::ToolBarMode
ToolBarMode
Definition: kselectaction.h:106
KSelectAction::MenuMode
@ MenuMode
Creates a button which pops up a menu when interacted with, as defined by toolButtonPopupMode().
Definition: kselectaction.h:108
QAction
QList
QObject
QWidget
kaction.h
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