digiKam
picklabelwidget.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 : 2011-02-14
7  * Description : pick label widget
8  *
9  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_PICK_LABEL_WIDGET_H
25 #define DIGIKAM_PICK_LABEL_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QColor>
30 #include <QPushButton>
31 #include <QEvent>
32 #include <QList>
33 #include <QMetaType>
34 #include <QMenu>
35 
36 // Local includes
37 
38 #include "dlayoutbox.h"
39 #include "digikam_globals.h"
40 #include "digikam_export.h"
41 
42 namespace Digikam
43 {
44 
45 class DIGIKAM_EXPORT PickLabelWidget : public DVBox
46 {
47  Q_OBJECT
48 
49 public:
50 
51  explicit PickLabelWidget(QWidget* const parent = nullptr);
52  ~PickLabelWidget() override;
53 
57  void setDescriptionBoxVisible(bool b);
58 
63  void setButtonsExclusive(bool b);
64 
68  void setPickLabels(const QList<PickLabel>& list);
69 
73  QList<PickLabel> colorLabels() const;
74 
75  static QString labelPickName(PickLabel label);
76 
77  static QIcon buildIcon(PickLabel label);
78 
79 Q_SIGNALS:
80 
82 
83 protected:
84 
85  bool eventFilter(QObject* obj, QEvent* ev) override;
86 
87 private:
88 
89  void updateDescription(PickLabel label);
90 
91 private:
92 
93  class Private;
94  Private* const d;
95 };
96 
97 // ------------------------------------------------------------------------------
98 
99 class DIGIKAM_EXPORT PickLabelSelector : public QPushButton
100 {
101  Q_OBJECT
102 
103 public:
104 
105  explicit PickLabelSelector(QWidget* const parent = nullptr);
106  ~PickLabelSelector() override;
107 
108  void setPickLabel(PickLabel label);
109  PickLabel colorLabel();
110 
111  PickLabelWidget* pickLabelWidget() const;
112 
113 Q_SIGNALS:
114 
116 
117 private Q_SLOTS:
118 
119  void slotPickLabelChanged(int);
120 
121 private:
122 
123  class Private;
124  Private* const d;
125 };
126 
127 // ------------------------------------------------------------------------------
128 
129 class DIGIKAM_EXPORT PickLabelMenuAction : public QMenu
130 {
131  Q_OBJECT
132 
133 public:
134 
135  explicit PickLabelMenuAction(QMenu* const parent = nullptr);
136  ~PickLabelMenuAction() override;
137 
138 Q_SIGNALS:
139 
141 };
142 
143 } // namespace Digikam
144 
145 Q_DECLARE_METATYPE(QList<Digikam::PickLabel>)
146 
147 #endif // DIGIKAM_PICK_LABEL_WIDGET_H
Definition: dlayoutbox.h:75
Definition: picklabelwidget.h:130
Definition: picklabelwidget.h:100
Definition: picklabelwidget.h:46
void signalPickLabelChanged(int)
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43
PickLabel
Definition: digikam_globals.h:122