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
b13b15cf
Commit
b13b15cf
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
FitParameterItem: adding items
parent
d79cd5ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1120
GUI: FitParameterModel and fit items are refactored
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Job/FitParameterItem.cpp
+85
-9
85 additions, 9 deletions
GUI/Model/Job/FitParameterItem.cpp
GUI/Model/Job/FitParameterItem.h
+19
-12
19 additions, 12 deletions
GUI/Model/Job/FitParameterItem.h
with
104 additions
and
21 deletions
GUI/Model/Job/FitParameterItem.cpp
+
85
−
9
View file @
b13b15cf
...
...
@@ -44,19 +44,24 @@ const double range_factor = 0.5;
}
// namespace
FitParameterItem
::
FitParameterItem
()
:
SessionItem
(
M_TYPE
)
FitParameterItem
::
FitParameterItem
(
QObject
*
parent
)
:
QObject
(
parent
)
,
SessionItem
(
M_TYPE
)
,
m_typeItem
(
new
FitComboItem
(
fitParameterTypeCombo
(),
this
))
,
m_startValueItem
(
new
FitDoubleItem
(
0.0
,
this
))
,
m_minItem
(
new
FitEditableDoubleItem
(
0.0
,
true
,
this
))
,
m_maxItem
(
new
FitEditableDoubleItem
(
0.0
,
false
,
this
))
{
addProperty
(
P_TYPE
,
fitParameterTypeCombo
().
variant
());
addProperty
(
P_START_VALUE
,
double
(
0.0
));
addProperty
(
P_MIN
,
double
(
0.0
));
addProperty
(
P_MAX
,
double
(
0.0
))
->
setEnabled
(
false
);
//
addProperty(P_TYPE, fitParameterTypeCombo().variant());
//
addProperty(P_START_VALUE, double(0.0));
//
addProperty(P_MIN, double(0.0));
//
addProperty(P_MAX, double(0.0))->setEnabled(false);
registerTag
(
T_LINK
,
0
,
-
1
,
{
FitParameterLinkItem
::
M_TYPE
});
setDefaultTag
(
T_LINK
);
startValueItem
()
->
setLimits
(
RealLimits
::
limitless
());
minimumItem
()
->
setLimits
(
RealLimits
::
limitless
());
maximumItem
()
->
setLimits
(
RealLimits
::
limitless
());
//
startValueItem()->setLimits(RealLimits::limitless());
//
minimumItem()->setLimits(RealLimits::limitless());
//
maximumItem()->setLimits(RealLimits::limitless());
onTypeChange
();
}
...
...
@@ -301,3 +306,74 @@ bool FitParameterItem::isFixed() const
{
return
currentType
()
==
"fixed"
;
}
//------------------------------------------------------------------------------------------------
FitComboItem
::
FitComboItem
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
FitComboItem
::
FitComboItem
(
const
ComboProperty
&
combo
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_combo
(
combo
)
{
}
ComboProperty
FitComboItem
::
combo
()
{
return
m_combo
;
}
void
FitComboItem
::
setCombo
(
const
ComboProperty
&
c
)
{
m_combo
=
c
;
}
//------------------------------------------------------------------------------------------------
FitDoubleItem
::
FitDoubleItem
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_value
(
0.0
)
{
}
FitDoubleItem
::
FitDoubleItem
(
double
value
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_value
(
value
)
{
}
double
FitDoubleItem
::
value
()
{
return
m_value
;
}
void
FitDoubleItem
::
setValue
(
double
v
)
{
m_value
=
v
;
}
//------------------------------------------------------------------------------------------------
FitEditableDoubleItem
::
FitEditableDoubleItem
(
QObject
*
parent
)
:
FitDoubleItem
(
0.0
,
parent
)
,
m_isEnabled
(
true
)
{
}
FitEditableDoubleItem
::
FitEditableDoubleItem
(
double
value
,
bool
isEnabled
,
QObject
*
parent
)
:
FitDoubleItem
(
value
,
parent
)
,
m_isEnabled
(
isEnabled
)
{
}
bool
FitEditableDoubleItem
::
isEnabled
()
{
return
m_isEnabled
;
}
void
FitEditableDoubleItem
::
setEnabled
(
bool
b
)
{
m_isEnabled
=
b
;
}
This diff is collapsed.
Click to expand it.
GUI/Model/Job/FitParameterItem.h
+
19
−
12
View file @
b13b15cf
...
...
@@ -24,10 +24,11 @@ class FitParameterLinkItem;
//! Holds ComboProperty values, accessible from FitparameterModel.
class
FitComboItem
:
public
QObject
{
public:
FitComboItem
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{}
FitComboItem
(
QObject
*
parent
=
nullptr
);
FitComboItem
(
const
ComboProperty
&
combo
,
QObject
*
parent
=
nullptr
);
ComboProperty
combo
()
{
return
m_combo
;}
void
setCombo
(
const
ComboProperty
&
c
)
{
m_combo
=
c
;}
ComboProperty
combo
()
;
void
setCombo
(
const
ComboProperty
&
c
)
;
private:
ComboProperty
m_combo
;
...
...
@@ -36,29 +37,31 @@ private:
//! Holds double values, accessible from FitparameterModel.
class
FitDoubleItem
:
public
QObject
{
public:
FitDoubleItem
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{}
FitDoubleItem
(
QObject
*
parent
=
nullptr
);
FitDoubleItem
(
double
value
,
QObject
*
parent
=
nullptr
);
double
value
()
{
return
m_value
;}
void
setValue
(
double
v
)
{
m_value
=
v
;}
double
value
()
;
void
setValue
(
double
v
)
;
private:
double
m_value
;
};
//! Holds double values which can be enabled or disabled.
class
Fit
DoubleEdita
bleItem
:
public
FitDoubleItem
{
class
Fit
EditableDou
bleItem
:
public
FitDoubleItem
{
public:
FitDoubleEditableItem
(
QObject
*
parent
=
nullptr
)
:
FitDoubleItem
(
parent
)
{}
FitEditableDoubleItem
(
QObject
*
parent
=
nullptr
);
FitEditableDoubleItem
(
double
value
,
bool
isEnabled
,
QObject
*
parent
=
nullptr
);
bool
isEnabled
()
{
return
m_isEnabled
;}
void
setEnabled
(
bool
b
)
{
m_isEnabled
=
b
;}
bool
isEnabled
()
;
void
setEnabled
(
bool
b
)
;
private:
bool
m_isEnabled
;
};
//! Represents a fit parameter in GUI. Contains links to corresponding ParameterItems in a tuning tree.
class
FitParameterItem
:
public
SessionItem
{
class
FitParameterItem
:
public
QObject
,
public
SessionItem
{
private:
static
constexpr
auto
P_TYPE
{
"Type"
};
static
constexpr
auto
P_START_VALUE
{
"Value"
};
...
...
@@ -69,7 +72,7 @@ private:
public
:
static
constexpr
auto
M_TYPE
{
"FitParameter"
};
FitParameterItem
();
FitParameterItem
(
QObject
*
parent
=
nullptr
);
void
initMinMaxValues
(
const
RealLimits
&
limits
);
...
...
@@ -111,6 +114,10 @@ private:
bool
isUpperLimited
()
const
;
bool
isFixed
()
const
;
FitComboItem
*
m_typeItem
;
FitDoubleItem
*
m_startValueItem
;
FitEditableDoubleItem
*
m_minItem
;
FitEditableDoubleItem
*
m_maxItem
;
QVector
<
FitParameterLinkItem
*>
m_links
;
};
...
...
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