blob: 8bfe7f5c6bc338222e861610f2ad31f5adfbc9d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BRUSHPROPERTYMANAGER_H
#define BRUSHPROPERTYMANAGER_H
#include <QtCore/qhash.h>
#include <QtGui/qbrush.h>
#include <QtGui/qicon.h>
QT_BEGIN_NAMESPACE
class QtProperty;
class QtVariantPropertyManager;
class QString;
class QVariant;
namespace qdesigner_internal {
// BrushPropertyManager: A mixin for DesignerPropertyManager that manages brush properties.
class BrushPropertyManager {
public:
Q_DISABLE_COPY_MOVE(BrushPropertyManager);
BrushPropertyManager();
~BrushPropertyManager();
void initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId);
bool uninitializeProperty(QtProperty *property);
// Call from slotValueChanged().
int valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value);
int setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value);
bool valueText(const QtProperty *property, QString *text) const;
bool valueIcon(const QtProperty *property, QIcon *icon) const;
bool value(const QtProperty *property, QVariant *v) const;
// Call from QtPropertyManager's propertyDestroyed signal
void slotPropertyDestroyed(QtProperty *property);
private:
static int brushStyleToIndex(Qt::BrushStyle st);
static Qt::BrushStyle brushStyleIndexToStyle(int brushStyleIndex);
static QString brushStyleIndexToString(int brushStyleIndex);
static const QMap<int, QIcon> &brushStyleIcons();
using PropertyToPropertyMap = QHash<const QtProperty *, QtProperty *>;
PropertyToPropertyMap m_brushPropertyToStyleSubProperty;
PropertyToPropertyMap m_brushPropertyToColorSubProperty;
PropertyToPropertyMap m_brushStyleSubPropertyToProperty;
PropertyToPropertyMap m_brushColorSubPropertyToProperty;
QHash<const QtProperty *, QBrush> m_brushValues;
};
}
QT_END_NAMESPACE
#endif // BRUSHPROPERTYMANAGER_H
|