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
98fc42e8
Commit
98fc42e8
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
shorter template arg name
parent
014ea8e9
No related branches found
Branches containing commit
No related tags found
1 merge request
!2364
rename SelectionProperty -> PolyItem
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUI/Model/Descriptor/SelectionProperty.h
+11
-18
11 additions, 18 deletions
GUI/Model/Descriptor/SelectionProperty.h
with
11 additions
and
18 deletions
GUI/Model/Descriptor/SelectionProperty.h
+
11
−
18
View file @
98fc42e8
...
...
@@ -47,11 +47,10 @@ public:
//! The current selection will be initialized with the first type in the catalog types. The
//! optional arguments are the arguments which may be necessary for the creation method in the
//! catalog.
template
<
typename
...
ArgsForCreation
>
void
initWithArgs
(
const
QString
&
label
,
const
QString
&
tooltip
,
typename
Catalog
::
Type
currentType
,
ArgsForCreation
...
argsForCreation
)
template
<
typename
...
Args
>
void
initWithArgs
(
const
QString
&
label
,
const
QString
&
tooltip
,
typename
Catalog
::
Type
currentType
,
Args
...
args
)
{
initFieldsAndSetter
(
label
,
tooltip
,
args
ForCreation
...);
initFieldsAndSetter
(
label
,
tooltip
,
args
...);
int
index
=
Catalog
::
types
().
indexOf
(
currentType
);
setCurrentIndex
(
index
);
}
...
...
@@ -87,14 +86,10 @@ public:
CatalogedType
*
certainItem
()
const
{
return
m_p
.
get
();
}
//! Directly set the new item.
void
setCertainItem
(
CatalogedType
*
t
)
{
m_p
.
reset
(
t
);
}
void
setCertainItem
(
CatalogedType
*
t
)
{
m_p
.
reset
(
t
);
}
//! Directly set the new item.
template
<
typename
S
>
S
*
setCertainItem
()
template
<
typename
S
>
S
*
setCertainItem
()
{
auto
*
s
=
new
S
();
if
(
s
!=
nullptr
&&
m_initializer
)
...
...
@@ -119,15 +114,14 @@ public:
//! Deserializes the catalog index of the currently selected type, creates a new
//! object of this type and calls main deserialization method of the selected class.
template
<
typename
...
ArgsForCreation
>
void
readFrom
(
QXmlStreamReader
*
r
,
ArgsForCreation
...
argsForCreation
)
template
<
typename
...
Args
>
void
readFrom
(
QXmlStreamReader
*
r
,
Args
...
args
)
{
const
uint
sel_ver
=
XML
::
readUIntAttribute
(
r
,
XML
::
Attrib
::
selection_version
);
Q_UNUSED
(
sel_ver
)
const
uint
typeIndex
=
XML
::
readUIntAttribute
(
r
,
XML
::
Attrib
::
type
);
const
auto
type
=
static_cast
<
typename
Catalog
::
Type
>
(
typeIndex
);
auto
*
p
=
Catalog
::
create
(
type
,
args
ForCreation
...);
auto
*
p
=
Catalog
::
create
(
type
,
args
...);
if
(
p
)
{
if
(
m_initializer
)
m_initializer
(
p
,
m_p
.
get
());
...
...
@@ -144,9 +138,8 @@ public:
int
currentIndex
()
const
{
return
m_types
.
indexOf
(
Catalog
::
type
(
m_p
.
get
()));
}
private
:
template
<
typename
...
ArgsForCreation
>
void
initFieldsAndSetter
(
const
QString
&
label
,
const
QString
&
tooltip
,
ArgsForCreation
...
argsForCreation
)
template
<
typename
...
Args
>
void
initFieldsAndSetter
(
const
QString
&
label
,
const
QString
&
tooltip
,
Args
...
args
)
{
m_label
=
label
;
m_tooltip
=
tooltip
;
...
...
@@ -154,8 +147,8 @@ private:
for
(
const
auto
type
:
m_types
)
m_options
<<
Catalog
::
uiInfo
(
type
).
menuEntry
;
currentIndexSetter
=
[
this
,
args
ForCreation
...](
int
current
)
{
auto
*
p
=
Catalog
::
create
(
m_types
[
current
],
args
ForCreation
...);
currentIndexSetter
=
[
this
,
args
...](
int
current
)
{
auto
*
p
=
Catalog
::
create
(
m_types
[
current
],
args
...);
if
(
m_initializer
)
m_initializer
(
p
,
m_p
.
get
());
m_p
.
reset
(
p
);
...
...
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