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
02ab87de
Commit
02ab87de
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
SetWithModel parent OwningVector now private
parent
ee6a70fa
No related branches found
No related tags found
1 merge request
!2397
InstrumentsSet and SamplesSet based on SetWithModel, which owns a QListModel
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Type/SetWithModel.h
+19
-1
19 additions, 1 deletion
GUI/Model/Type/SetWithModel.h
Tests/Unit/GUI/TestAutosaveController.cpp
+2
-2
2 additions, 2 deletions
Tests/Unit/GUI/TestAutosaveController.cpp
Tests/Unit/GUI/TestProjectDocument.cpp
+2
-2
2 additions, 2 deletions
Tests/Unit/GUI/TestProjectDocument.cpp
with
23 additions
and
5 deletions
GUI/Model/Type/SetWithModel.h
+
19
−
1
View file @
02ab87de
...
...
@@ -23,7 +23,7 @@
//! An OwningVector with a current index.
template
<
class
T
>
class
SetWithModel
:
p
ublic
OwningVector
<
T
>
{
template
<
class
T
>
class
SetWithModel
:
p
rivate
OwningVector
<
T
>
{
using
super
=
OwningVector
<
T
>
;
public:
...
...
@@ -100,6 +100,24 @@ public:
return
m_current_index
<
super
::
size
()
?
super
::
at
(
m_current_index
)
:
(
T
*
)
nullptr
;
}
const
T
*
at
(
size_t
i
)
const
{
return
super
::
at
(
i
);
}
T
*
at
(
size_t
i
)
{
return
super
::
at
(
i
);
}
const
T
*
back
()
const
{
return
super
::
back
();
}
T
*
back
()
{
return
super
::
back
();
}
size_t
size
()
const
{
return
super
::
size
();
}
bool
empty
()
const
{
return
super
::
empty
();
}
int
index_of
(
const
T
*
t
)
const
{
return
super
::
index_of
(
t
);
}
const
T
*
at_or
(
size_t
i
,
T
*
defolt
)
const
{
return
super
::
at_or
(
i
,
defolt
);
}
using
Iterator
=
typename
std
::
vector
<
T
*>::
iterator
;
// "typename" can be dropped under C++20
using
ConstIterator
=
typename
std
::
vector
<
T
*>::
const_iterator
;
ConstIterator
begin
()
const
{
return
super
::
begin
();
}
ConstIterator
end
()
const
{
return
super
::
end
();
}
Iterator
begin
()
{
return
super
::
begin
();
}
Iterator
end
()
{
return
super
::
end
();
}
private
:
void
update_current
()
{
...
...
This diff is collapsed.
Click to expand it.
Tests/Unit/GUI/TestAutosaveController.cpp
+
2
−
2
View file @
02ab87de
...
...
@@ -19,7 +19,7 @@ protected:
// helper method to modify something in a model
void
modelsModifier
(
ProjectDocument
&
doc
)
{
auto
*
instrument
=
doc
.
instrumentsModifier
()
->
fron
t
();
auto
*
instrument
=
doc
.
instrumentsModifier
()
->
a
t
(
0
);
instrument
->
setName
(
QUuid
::
createUuid
().
toString
());
emit
gDoc
->
instruments
()
->
currentModified
();
}
...
...
@@ -126,7 +126,7 @@ TEST_F(TestAutosaveController, autosaveEnabled)
DatafileItem
*
realData
=
UTest
::
GUI
::
createRealData2D
(
"TestData"
,
*
gDoc
->
datafilesModifier
(),
0.
);
DataItem
*
data_item
=
realData
->
dataItem
();
auto
frame
=
gDoc
->
instruments
()
->
fron
t
()
->
createFrame
();
auto
frame
=
gDoc
->
instruments
()
->
a
t
(
0
)
->
createFrame
();
Datafield
df
(
frame
.
release
());
data_item
->
setDatafield
(
df
);
gDoc
->
clearModified
();
...
...
This diff is collapsed.
Click to expand it.
Tests/Unit/GUI/TestProjectDocument.cpp
+
2
−
2
View file @
02ab87de
...
...
@@ -20,7 +20,7 @@ protected:
//! helper method to modify something in a model
void
modelsModifier
(
ProjectDocument
&
doc
)
{
auto
*
instrument
=
doc
.
instrumentsModifier
()
->
fron
t
();
auto
*
instrument
=
doc
.
instrumentsModifier
()
->
a
t
(
0
);
instrument
->
setName
(
QUuid
::
createUuid
().
toString
());
emit
gDoc
->
instruments
()
->
currentModified
();
}
...
...
@@ -85,7 +85,7 @@ TEST_F(TestProjectDocument, projectDocumentWithData)
UTest
::
GUI
::
createRealData2D
(
"TestData"
,
*
gDoc
->
datafilesModifier
(),
0.
);
ASSERT
(
realData
);
DataItem
*
data_item
=
realData
->
dataItem
();
auto
frame
=
gDoc
->
instruments
()
->
fron
t
()
->
createFrame
();
auto
frame
=
gDoc
->
instruments
()
->
a
t
(
0
)
->
createFrame
();
Datafield
df
(
frame
.
release
());
data_item
->
setDatafield
(
df
);
...
...
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