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
2b02d015
Commit
2b02d015
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
merge data fcts
parent
823a90ab
No related branches found
Branches containing commit
No related tags found
1 merge request
!2261
merge local class TreeModel into parent class
Pipeline
#124526
failed
1 year ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/View/Instrument/InstrumentsTreeModel.cpp
+31
-41
31 additions, 41 deletions
GUI/View/Instrument/InstrumentsTreeModel.cpp
GUI/View/Instrument/InstrumentsTreeModel.h
+0
-1
0 additions, 1 deletion
GUI/View/Instrument/InstrumentsTreeModel.h
with
31 additions
and
42 deletions
GUI/View/Instrument/InstrumentsTreeModel.cpp
+
31
−
41
View file @
2b02d015
...
...
@@ -232,45 +232,6 @@ InstrumentsTreeModel::InstrumentType InstrumentsTreeModel::instrumentType(Instru
}
QVariant
InstrumentsTreeModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
isHeadline
(
index
))
return
data2
(
index
,
role
);
auto
*
const
item
=
itemForIndex
(
index
);
if
(
role
==
Qt
::
DisplayRole
)
{
auto
descr
=
item
->
description
();
if
(
!
descr
.
isEmpty
())
{
descr
.
prepend
(
"<br><br>"
);
// max 4 lines
while
(
descr
.
count
(
"
\n
"
)
>
3
)
{
descr
.
truncate
(
descr
.
lastIndexOf
(
"
\n
"
));
descr
+=
" [...]"
;
}
descr
.
replace
(
"
\n
"
,
"<br>"
);
}
return
"<b>"
+
item
->
instrumentName
()
+
"</b>"
+
descr
;
}
if
(
role
==
Qt
::
DecorationRole
&&
(
item
==
m_newInstrument
))
{
if
(
role
==
Qt
::
DecorationRole
)
switch
(
instrumentType
(
item
))
{
case
Gisas
:
return
QIcon
(
":/images/gisas_instrument_new.svg"
);
case
Offspec
:
return
QIcon
(
":/images/offspec_instrument_new.svg"
);
case
Specular
:
return
QIcon
(
":/images/specular_instrument_new.svg"
);
case
Depthprobe
:
return
QIcon
(
":/images/depth_instrument_new.svg"
);
default:
break
;
}
}
return
data2
(
index
,
role
);
}
QVariant
InstrumentsTreeModel
::
data2
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
isHeadline
(
index
))
{
QString
title
;
...
...
@@ -311,13 +272,42 @@ QVariant InstrumentsTreeModel::data2(const QModelIndex& index, int role) const
case
Qt
::
ForegroundRole
:
return
qApp
->
palette
().
color
(
QPalette
::
Text
);
default
:
return
{};
}
return
{};
}
auto
*
const
item
=
itemForIndex
(
index
);
if
(
role
==
Qt
::
DisplayRole
)
{
auto
descr
=
item
->
description
();
if
(
!
descr
.
isEmpty
())
{
descr
.
prepend
(
"<br><br>"
);
// max 4 lines
while
(
descr
.
count
(
"
\n
"
)
>
3
)
{
descr
.
truncate
(
descr
.
lastIndexOf
(
"
\n
"
));
descr
+=
" [...]"
;
}
descr
.
replace
(
"
\n
"
,
"<br>"
);
}
return
"<b>"
+
item
->
instrumentName
()
+
"</b>"
+
descr
;
}
if
(
role
==
Qt
::
DecorationRole
&&
(
item
==
m_newInstrument
))
{
if
(
role
==
Qt
::
DecorationRole
)
switch
(
instrumentType
(
item
))
{
case
Gisas
:
return
QIcon
(
":/images/gisas_instrument_new.svg"
);
case
Offspec
:
return
QIcon
(
":/images/offspec_instrument_new.svg"
);
case
Specular
:
return
QIcon
(
":/images/specular_instrument_new.svg"
);
case
Depthprobe
:
return
QIcon
(
":/images/depth_instrument_new.svg"
);
default:
break
;
}
}
if
(
role
==
Qt
::
ToolTipRole
)
return
item
->
description
();
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Instrument/InstrumentsTreeModel.h
+
0
−
1
View file @
2b02d015
...
...
@@ -48,7 +48,6 @@ public:
int
columnCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
QVariant
data2
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
Qt
::
ItemFlags
flags
(
const
QModelIndex
&
index
)
const
override
;
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
)
override
;
InstrumentItem
*
itemForIndex
(
const
QModelIndex
&
index
)
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