digiKam
dcombobox.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2008-08-16
7  * Description : a combo box widget re-implemented with a
8  * reset button to switch to a default item
9  *
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DCOMBO_BOX_H
26 #define DIGIKAM_DCOMBO_BOX_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 #include <QComboBox>
32 #include <QVariant>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT DComboBox : public QWidget
42 {
43 
44  Q_OBJECT
45 
46 public:
47 
48  explicit DComboBox(QWidget* const parent = nullptr);
49  ~DComboBox() override;
50 
51  void setCurrentIndex(int d);
52  int currentIndex() const;
53 
54  void setDefaultIndex(int d);
55  int defaultIndex() const;
56 
57  QComboBox* combo() const;
58 
59  void addItem(const QString& t,
60  const QVariant& data = QVariant());
61  void insertItem(int index, const QString& t,
62  const QVariant& data = QVariant());
63 
64 Q_SIGNALS:
65 
66  void reset();
67  void activated(int);
69 
70 public Q_SLOTS:
71 
72  void slotReset();
73 
74 private Q_SLOTS:
75 
76  void slotItemActivated(int);
77  void slotCurrentIndexChanged(int);
78 
79 private:
80 
81  class Private;
82  Private* const d;
83 };
84 
85 } // namespace Digikam
86 
87 #endif // DIGIKAM_DCOMBO_BOX_H
Definition: dcombobox.h:42
void currentIndexChanged(int)
Definition: datefolderview.cpp:43