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
52eef28f
Commit
52eef28f
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
local var name 'set'
parent
ec319559
No related branches found
Branches containing commit
No related tags found
1 merge request
!2387
unify code for list views
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUI/View/List/InstrumentsQModel.cpp
+16
-16
16 additions, 16 deletions
GUI/View/List/InstrumentsQModel.cpp
with
16 additions
and
16 deletions
GUI/View/List/InstrumentsQModel.cpp
+
16
−
16
View file @
52eef28f
...
...
@@ -31,13 +31,13 @@ int InstrumentsQModel::rowCount(const QModelIndex&) const
QVariant
InstrumentsQModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
const
InstrumentsSet
*
instruments
=
gDoc
->
instruments
();
const
InstrumentsSet
*
set
=
gDoc
->
instruments
();
if
(
!
index
.
isValid
())
return
{};
size_t
row
=
index
.
row
();
if
(
row
>=
instruments
->
size
())
if
(
row
>=
set
->
size
())
return
{};
const
InstrumentItem
*
t
=
instruments
->
at
(
row
);
const
InstrumentItem
*
t
=
set
->
at
(
row
);
if
(
role
==
Qt
::
DisplayRole
)
return
t
->
instrumentName
();
return
{};
...
...
@@ -48,9 +48,9 @@ InstrumentItem* InstrumentsQModel::instrumentItemForIndex(const QModelIndex& ind
if
(
!
index
.
isValid
())
return
nullptr
;
QVector
<
InstrumentItem
*>
instruments
=
gDoc
->
instruments
()
->
instrumentItems
();
if
(
index
.
row
()
>=
0
&&
index
.
row
()
<
instruments
.
size
())
return
instruments
[
index
.
row
()];
QVector
<
InstrumentItem
*>
set
=
gDoc
->
instruments
()
->
instrumentItems
();
if
(
index
.
row
()
>=
0
&&
index
.
row
()
<
set
.
size
())
return
set
[
index
.
row
()];
return
nullptr
;
}
...
...
@@ -100,14 +100,14 @@ QModelIndex InstrumentsQModel::copyInstrument(const QModelIndex& source)
QModelIndex
InstrumentsQModel
::
copyInstrument
(
const
InstrumentItem
*
source
)
{
InstrumentsSet
*
instruments
=
gDoc
->
instrumentsModifier
();
const
QString
copyName
=
instruments
->
suggestInstrumentName
(
source
->
instrumentName
());
const
int
row
=
instruments
->
instrumentItems
().
size
();
InstrumentsSet
*
set
=
gDoc
->
instrumentsModifier
();
const
QString
copyName
=
set
->
suggestInstrumentName
(
source
->
instrumentName
());
const
int
row
=
set
->
instrumentItems
().
size
();
beginInsertRows
({},
row
,
row
);
InstrumentItem
*
copy
=
instruments
->
insertItemCopy
(
*
source
);
InstrumentItem
*
copy
=
set
->
insertItemCopy
(
*
source
);
copy
->
setInstrumentName
(
copyName
);
emit
instruments
->
instrumentAddedOrRemoved
();
emit
set
->
instrumentAddedOrRemoved
();
endInsertRows
();
return
createIndex
(
row
,
0
);
...
...
@@ -115,11 +115,11 @@ QModelIndex InstrumentsQModel::copyInstrument(const InstrumentItem* source)
QModelIndex
InstrumentsQModel
::
pushInstrument
(
InstrumentItem
*
t
)
{
InstrumentsSet
*
instruments
=
gDoc
->
instrumentsModifier
();
const
int
row
=
instruments
->
instrumentItems
().
size
();
InstrumentsSet
*
set
=
gDoc
->
instrumentsModifier
();
const
int
row
=
set
->
instrumentItems
().
size
();
beginInsertRows
({},
row
,
row
);
instruments
->
addInstrumentItem
(
t
);
set
->
addInstrumentItem
(
t
);
endInsertRows
();
return
createIndex
(
row
,
0
);
...
...
@@ -127,7 +127,7 @@ QModelIndex InstrumentsQModel::pushInstrument(InstrumentItem* t)
void
InstrumentsQModel
::
onInstrumentNameChanged
(
const
InstrumentItem
*
instrument
)
{
const
auto
instruments
=
gDoc
->
instruments
()
->
instrumentItems
();
if
(
const
auto
row
=
instruments
.
indexOf
(
instrument
);
row
!=
-
1
)
const
auto
set
=
gDoc
->
instruments
()
->
instrumentItems
();
if
(
const
auto
row
=
set
.
indexOf
(
instrument
);
row
!=
-
1
)
emit
dataChanged
(
index
(
row
,
0
),
index
(
row
,
0
));
}
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