KWidgetsAddons

kactionselector.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2002 Anders Lund <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-only
6 */
7 
8 #ifndef _KACTION_SELECTOR_H_
9 #define _KACTION_SELECTOR_H_
10 
11 #include <kwidgetsaddons_export.h>
12 #include <QWidget>
13 
14 class QListWidget;
15 class QListWidgetItem;
16 class QKeyEvent;
17 class QEvent;
18 class QIcon;
19 
20 class KActionSelectorPrivate;
21 
71 class KWIDGETSADDONS_EXPORT KActionSelector : public QWidget
72 {
73  Q_OBJECT
74  Q_PROPERTY(bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick)
75  Q_PROPERTY(bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled)
76  Q_PROPERTY(QString availableLabel READ availableLabel WRITE setAvailableLabel)
77  Q_PROPERTY(QString selectedLabel READ selectedLabel WRITE setSelectedLabel)
78  Q_PROPERTY(InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy)
79  Q_PROPERTY(InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy)
80  Q_PROPERTY(bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons)
81 
82 public:
83  explicit KActionSelector(QWidget *parent = nullptr);
84  ~KActionSelector() override;
85 
89  QListWidget *availableListWidget() const;
90 
94  QListWidget *selectedListWidget() const;
95 
99  enum MoveButton {
100  ButtonAdd,
101  ButtonRemove,
102  ButtonUp,
103  ButtonDown
104  };
106 
107 
117  AtBottom
118  };
120 
121 
129  bool moveOnDoubleClick() const;
130 
135  void setMoveOnDoubleClick(bool enable);
136 
155  bool keyboardEnabled() const;
156 
161  void setKeyboardEnabled(bool enable);
162 
166  QString availableLabel() const;
167 
174  void setAvailableLabel(const QString &text);
175 
179  QString selectedLabel() const;
180 
187  void setSelectedLabel(const QString &text);
188 
194  InsertionPolicy availableInsertionPolicy() const;
195 
200  void setAvailableInsertionPolicy(InsertionPolicy policy);
201 
207  InsertionPolicy selectedInsertionPolicy() const;
208 
213  void setSelectedInsertionPolicy(InsertionPolicy policy);
214 
218  bool showUpDownButtons() const;
219 
224  void setShowUpDownButtons(bool show);
225 
230  void setButtonIcon(const QString &icon, MoveButton button);
231 
238  void setButtonIconSet(const QIcon &iconset, MoveButton button);
239 
243  void setButtonTooltip(const QString &tip, MoveButton button);
244 
248  void setButtonWhatsThis(const QString &text, MoveButton button);
249 
250 Q_SIGNALS:
254  void added(QListWidgetItem *item);
255 
259  void removed(QListWidgetItem *item);
260 
264  void movedUp(QListWidgetItem *item);
265 
269  void movedDown(QListWidgetItem *item);
270 
274 // void addedToSelection( QListWidgetItem *item );
275 
276 public Q_SLOTS:
284  void setButtonsEnabled();
285 
286 protected:
290  void keyPressEvent(QKeyEvent *) override;
291 
295  bool eventFilter(QObject *, QEvent *) override;
296 
297 private:
301  Q_PRIVATE_SLOT(d, void itemDoubleClicked(QListWidgetItem *item))
302 
306  Q_PRIVATE_SLOT(d, void slotCurrentChanged(QListWidgetItem *))
307 
308 private:
309 
313  friend class KActionSelectorPrivate;
314  KActionSelectorPrivate *const d;
315 
316  Q_DISABLE_COPY(KActionSelector)
317 };
318 
319 #endif // _KACTION_SELECTOR_H_
Q_ENUM(...)
The item is inserted below the listbox&#39; currentItem() or at the end if there is no current item...
InsertionPolicy
This enum defines policies for where to insert moved items in a listbox.
Q_PROPERTY(...)
The listbox is sort()ed after one or more items are inserted.
The item is inserted at index 0 in the listbox.
A widget for selecting and arranging actions/objects.
MoveButton
This enum identifies the moving buttons.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 5 2020 22:42:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.