Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_font_family_combo_box.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7#ifndef KIS_FONT_FAMILY_COMBO_BOX_H
8#define KIS_FONT_FAMILY_COMBO_BOX_H
9
10#include <QObject>
11#include <KisSqueezedComboBox.h>
12#include <QFont>
13#include <QFontDatabase>
14#include <QStyledItemDelegate>
15
16#include "kritawidgetutils_export.h"
17
25class KRITAWIDGETUTILS_EXPORT KisFontComboBoxes : public QWidget
26{
27 Q_OBJECT
28public:
29 KisFontComboBoxes(QWidget *parent = 0);
30
36 void setCurrentFont(QFont font);
37
38 void setCurrentFamily(const QString family);
39 void setCurrentStyle(QString style);
40
41 // Current family name.
42 QString currentFamily() const;
43 // Current style
44 QString currentStyle() const;
45
51 QFont currentFont(int pointSize = 10) const;
52
54 void setInitialized();
55
56Q_SIGNALS:
57 void fontChanged(QString);
58private Q_SLOTS:
59 void fontFamilyChanged();
60 void fontChange();
61private:
62 QComboBox *m_family;
63 QComboBox *m_styles;
64};
65
66class KRITAWIDGETUTILS_EXPORT PinnedFontsSeparator : public QStyledItemDelegate {
67public:
68 PinnedFontsSeparator(QAbstractItemDelegate *_default, QWidget *parent = nullptr);
69 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
70 void setSeparatorIndex(int index);
71 void setSeparatorAdded();
72 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
73
74private:
77 QAbstractItemDelegate *m_defaultDelegate;
78};
79
87class KRITAWIDGETUTILS_EXPORT KisFontFamilyComboBox : public QComboBox
88{
89 Q_OBJECT
90public:
91 KisFontFamilyComboBox(QWidget *parent = 0);
92
93 // List of writing systems to use. If empty will default to "all"
95 void setTopFont(const QString &family);
96 void setInitialized();
97
98private Q_SLOTS:
99 void slotTextChanged(const QString &input);
100
101private:
104 bool m_initialized {false};
108};
109
110#endif // KIS_FONT_FAMILY_COMBO_BOX_H
The KisFontComboBoxes class This is a little widget with two comboboxes. One is for the font family,...
void fontChanged(QString)
The KisFontFamilyComboBox class A QCombobox that limits the amount of fonts it contains....
PinnedFontsSeparator * m_fontSeparator
QAbstractItemDelegate * m_defaultDelegate