digiKam
Loading...
Searching...
No Matches
dfontproperties.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-12-23
7 * Description : a widget to change font properties.
8 *
9 * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 1996 by Bernd Johannes Wuebben <wuebben at kde dot org>
11 * SPDX-FileCopyrightText: 1999 by Preston Brown <pbrown at kde dot org>
12 * SPDX-FileCopyrightText: 1999 by Mario Weilguni <mweilguni at kde dot org>
13 *
14 * SPDX-License-Identifier: GPL-2.0-or-later
15 *
16 * ============================================================ */
17
18#pragma once
19
20// Qt includes
21
22#include <QWidget>
23#include <QColor>
24#include <QFont>
25#include <QStringList>
26
27// Local includes
28
29#include "digikam_export.h"
30
31
32namespace Digikam
33{
34
35class DIGIKAM_EXPORT DFontProperties : public QWidget
36{
37 Q_OBJECT
38 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontSelected USER true)
39 Q_PROPERTY(QColor color READ color WRITE setColor)
40 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
41 Q_PROPERTY(Qt::CheckState sizeIsRelative READ sizeIsRelative WRITE setSizeIsRelative)
42 Q_PROPERTY(QString sampleText READ sampleText WRITE setSampleText)
43
44public:
45
52 {
53 FamilyList = 0x01,
54 StyleList = 0x02,
55 SizeList = 0x04
56 };
57
64 {
65 NoFontDiffFlags = 0,
66 FontDiffFamily = 1,
67 FontDiffStyle = 2,
68 FontDiffSize = 4,
69 AllFontDiffs = FontDiffFamily | FontDiffStyle | FontDiffSize
70 };
71 Q_DECLARE_FLAGS(FontDiffFlags, FontDiff)
72
73
79 {
80 NoDisplayFlags = 0,
81 FixedFontsOnly = 1,
82 DisplayFrame = 2,
83 ShowDifferences = 4
84 };
85 Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
86
87
99 {
100 FixedWidthFonts = 0x01,
101 ScalableFonts = 0x02,
102 SmoothScalableFonts = 0x04
103 };
104
105public:
106
125 explicit DFontProperties(QWidget* const parent = nullptr,
126 const DisplayFlags& flags = DisplayFrame,
127 const QStringList& fontList = QStringList(),
128 int visibleListSize = 8,
129 Qt::CheckState* const sizeIsRelativeState = nullptr);
130
134 ~DFontProperties() override;
135
147 void enableColumn(int column, bool state);
148
160 void makeColumnVisible(int column, bool state);
161
171 void setFont(const QFont& font, bool onlyFixed = false);
172
177 FontDiffFlags fontDiffFlags() const;
178
182 QFont font() const;
183
187 void setColor(const QColor& col);
188
193 QColor color() const;
194
198 void setBackgroundColor(const QColor& col);
199
204 QColor backgroundColor() const;
205
212 void setSizeIsRelative(Qt::CheckState relative);
213
218 Qt::CheckState sizeIsRelative() const;
219
223 QString sampleText() const;
224
235 void setSampleText(const QString& text);
236
242 void setSampleBoxVisible(bool visible);
243
251 static void getFontList(QStringList& list, uint fontListCriteria);
252
256 QSize sizeHint(void) const override;
257
258Q_SIGNALS:
259
263 void fontSelected(const QFont& font);
264
265private:
266
267 class Private;
268 Private* const d = nullptr;
269
270 Q_DISABLE_COPY(DFontProperties)
271
272 Q_PRIVATE_SLOT(d, void _d_toggled_checkbox())
273 Q_PRIVATE_SLOT(d, void _d_family_chosen_slot(const QString&))
274 Q_PRIVATE_SLOT(d, void _d_size_chosen_slot(const QString&))
275 Q_PRIVATE_SLOT(d, void _d_style_chosen_slot(const QString&))
276 Q_PRIVATE_SLOT(d, void _d_displaySample(const QFont& font))
277 Q_PRIVATE_SLOT(d, void _d_size_value_slot(double))
278};
279
280Q_DECLARE_OPERATORS_FOR_FLAGS(DFontProperties::DisplayFlags)
281
282} // namespace Digikam
Definition dfontproperties.h:36
FontColumn
Definition dfontproperties.h:52
void fontSelected(const QFont &font)
FontListCriteria
Definition dfontproperties.h:99
FontDiff
Definition dfontproperties.h:64
DisplayFlag
Definition dfontproperties.h:79
Definition datefolderview.cpp:34