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
a4d01cfd
Commit
a4d01cfd
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
rm SamplesSet::addSampleItem()
parent
2626fe38
No related branches found
No related tags found
1 merge request
!2384
all "set" classes now inherit VectorWC
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Sample/SamplesSet.cpp
+3
-7
3 additions, 7 deletions
GUI/Model/Sample/SamplesSet.cpp
GUI/Model/Sample/SamplesSet.h
+0
-2
0 additions, 2 deletions
GUI/Model/Sample/SamplesSet.h
GUI/View/List/SamplesQModel.cpp
+23
-16
23 additions, 16 deletions
GUI/View/List/SamplesQModel.cpp
with
26 additions
and
25 deletions
GUI/Model/Sample/SamplesSet.cpp
+
3
−
7
View file @
a4d01cfd
...
@@ -35,12 +35,6 @@ QVector<SampleItem*> SamplesSet::sampleItems() const
...
@@ -35,12 +35,6 @@ QVector<SampleItem*> SamplesSet::sampleItems() const
return
QVector
<
SampleItem
*>
(
m_samples
.
begin
(),
m_samples
.
end
());
return
QVector
<
SampleItem
*>
(
m_samples
.
begin
(),
m_samples
.
end
());
}
}
SampleItem
*
SamplesSet
::
addSampleItem
()
{
addSampleItem
(
new
SampleItem
());
return
m_samples
.
back
();
}
void
SamplesSet
::
addSampleItem
(
SampleItem
*
sample
)
void
SamplesSet
::
addSampleItem
(
SampleItem
*
sample
)
{
{
m_samples
.
push_back
(
sample
);
m_samples
.
push_back
(
sample
);
...
@@ -88,7 +82,9 @@ void SamplesSet::readFrom(QXmlStreamReader* r)
...
@@ -88,7 +82,9 @@ void SamplesSet::readFrom(QXmlStreamReader* r)
// sample
// sample
if
(
tag
==
Tag
::
Sample
)
{
if
(
tag
==
Tag
::
Sample
)
{
addSampleItem
()
->
readFrom
(
r
);
auto
*
t
=
new
SampleItem
;
t
->
readFrom
(
r
);
addSampleItem
(
t
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// selected index
// selected index
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/SamplesSet.h
+
0
−
2
View file @
a4d01cfd
...
@@ -27,9 +27,7 @@ public:
...
@@ -27,9 +27,7 @@ public:
~
SamplesSet
();
~
SamplesSet
();
QVector
<
SampleItem
*>
sampleItems
()
const
;
QVector
<
SampleItem
*>
sampleItems
()
const
;
SampleItem
*
addSampleItem
();
void
addSampleItem
(
SampleItem
*
sample
);
void
addSampleItem
(
SampleItem
*
sample
);
void
removeSample
(
SampleItem
*
sample
);
void
removeSample
(
SampleItem
*
sample
);
QStringList
sampleNames
()
const
;
QStringList
sampleNames
()
const
;
...
...
This diff is collapsed.
Click to expand it.
GUI/View/List/SamplesQModel.cpp
+
23
−
16
View file @
a4d01cfd
...
@@ -89,29 +89,35 @@ QModelIndex SamplesQModel::createSample()
...
@@ -89,29 +89,35 @@ QModelIndex SamplesQModel::createSample()
{
{
const
QStringList
existingNames
=
gDoc
->
samples
()
->
sampleNames
();
const
QStringList
existingNames
=
gDoc
->
samples
()
->
sampleNames
();
auto
*
t
=
new
SampleItem
;
t
->
setSampleName
(
GUI
::
Util
::
String
::
suggestName
(
existingNames
,
"Sample"
));
t
->
addStandardMaterials
();
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
beginInsertRows
(
QModelIndex
(),
row
,
row
);
auto
*
sample_item
=
gDoc
->
samplesModifier
()
->
addSampleItem
();
gDoc
->
samplesModifier
()
->
addSampleItem
(
t
);
sample_item
->
setSampleName
(
GUI
::
Util
::
String
::
suggestName
(
existingNames
,
"Sample"
));
sample_item
->
addStandardMaterials
();
endInsertRows
();
endInsertRows
();
return
indexForItem
(
sample_item
);
return
indexForItem
(
t
);
}
}
QModelIndex
SamplesQModel
::
createSampleFromExamples
(
const
QString
&
className
,
const
QString
&
title
,
QModelIndex
SamplesQModel
::
createSampleFromExamples
(
const
QString
&
className
,
const
QString
&
title
,
const
QString
&
description
)
const
QString
&
description
)
{
{
auto
*
sample
=
dynamic_cast
<
SampleItem
*>
(
GUI
::
ExamplesFactory
::
itemizeSample
(
className
));
auto
*
t
=
dynamic_cast
<
SampleItem
*>
(
GUI
::
ExamplesFactory
::
itemizeSample
(
className
));
if
(
!
sample
)
if
(
!
t
)
return
{};
return
{};
sample
->
setSampleName
(
title
);
t
->
setSampleName
(
title
);
sample
->
setDescription
(
description
);
t
->
setDescription
(
description
);
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
beginInsertRows
(
QModelIndex
(),
row
,
row
);
gDoc
->
samplesModifier
()
->
addSampleItem
(
sample
);
gDoc
->
samplesModifier
()
->
addSampleItem
(
t
);
endInsertRows
();
endInsertRows
();
return
indexForItem
(
sample
);
return
indexForItem
(
t
);
}
}
#ifdef BORNAGAIN_PYTHON
#ifdef BORNAGAIN_PYTHON
...
@@ -121,16 +127,17 @@ QModelIndex SamplesQModel::createSampleFromPython()
...
@@ -121,16 +127,17 @@ QModelIndex SamplesQModel::createSampleFromPython()
if
(
!
sample
)
if
(
!
sample
)
return
{};
// any messages already shown to user
return
{};
// any messages already shown to user
SampleItem
*
sampleItem
=
PyImportAssistant
::
itemizeSample
(
*
sample
);
SampleItem
*
t
=
PyImportAssistant
::
itemizeSample
(
*
sample
);
if
(
!
sampleItem
)
if
(
!
t
)
return
{};
// any messages already shown to user
return
{};
// any messages already shown to user
t
->
setDescription
(
"Imported from python code"
);
sampleItem
->
setDescription
(
"Imported from python code"
);
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
const
int
row
=
gDoc
->
samples
()
->
sampleItems
().
size
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
beginInsertRows
(
QModelIndex
(),
row
,
row
);
gDoc
->
samplesModifier
()
->
addSampleItem
(
sampleItem
);
gDoc
->
samplesModifier
()
->
addSampleItem
(
t
);
endInsertRows
();
endInsertRows
();
return
indexForItem
(
sampleItem
);
return
indexForItem
(
t
);
}
}
#endif
#endif
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