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
df253ef9
Commit
df253ef9
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
UIntDescriptor: rm SessionItem
parent
7be686be
No related branches found
No related tags found
1 merge request
!1146
GUI: rm SessionItem from descriptors
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Descriptor/UIntDescriptor.cpp
+5
-24
5 additions, 24 deletions
GUI/Model/Descriptor/UIntDescriptor.cpp
GUI/Model/Descriptor/UIntDescriptor.h
+2
-15
2 additions, 15 deletions
GUI/Model/Descriptor/UIntDescriptor.h
with
7 additions
and
39 deletions
GUI/Model/Descriptor/UIntDescriptor.cpp
+
5
−
24
View file @
df253ef9
...
@@ -14,35 +14,16 @@
...
@@ -14,35 +14,16 @@
#include
"GUI/Model/Descriptor/UIntDescriptor.h"
#include
"GUI/Model/Descriptor/UIntDescriptor.h"
#include
"GUI/Model/BaseItem/SessionItem.h"
#include
<utility>
using
std
::
function
;
using
std
::
variant
;
UIntDescriptor
::
UIntDescriptor
(
const
QString
&
label
,
SessionItem
*
item
,
const
variant
<
QString
,
Unit
>&
unit
)
:
UIntDescriptor
(
label
,
item
->
toolTip
(),
item
->
limits
(),
[
=
](
int
d
)
{
item
->
setValue
(
d
);
},
[
=
]()
{
return
item
->
value
().
toInt
();
},
unit
)
{
}
UIntDescriptor
::
UIntDescriptor
(
SessionItem
*
item
,
const
variant
<
QString
,
Unit
>&
unit
)
:
UIntDescriptor
(
item
->
displayName
(),
item
,
unit
)
{
}
UIntDescriptor
::
UIntDescriptor
(
const
QString
&
label
,
const
QString
&
tooltip
,
UIntDescriptor
::
UIntDescriptor
(
const
QString
&
label
,
const
QString
&
tooltip
,
function
<
void
(
uint
)
>
setter
,
function
<
uint
()
>
getter
,
std
::
function
<
void
(
uint
)
>
setter
,
std
::
function
<
uint
()
>
getter
,
const
variant
<
QString
,
Unit
>&
unit
)
const
std
::
variant
<
QString
,
Unit
>&
unit
)
:
UIntDescriptor
(
label
,
tooltip
,
RealLimits
::
nonnegative
(),
setter
,
getter
,
unit
)
:
UIntDescriptor
(
label
,
tooltip
,
RealLimits
::
nonnegative
(),
setter
,
getter
,
unit
)
{
{
}
}
UIntDescriptor
::
UIntDescriptor
(
QString
label
,
QString
tooltip
,
const
RealLimits
&
limits
,
UIntDescriptor
::
UIntDescriptor
(
QString
label
,
QString
tooltip
,
const
RealLimits
&
limits
,
function
<
void
(
uint
)
>
setter
,
function
<
uint
()
>
getter
,
std
::
function
<
void
(
uint
)
>
setter
,
std
::
function
<
uint
()
>
getter
,
const
variant
<
QString
,
Unit
>&
unit
)
const
std
::
variant
<
QString
,
Unit
>&
unit
)
:
label
(
std
::
move
(
label
))
:
label
(
std
::
move
(
label
))
,
tooltip
(
std
::
move
(
tooltip
))
,
tooltip
(
std
::
move
(
tooltip
))
,
limits
(
limits
)
,
limits
(
limits
)
...
@@ -53,7 +34,7 @@ UIntDescriptor::UIntDescriptor(QString label, QString tooltip, const RealLimits&
...
@@ -53,7 +34,7 @@ UIntDescriptor::UIntDescriptor(QString label, QString tooltip, const RealLimits&
}
}
UIntDescriptor
::
UIntDescriptor
(
const
QString
&
label
,
const
uint
*
var
,
UIntDescriptor
::
UIntDescriptor
(
const
QString
&
label
,
const
uint
*
var
,
const
variant
<
QString
,
Unit
>&
unit
)
const
std
::
variant
<
QString
,
Unit
>&
unit
)
:
UIntDescriptor
(
:
UIntDescriptor
(
label
,
""
,
RealLimits
::
nonnegative
(),
[
=
](
uint
v
)
{
*
const_cast
<
uint
*>
(
var
)
=
v
;
},
label
,
""
,
RealLimits
::
nonnegative
(),
[
=
](
uint
v
)
{
*
const_cast
<
uint
*>
(
var
)
=
v
;
},
[
=
]
{
return
*
var
;
},
unit
)
[
=
]
{
return
*
var
;
},
unit
)
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Descriptor/UIntDescriptor.h
+
2
−
15
View file @
df253ef9
...
@@ -21,27 +21,14 @@
...
@@ -21,27 +21,14 @@
#include
<functional>
#include
<functional>
#include
<variant>
#include
<variant>
class
SessionItem
;
//! Describes properties of a uint value which are necessary to allow GUI representation, editing
//! Describes properties of a uint value which are necessary to allow GUI representation, editing
//! the value, undo/redo, unit conversion.
//! the value, undo/redo, unit conversion.
//!
//!
//! By using this class, the underlying data scheme is hidden from the user of the data. This e.g.
//! By using this class, the underlying data scheme is hidden from the user of the data. The underlying implementation
//! eases SessionItem migration. The underlying implementation can be a SessionItem, a simple uint
//! can be a simple uint member, or any other construction to hold a uint value.
//! member, or any other construction to hold a uint value.
class
UIntDescriptor
{
class
UIntDescriptor
{
public:
public:
UIntDescriptor
()
=
default
;
UIntDescriptor
()
=
default
;
//! Operates on a session item. The settings (like limits) are taken from the session
//! item.
//! Only for easier migration. Should be removed after SessionItem refactoring.
UIntDescriptor
(
SessionItem
*
item
,
const
std
::
variant
<
QString
,
Unit
>&
unit
);
//! Operates on a session item. The settings (like limits) are taken from the session
//! item.
//! Only for easier migration. Should be removed after SessionItem refactoring.
UIntDescriptor
(
const
QString
&
label
,
SessionItem
*
item
,
const
std
::
variant
<
QString
,
Unit
>&
unit
);
UIntDescriptor
(
const
QString
&
label
,
const
uint
*
var
,
const
std
::
variant
<
QString
,
Unit
>&
unit
);
UIntDescriptor
(
const
QString
&
label
,
const
uint
*
var
,
const
std
::
variant
<
QString
,
Unit
>&
unit
);
...
...
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