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
a0c05d51
Commit
a0c05d51
authored
7 months ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
start PolyBase - reference in ISelectionForm no longer templated
parent
cb67e84b
No related branches found
No related tags found
1 merge request
!2696
PolyItem -> PolyPtr, with BaseItem as separate template parameter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Descriptor/PolyPtr.h
+15
-6
15 additions, 6 deletions
GUI/Model/Descriptor/PolyPtr.h
GUI/View/Sample/ISelectionForm.h
+1
-1
1 addition, 1 deletion
GUI/View/Sample/ISelectionForm.h
with
16 additions
and
7 deletions
GUI/Model/Descriptor/PolyPtr.h
+
15
−
6
View file @
a0c05d51
...
...
@@ -19,7 +19,16 @@
//! Holds a polymorphous item. Possible types of the item are specified by a Catalog.
template
<
typename
Catalog
>
class
PolyPtr
{
class
PolyBase
{
public:
virtual
QString
piLabel
()
const
=
0
;
virtual
QString
piTooltip
()
const
=
0
;
virtual
QStringList
menuEntries
()
const
=
0
;
virtual
void
setCurrentIndex
(
int
index
)
=
0
;
virtual
int
currentIndex
()
const
=
0
;
};
template
<
typename
Catalog
>
class
PolyPtr
:
public
PolyBase
{
public:
using
BaseItem
=
typename
Catalog
::
BaseItem
;
...
...
@@ -43,12 +52,12 @@ public:
m_item
.
reset
(
XML
::
readItemFrom
<
Catalog
>
(
r
,
args
...));
}
QString
piLabel
()
const
{
return
m_label
;
}
QString
piTooltip
()
const
{
return
m_tooltip
;
}
QStringList
menuEntries
()
const
{
return
m_menu_entries
;
}
QString
piLabel
()
const
override
{
return
m_label
;
}
QString
piTooltip
()
const
override
{
return
m_tooltip
;
}
QStringList
menuEntries
()
const
override
{
return
m_menu_entries
;
}
void
setCurrentIndex
(
int
index
)
{
m_item
.
reset
(
Catalog
::
create
(
m_types
[
index
]));
}
int
currentIndex
()
const
{
return
m_types
.
indexOf
(
Catalog
::
type
(
m_item
.
get
()));
}
void
setCurrentIndex
(
int
index
)
override
{
m_item
.
reset
(
Catalog
::
create
(
m_types
[
index
]));
}
int
currentIndex
()
const
override
{
return
m_types
.
indexOf
(
Catalog
::
type
(
m_item
.
get
()));
}
private
:
std
::
unique_ptr
<
BaseItem
>
m_item
;
//!< Current selection
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Sample/ISelectionForm.h
+
1
−
1
View file @
a0c05d51
...
...
@@ -56,7 +56,7 @@ protected:
m_grid_layout
->
addWidget
(
m_combo
,
1
,
0
);
createContent
();
}
template
<
typename
T
>
void
initUI
(
Poly
Ptr
<
T
>
&
d
)
void
initUI
(
Poly
Base
&
d
)
{
m_grid_layout
=
new
QGridLayout
(
this
);
m_grid_layout
->
setContentsMargins
(
0
,
0
,
0
,
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