Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Telemetry
KUserFeedback
Commits
3c502b32
Commit
3c502b32
authored
Jan 01, 2017
by
Volker Krause
Browse files
Fix editing of schema entry types
parent
9879c594
Changes
2
Hide whitespace changes
Inline
Side-by-side
analyzer/model/schemamodel.cpp
View file @
3c502b32
...
...
@@ -101,13 +101,17 @@ QVariant SchemaModel::data(const QModelIndex& index, int role) const
return
{};
if
(
index
.
internalId
()
==
TOPLEVEL
)
{
const
auto
entry
=
m_product
.
schema
().
at
(
index
.
row
());
switch
(
index
.
column
())
{
case
0
:
if
(
role
==
Qt
::
DisplayRole
||
role
==
Qt
::
EditRole
)
return
m_product
.
schema
().
at
(
index
.
row
())
.
name
();
return
entry
.
name
();
break
;
case
1
:
if
(
role
==
Qt
::
DisplayRole
)
return
Util
::
enumToString
(
entry
.
dataType
());
else
if
(
role
==
Qt
::
EditRole
)
return
QVariant
::
fromValue
(
entry
.
dataType
());
break
;
}
}
else
{
...
...
@@ -160,6 +164,8 @@ bool SchemaModel::setData(const QModelIndex &index, const QVariant &value, int r
case
0
:
entry
.
setName
(
value
.
toString
());
break
;
case
1
:
entry
.
setDataType
(
value
.
value
<
SchemaEntry
::
DataType
>
());
break
;
}
}
else
{
...
...
analyzer/schemaeditor/schemaentryitemeditorfactory.cpp
View file @
3c502b32
...
...
@@ -77,7 +77,7 @@ private:
SchemaEntryItemEditorFactory
::
SchemaEntryItemEditorFactory
()
:
m_elementModel
(
new
AggregationElementModel
)
{
registerEditor
(
qMetaTypeId
<
SchemaEntry
::
Aggregation
Type
>
(),
new
QStandardItemEditorCreator
<
MetaEnumComboBox
>
());
registerEditor
(
qMetaTypeId
<
SchemaEntry
::
Data
Type
>
(),
new
QStandardItemEditorCreator
<
MetaEnumComboBox
>
());
registerEditor
(
qMetaTypeId
<
SchemaEntryElement
::
Type
>
(),
new
QStandardItemEditorCreator
<
MetaEnumComboBox
>
());
registerEditor
(
qMetaTypeId
<
Aggregation
::
Type
>
(),
new
QStandardItemEditorCreator
<
MetaEnumComboBox
>
());
registerEditor
(
qMetaTypeId
<
AggregationElement
>
(),
new
AggregationElementEditorCreator
(
m_elementModel
.
get
()));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment