Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
brushpropertymanager.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef BRUSHPROPERTYMANAGER_H
5#define BRUSHPROPERTYMANAGER_H
6
7#include <QtCore/qhash.h>
8#include <QtGui/qbrush.h>
9#include <QtGui/qicon.h>
10
11QT_BEGIN_NAMESPACE
12
13class QtProperty;
15
16class QString;
17class QVariant;
18
19namespace qdesigner_internal {
20
21// BrushPropertyManager: A mixin for DesignerPropertyManager that manages brush properties.
22
24public:
26
29
30 void initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId);
31 bool uninitializeProperty(QtProperty *property);
32
33 // Call from slotValueChanged().
34 int valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value);
35 int setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value);
36
37 bool valueText(const QtProperty *property, QString *text) const;
38 bool valueIcon(const QtProperty *property, QIcon *icon) const;
39 bool value(const QtProperty *property, QVariant *v) const;
40
41 // Call from QtPropertyManager's propertyDestroyed signal
42 void slotPropertyDestroyed(QtProperty *property);
43
44private:
45 static int brushStyleToIndex(Qt::BrushStyle st);
46 static Qt::BrushStyle brushStyleIndexToStyle(int brushStyleIndex);
47 static QString brushStyleIndexToString(int brushStyleIndex);
48
49 static const QMap<int, QIcon> &brushStyleIcons();
50
52 PropertyToPropertyMap m_brushPropertyToStyleSubProperty;
53 PropertyToPropertyMap m_brushPropertyToColorSubProperty;
54 PropertyToPropertyMap m_brushStyleSubPropertyToProperty;
55 PropertyToPropertyMap m_brushColorSubPropertyToProperty;
56
57 QHash<const QtProperty *, QBrush> m_brushValues;
58};
59
60}
61
62QT_END_NAMESPACE
63
64#endif // BRUSHPROPERTYMANAGER_H
static const char * brushStyles[]
The QtProperty class encapsulates an instance of a property.
void addSubProperty(QtProperty *property)
Appends the given property to this property's subproperties.
The QtVariantPropertyManager class provides and manages QVariant based properties.
QtVariantProperty * variantProperty(const QtProperty *property) const
Returns the given property converted into a QtVariantProperty.
The QtVariantProperty class is a convenience class handling QVariant based properties.
int valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
bool valueIcon(const QtProperty *property, QIcon *icon) const
bool valueText(const QtProperty *property, QString *text) const
void initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId)
bool value(const QtProperty *property, QVariant *v) const
int setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
Auxiliary methods to store/retrieve settings.