KDELibs4Support

klistwidget.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Reginald Stadlbauer <[email protected]>
3 
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.
7 
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.
12 
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.
17 */
18 #ifndef KLISTWIDGET_H
19 #define KLISTWIDGET_H
20 
21 #include <kdelibs4support_export.h>
22 
23 #include <QListWidget>
24 
25 /**
26  * @deprecated since 5.0, use QListWidget instead
27  * @short A variant of QListWidget that honors KDE's system-wide settings.
28  *
29  * Extends the functionality of QListWidget to honor the system
30  * wide settings for Single Click/Double Click mode, Auto Selection and
31  * Change Cursor over Link.
32  *
33  * There is a new signal executed(). It gets connected to either
34  * QListWidget::itemClicked() or QListWidget::itemDoubleClicked()
35  * depending on the KDE wide Single Click/Double Click settings. It is
36  * strongly recommended that you use this signal instead of the above
37  * mentioned. This way you don't need to care about the current
38  * settings. If you want to get informed when the user selects
39  * something connect to the QListWidget::itemSelectionChanged() signal.
40  **/
41 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KListWidget : public QListWidget
42 {
43  Q_OBJECT
44 
45 public:
46  KDELIBS4SUPPORT_DEPRECATED explicit KListWidget(QWidget *parent = nullptr);
47 
48  ~KListWidget() override;
49 
50 Q_SIGNALS:
51 
52  /**
53  * Emitted whenever the user executes an listbox item.
54  *
55  * That means depending on the KDE wide Single Click/Double Click
56  * setting the user clicked or double clicked on that item.
57  * @param item is the pointer to the executed listbox item.
58  *
59  * Note that you may not delete any QListWidgetItem objects in slots
60  * connected to this signal.
61  */
62  void executed(QListWidgetItem *item);
63 
64  /**
65  * Emitted whenever the user executes an listbox item.
66  *
67  * That means depending on the KDE wide Single Click/Double Click
68  * setting the user clicked or double clicked on that item.
69  * @param item is the pointer to the executed listbox item.
70  * @param pos is the position where the user has clicked
71  *
72  * Note that you may not delete any QListWidgetItem objects in slots
73  * connected to this signal.
74  */
75  void executed(QListWidgetItem *item, const QPoint &pos);
76 
77  /**
78  * This signal gets emitted whenever the user double clicks into the
79  * listbox.
80  *
81  * @param item The pointer to the clicked listbox item.
82  * @param pos The position where the user has clicked.
83  *
84  * Note that you may not delete any QListWidgetItem objects in slots
85  * connected to this signal.
86  *
87  * This signal is more or less here for the sake of completeness.
88  * You should normally not need to use this. In most cases it's better
89  * to use executed() instead.
90  */
91  void doubleClicked(QListWidgetItem *item, const QPoint &pos);
92 
93 protected:
94  void keyPressEvent(QKeyEvent *e) override;
95  void focusOutEvent(QFocusEvent *e) override;
96  void leaveEvent(QEvent *e) override;
97  void mousePressEvent(QMouseEvent *e) override;
98  void mouseDoubleClickEvent(QMouseEvent *e) override;
99  void mouseReleaseEvent(QMouseEvent *e) override;
100 
101 private:
102  class KListWidgetPrivate;
103  KListWidgetPrivate *const d;
104 
105  Q_PRIVATE_SLOT(d, void _k_slotItemEntered(QListWidgetItem *))
106  Q_PRIVATE_SLOT(d, void _k_slotOnViewport())
107  Q_PRIVATE_SLOT(d, void _k_slotSettingsChanged(int))
108  Q_PRIVATE_SLOT(d, void _k_slotAutoSelect())
109  Q_PRIVATE_SLOT(d, void _k_slotEmitExecute(QListWidgetItem *))
110 };
111 
112 #endif // KLISTWIDGET_H
void doubleClicked(const QModelIndex &index)
virtual void mouseReleaseEvent(QMouseEvent *e) override
virtual void focusOutEvent(QFocusEvent *event) override
A variant of QListWidget that honors KDE's system-wide settings.
Definition: klistwidget.h:41
virtual void leaveEvent(QEvent *event)
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
Q_SIGNALSQ_SIGNALS
virtual void keyPressEvent(QKeyEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:55:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.