digiKam
searchutilities.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-03-14
7  * Description : User interface for searches
8  *
9  * Copyright (C) 2008-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_SEARCH_UTILITIES_H
25 #define DIGIKAM_SEARCH_UTILITIES_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QWidget>
31 #include <QLabel>
32 #include <QLineEdit>
33 #include <QString>
34 #include <QComboBox>
35 #include <QDoubleSpinBox>
36 #include <QSpinBox>
37 
38 // Local includes
39 
40 #include "comboboxutilities.h"
41 
42 class QTextEdit;
43 class QPushButton;
44 
45 namespace Digikam
46 {
47 
48 class AnimatedClearButton : public QWidget
49 {
50  Q_OBJECT
51 
52 public:
53 
54  explicit AnimatedClearButton(QWidget* const parent = nullptr);
55 
56  QSize sizeHint() const override;
57 
58  void setPixmap(const QPixmap& p);
59  QPixmap pixmap() const;
60 
65  void setShallBeShown(bool show);
66 
75  void stayVisibleWhenAnimatedOut(bool stayVisible);
76 
77 public Q_SLOTS:
78 
80  void animateVisible(bool visible);
81 
83  void setDirectlyVisible(bool visible);
84 
85 Q_SIGNALS:
86 
87  void clicked();
88 
89 protected:
90 
91  void paintEvent(QPaintEvent* event) override;
92  void mouseReleaseEvent(QMouseEvent* event) override;
93 
94 protected Q_SLOTS:
95 
96  void visibleChanged();
98 
99 private:
100 
101  class Private;
102  Private* const d;
103 };
104 
105 // -------------------------------------------------------------------------
106 
107 class CustomStepsDoubleSpinBox : public QDoubleSpinBox
108 {
109  Q_OBJECT
110 
111 public:
112 
118  explicit CustomStepsDoubleSpinBox(QWidget* const parent = nullptr);
119  ~CustomStepsDoubleSpinBox() override;
120 
128  void setSuggestedValues(const QList<double>& values);
129 
134  void setSuggestedInitialValue(double initialValue);
135 
140  void setSingleSteps(double smaller, double larger);
141 
142  void setInvertStepping(bool invert);
143 
147  void reset();
148 
149  void stepBy(int steps) override;
150 
151 private Q_SLOTS:
152 
153  void slotValueChanged(double val);
154 
155 private:
156 
157  class Private;
158  Private* const d;
159 };
160 
161 // -------------------------------------------------------------------------
162 
163 class CustomStepsIntSpinBox : public QSpinBox
164 {
165  Q_OBJECT
166 
167 public:
168 
174  explicit CustomStepsIntSpinBox(QWidget* const parent = nullptr);
175  ~CustomStepsIntSpinBox() override;
176 
184  void setSuggestedValues(const QList<int>& values);
185 
190  void setSuggestedInitialValue(int initialValue);
191 
196  void setSingleSteps(int smaller, int larger);
197 
198  void setInvertStepping(bool invert);
199 
204  void enableFractionMagic(const QString& prefix);
205 
209  void reset();
210 
214  double fractionMagicValue() const;
215  void setFractionMagicValue(double value);
216 
217  void stepBy(int steps) override;
218 
219 protected:
220 
221  QString textFromValue(int value) const override;
222  int valueFromText(const QString& text) const override;
223  StepEnabled stepEnabled() const override;
224 
225 private Q_SLOTS:
226 
227  void slotValueChanged(int val);
228 
229 private:
230 
231  class Private;
232  Private* const d;
233 };
234 
235 // -------------------------------------------------------------------------
236 
237 class StyleSheetDebugger : public QWidget
238 {
239  Q_OBJECT
240 
241 public:
242 
252  explicit StyleSheetDebugger(QWidget* const object);
253 
254 protected Q_SLOTS:
255 
256  void buttonClicked();
257 
258 protected:
259 
260  QTextEdit* m_edit;
261  QPushButton* m_okButton;
262  QWidget* m_widget;
263 };
264 
265 } // namespace Digikam
266 
267 #endif // DIGIKAM_SEARCH_UTILITIES_H
Definition: searchutilities.h:49
void stayVisibleWhenAnimatedOut(bool stayVisible)
Definition: searchutilities.cpp:101
QSize sizeHint() const override
Definition: searchutilities.cpp:94
void updateAnimationSettings()
Definition: searchutilities.cpp:141
QPixmap pixmap() const
Definition: searchutilities.cpp:136
void paintEvent(QPaintEvent *event) override
Definition: searchutilities.cpp:145
void mouseReleaseEvent(QMouseEvent *event) override
Definition: searchutilities.cpp:168
AnimatedClearButton(QWidget *const parent=nullptr)
Definition: searchutilities.cpp:81
void visibleChanged()
Definition: searchutilities.cpp:156
void animateVisible(bool visible)
Set visible, possibly with animation.
Definition: searchutilities.cpp:113
void setPixmap(const QPixmap &p)
Definition: searchutilities.cpp:131
void setShallBeShown(bool show)
Definition: searchutilities.cpp:107
void setDirectlyVisible(bool visible)
Set visible without animation.
Definition: searchutilities.cpp:126
Definition: searchutilities.h:108
void setSuggestedInitialValue(double initialValue)
Definition: searchutilities.cpp:309
~CustomStepsDoubleSpinBox() override
Definition: searchutilities.cpp:205
void reset()
Definition: searchutilities.cpp:325
void setSingleSteps(double smaller, double larger)
Definition: searchutilities.cpp:314
void setInvertStepping(bool invert)
Definition: searchutilities.cpp:320
void stepBy(int steps) override
Definition: searchutilities.cpp:210
void setSuggestedValues(const QList< double > &values)
Definition: searchutilities.cpp:300
CustomStepsDoubleSpinBox(QWidget *const parent=nullptr)
Definition: searchutilities.cpp:199
Definition: searchutilities.h:164
void setSingleSteps(int smaller, int larger)
Definition: searchutilities.cpp:491
void stepBy(int steps) override
Definition: searchutilities.cpp:387
void reset()
Definition: searchutilities.cpp:508
QString textFromValue(int value) const override
Definition: searchutilities.cpp:514
void setInvertStepping(bool invert)
Definition: searchutilities.cpp:497
StepEnabled stepEnabled() const override
Definition: searchutilities.cpp:552
void setFractionMagicValue(double value)
Definition: searchutilities.cpp:593
void setSuggestedInitialValue(int initialValue)
Definition: searchutilities.cpp:486
double fractionMagicValue() const
Definition: searchutilities.cpp:574
CustomStepsIntSpinBox(QWidget *const parent=nullptr)
Definition: searchutilities.cpp:376
void setSuggestedValues(const QList< int > &values)
Definition: searchutilities.cpp:477
void enableFractionMagic(const QString &prefix)
Definition: searchutilities.cpp:502
~CustomStepsIntSpinBox() override
Definition: searchutilities.cpp:382
int valueFromText(const QString &text) const override
Definition: searchutilities.cpp:533
Definition: searchutilities.h:238
QTextEdit * m_edit
Definition: searchutilities.h:260
QPushButton * m_okButton
Definition: searchutilities.h:261
StyleSheetDebugger(QWidget *const object)
Definition: searchutilities.cpp:633
QWidget * m_widget
Definition: searchutilities.h:262
void buttonClicked()
Definition: searchutilities.cpp:658
QStringView prefix
Definition: itemviewutilities.cpp:593
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43