Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
1ec006bf
Commit
1ec006bf
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
extend instrument tree model
parent
8c434f40
No related branches found
No related tags found
1 merge request
!320
Implement instrument library editor
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Models/InstrumentsTreeModel.cpp
+25
-10
25 additions, 10 deletions
GUI/Models/InstrumentsTreeModel.cpp
GUI/Models/InstrumentsTreeModel.h
+2
-0
2 additions, 0 deletions
GUI/Models/InstrumentsTreeModel.h
with
27 additions
and
10 deletions
GUI/Models/InstrumentsTreeModel.cpp
+
25
−
10
View file @
1ec006bf
...
@@ -244,20 +244,17 @@ QVariant InstrumentsTreeModel::data(const QModelIndex& index, int role) const
...
@@ -244,20 +244,17 @@ QVariant InstrumentsTreeModel::data(const QModelIndex& index, int role) const
if
(
role
==
Qt
::
TextAlignmentRole
)
if
(
role
==
Qt
::
TextAlignmentRole
)
return
QVariant
(
Qt
::
AlignLeft
|
Qt
::
AlignTop
);
return
QVariant
(
Qt
::
AlignLeft
|
Qt
::
AlignTop
);
if
(
role
==
Qt
::
DecorationRole
)
{
if
(
role
==
Qt
::
DecorationRole
)
if
(
item
->
is
<
GISASInstrumentItem
>
())
switch
(
instrumentType
(
item
))
{
case
Gisas
:
return
QIcon
(
":/images/gisas_instrument.svg"
);
return
QIcon
(
":/images/gisas_instrument.svg"
);
case
OffSpecular
:
if
(
item
->
is
<
OffSpecularInstrumentItem
>
())
return
QIcon
(
":/images/offspec_instrument.svg"
);
return
QIcon
(
":/images/offspec_instrument.svg"
);
case
Specular
:
if
(
item
->
is
<
SpecularInstrumentItem
>
())
return
QIcon
(
":/images/specular_instrument.svg"
);
return
QIcon
(
":/images/specular_instrument.svg"
);
case
DepthProbe
:
if
(
item
->
is
<
DepthProbeInstrumentItem
>
())
return
QIcon
(
":/images/depth_instrument.svg"
);
return
QIcon
(
":/images/depth_instrument.svg"
);
}
}
return
QVariant
();
return
QVariant
();
}
}
...
@@ -317,3 +314,21 @@ bool InstrumentsTreeModel::isHeadline(const QModelIndex& index) const
...
@@ -317,3 +314,21 @@ bool InstrumentsTreeModel::isHeadline(const QModelIndex& index) const
return
index
.
internalPointer
()
==
nullptr
;
return
index
.
internalPointer
()
==
nullptr
;
}
}
InstrumentsTreeModel
::
InstrumentType
InstrumentsTreeModel
::
instrumentType
(
InstrumentItem
*
item
)
{
if
(
item
->
is
<
GISASInstrumentItem
>
())
return
Gisas
;
if
(
item
->
is
<
OffSpecularInstrumentItem
>
())
return
OffSpecular
;
if
(
item
->
is
<
SpecularInstrumentItem
>
())
return
Specular
;
if
(
item
->
is
<
DepthProbeInstrumentItem
>
())
return
DepthProbe
;
ASSERT
(
FALSE
);
return
None
;
}
This diff is collapsed.
Click to expand it.
GUI/Models/InstrumentsTreeModel.h
+
2
−
0
View file @
1ec006bf
...
@@ -59,6 +59,8 @@ public:
...
@@ -59,6 +59,8 @@ public:
QModelIndex
indexOfHeadline
(
InstrumentType
type
)
const
;
QModelIndex
indexOfHeadline
(
InstrumentType
type
)
const
;
bool
isHeadline
(
const
QModelIndex
&
index
)
const
;
bool
isHeadline
(
const
QModelIndex
&
index
)
const
;
static
InstrumentType
instrumentType
(
InstrumentItem
*
item
);
private
:
private
:
void
clear
();
void
clear
();
QList
<
InstrumentType
>
visibleTypes
()
const
;
QList
<
InstrumentType
>
visibleTypes
()
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment