7#include <QtQml/qqmlinfo.h>
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
65
66
67
68
69
70
71
72
73
74
75
96QQmlTableModelColumn::QQmlTableModelColumn(QObject *parent)
101QQmlTableModelColumn::~QQmlTableModelColumn()
105#define DEFINE_ROLE_PROPERTIES(getterGetterName, getterSetterName, getterSignal, roleName) QJSValue
106 QQmlTableModelColumn::getterGetterName() const \
107{
108 return mGetters.value(roleName); \
109}void
111 QQmlTableModelColumn::getterSetterName(const QJSValue &stringOrFunction) \
112{
113 if (!stringOrFunction.isString() && !stringOrFunction.isCallable()) {
114 qmlWarning(this).quote() << "getter for " << roleName << " must be a function";
117 if (stringOrFunction.strictlyEquals(decoration()))
120 mGetters[roleName] = stringOrFunction;
121 emit decorationChanged(); \
122}
140 textAlignmentRoleName)
149 accessibleTextRoleName)
151 accessibleDescriptionRoleName)
156QJSValue QQmlTableModelColumn::getterAtRole(
const QString &roleName)
158 auto it = mGetters.find(roleName);
159 if (it == mGetters.end())
164const QHash<QString, QJSValue> QQmlTableModelColumn::getters()
const
169const QHash<
int, QString> QQmlTableModelColumn::supportedRoleNames()
171 static const QHash<
int, QString> names {
172 {Qt::DisplayRole, displayRoleName},
173 {Qt::DecorationRole, decorationRoleName},
174 {Qt::EditRole, editRoleName},
175 {Qt::ToolTipRole, toolTipRoleName},
176 {Qt::StatusTipRole, statusTipRoleName},
177 {Qt::WhatsThisRole, whatsThisRoleName},
178 {Qt::FontRole, fontRoleName},
179 {Qt::TextAlignmentRole, textAlignmentRoleName},
180 {Qt::BackgroundRole, backgroundRoleName},
181 {Qt::ForegroundRole, foregroundRoleName},
182 {Qt::CheckStateRole, checkStateRoleName},
183 {Qt::AccessibleTextRole, accessibleTextRoleName},
184 {Qt::AccessibleDescriptionRole, accessibleDescriptionRoleName},
185 {Qt::SizeHintRole, sizeHintRoleName}
192#include "moc_qqmltablemodelcolumn_p.cpp"
static constexpr QLatin1StringView accessibleDescriptionRoleName("accessibleDescription")
static constexpr QLatin1StringView decorationRoleName("decoration")
static constexpr QLatin1StringView backgroundRoleName("background")
#define DEFINE_ROLE_PROPERTIES(getterGetterName, getterSetterName, getterSignal, roleName)
static constexpr QLatin1StringView whatsThisRoleName("whatsThis")
static constexpr QLatin1StringView editRoleName("edit")
static constexpr QLatin1StringView statusTipRoleName("statusTip")
static QT_BEGIN_NAMESPACE constexpr QLatin1StringView displayRoleName("display")
Represents a column in a model.
static constexpr QLatin1StringView checkStateRoleName("checkState")
static constexpr QLatin1StringView fontRoleName("font")
static constexpr QLatin1StringView foregroundRoleName("foreground")
static constexpr QLatin1StringView sizeHintRoleName("sizeHint")
static constexpr QLatin1StringView accessibleTextRoleName("accessibleText")
static constexpr QLatin1StringView toolTipRoleName("toolTip")
static constexpr QLatin1StringView textAlignmentRoleName("textAlignment")