Changeset View
Changeset View
Standalone View
Standalone View
src/presentation/querytreemodelbase.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | { | |||
---|---|---|---|---|---|
116 | emit m_model->dataChanged(topLeft, bottomRight); | 116 | emit m_model->dataChanged(topLeft, bottomRight); | ||
117 | } | 117 | } | ||
118 | 118 | | |||
119 | QueryTreeModelBase::QueryTreeModelBase(QueryTreeNodeBase *rootNode, QObject *parent) | 119 | QueryTreeModelBase::QueryTreeModelBase(QueryTreeNodeBase *rootNode, QObject *parent) | ||
120 | : QAbstractItemModel(parent), | 120 | : QAbstractItemModel(parent), | ||
121 | m_rootIndexFlag(Qt::ItemIsDropEnabled), | 121 | m_rootIndexFlag(Qt::ItemIsDropEnabled), | ||
122 | m_rootNode(rootNode) | 122 | m_rootNode(rootNode) | ||
123 | { | 123 | { | ||
124 | auto roles = roleNames(); | | |||
125 | roles.insert(ObjectRole, "object"); | | |||
126 | roles.insert(IconNameRole, "icon"); | | |||
127 | roles.insert(IsDefaultRole, "default"); | | |||
128 | setRoleNames(roles); | | |||
129 | } | 124 | } | ||
130 | 125 | | |||
131 | QueryTreeModelBase::~QueryTreeModelBase() | 126 | QueryTreeModelBase::~QueryTreeModelBase() | ||
132 | { | 127 | { | ||
133 | delete m_rootNode; | 128 | delete m_rootNode; | ||
134 | } | 129 | } | ||
135 | 130 | | |||
131 | QHash<int, QByteArray> QueryTreeModelBase::roleNames() const | ||||
132 | { | ||||
133 | auto roles = QAbstractItemModel::roleNames(); | ||||
134 | roles.insert(ObjectRole, "object"); | ||||
135 | roles.insert(IconNameRole, "icon"); | ||||
136 | roles.insert(IsDefaultRole, "default"); | ||||
137 | return roles; | ||||
138 | } | ||||
139 | | ||||
136 | Qt::ItemFlags QueryTreeModelBase::flags(const QModelIndex &index) const | 140 | Qt::ItemFlags QueryTreeModelBase::flags(const QModelIndex &index) const | ||
137 | { | 141 | { | ||
138 | if (!isModelIndexValid(index)) | 142 | if (!isModelIndexValid(index)) | ||
139 | return m_rootIndexFlag; | 143 | return m_rootIndexFlag; | ||
140 | 144 | | |||
141 | return nodeFromIndex(index)->flags(); | 145 | return nodeFromIndex(index)->flags(); | ||
142 | } | 146 | } | ||
143 | 147 | | |||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |