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
2d0c1916
Commit
2d0c1916
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
MinimizerSettingsWidget: doing tooltips
parent
061eaf33
No related branches found
No related tags found
1 merge request
!1004
Fit: catalogize algorithms, not minimizers
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Job/MinimizerItem.cpp
+10
-3
10 additions, 3 deletions
GUI/Model/Job/MinimizerItem.cpp
GUI/View/Fit/MinimizerSettingsWidget.cpp
+17
-13
17 additions, 13 deletions
GUI/View/Fit/MinimizerSettingsWidget.cpp
with
27 additions
and
16 deletions
GUI/Model/Job/MinimizerItem.cpp
+
10
−
3
View file @
2d0c1916
...
@@ -34,13 +34,16 @@ const QString default_minimizer = minimizer_names_map.key(MinuitMinimizerItem::M
...
@@ -34,13 +34,16 @@ const QString default_minimizer = minimizer_names_map.key(MinuitMinimizerItem::M
#ifdef ALGORITHM_LIST
#ifdef ALGORITHM_LIST
QMap
<
QString
/*algorithm*/
,
QString
/*minimizer*/
>
algorithm_minimizer_map
;
QMap
<
QString
/*algorithm*/
,
QString
/*minimizer*/
>
algorithm_minimizer_map
;
QStringList
create_algorithm_
minimizer_map
(
)
QStringList
create_algorithm_
list_and_map
(
QString
&
default_common_algorithm
)
{
{
QString
name
,
shift
=
" "
;
QString
name
,
shift
=
" "
;
QStringList
common_algorithms_list
;
QStringList
common_algorithms_list
;
// group 1
// group header. Can't be selected and have no mapped minimizer
common_algorithms_list
.
append
(
"ROOT Minuit2"
);
common_algorithms_list
.
append
(
"ROOT Minuit2"
);
// algorithms in group. Should have mapped minimizer
QStringList
minuit2Algorithms
=
QStringList
minuit2Algorithms
=
MinimizerItemCatalog
::
algorithmNames
(
MinuitMinimizerItem
::
M_TYPE
);
MinimizerItemCatalog
::
algorithmNames
(
MinuitMinimizerItem
::
M_TYPE
);
for
(
QString
algorithm
:
minuit2Algorithms
)
{
for
(
QString
algorithm
:
minuit2Algorithms
)
{
...
@@ -49,12 +52,14 @@ QStringList create_algorithm_minimizer_map()
...
@@ -49,12 +52,14 @@ QStringList create_algorithm_minimizer_map()
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
MinuitMinimizerItem
::
M_TYPE
));
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
MinuitMinimizerItem
::
M_TYPE
));
}
}
// group 2
common_algorithms_list
.
append
(
"ROOT TMVA"
);
common_algorithms_list
.
append
(
"ROOT TMVA"
);
name
=
shift
+
"Genetic"
;
name
=
shift
+
"Genetic"
;
common_algorithms_list
.
append
(
name
);
common_algorithms_list
.
append
(
name
);
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
GeneticMinimizerItem
::
M_TYPE
));
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
GeneticMinimizerItem
::
M_TYPE
));
// group 3
common_algorithms_list
.
append
(
"GSL Multimin"
);
common_algorithms_list
.
append
(
"GSL Multimin"
);
QStringList
multiMinAlgorithms
=
QStringList
multiMinAlgorithms
=
...
@@ -66,6 +71,7 @@ QStringList create_algorithm_minimizer_map()
...
@@ -66,6 +71,7 @@ QStringList create_algorithm_minimizer_map()
minimizer_names_map
.
key
(
GSLMultiMinimizerItem
::
M_TYPE
));
minimizer_names_map
.
key
(
GSLMultiMinimizerItem
::
M_TYPE
));
}
}
// group 4
common_algorithms_list
.
append
(
"GSL"
);
common_algorithms_list
.
append
(
"GSL"
);
name
=
shift
+
"Simulated Annealing"
;
name
=
shift
+
"Simulated Annealing"
;
...
@@ -76,6 +82,7 @@ QStringList create_algorithm_minimizer_map()
...
@@ -76,6 +82,7 @@ QStringList create_algorithm_minimizer_map()
common_algorithms_list
.
append
(
name
);
common_algorithms_list
.
append
(
name
);
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
GSLLMAMinimizerItem
::
M_TYPE
));
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
GSLLMAMinimizerItem
::
M_TYPE
));
default_common_algorithm
=
shift
+
minuit2Algorithms
.
first
();
return
common_algorithms_list
;
return
common_algorithms_list
;
}
}
#endif
#endif
...
@@ -100,8 +107,8 @@ MinimizerContainerItem::MinimizerContainerItem()
...
@@ -100,8 +107,8 @@ MinimizerContainerItem::MinimizerContainerItem()
addProperty
<
GSLLMAMinimizerItem
>
(
GSLLMAMinimizerItem
::
M_TYPE
);
addProperty
<
GSLLMAMinimizerItem
>
(
GSLLMAMinimizerItem
::
M_TYPE
);
#ifdef ALGORITHM_LIST
#ifdef ALGORITHM_LIST
const
QString
List
common_algorithm
s_list
=
create_algorithm_minimizer_map
()
;
QString
default_
common_algorithm
;
const
QString
default_
common_algorithm
=
common
_algorithm
s
_list
[
1
]
;
const
QString
List
common_algorithm
s_list
=
create
_algorithm_list
_and_map
(
default_common_algorithm
)
;
ComboProperty
common_algorithm_combo
=
ComboProperty
common_algorithm_combo
=
ComboProperty
::
fromList
(
common_algorithms_list
,
default_common_algorithm
);
ComboProperty
::
fromList
(
common_algorithms_list
,
default_common_algorithm
);
addProperty
(
P_COMMON_ALGORITHMS
,
common_algorithm_combo
.
variant
());
addProperty
(
P_COMMON_ALGORITHMS
,
common_algorithm_combo
.
variant
());
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Fit/MinimizerSettingsWidget.cpp
+
17
−
13
View file @
2d0c1916
...
@@ -101,26 +101,26 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
...
@@ -101,26 +101,26 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
for
(
QString
algorithm
:
list
)
{
for
(
QString
algorithm
:
list
)
{
comboBox
->
addItem
(
algorithm
);
comboBox
->
addItem
(
algorithm
);
if
(
!
m_currentItem
->
algorithmHasMinimizer
(
algorithm
))
{
if
(
!
m_currentItem
->
algorithmHasMinimizer
(
algorithm
))
{
comboBox
->
insertSeparator
(
comboBox
->
count
()
-
1
);
comboBox
->
insertSeparator
(
comboBox
->
count
()
-
1
);
qsizetype
header_index
=
comboBox
->
count
()
-
1
;
qsizetype
header_index
=
comboBox
->
count
()
-
1
;
header_indices
.
append
(
header_index
);
header_indices
.
append
(
header_index
);
QStandardItemModel
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
comboBox
->
model
());
QStandardItem
*
header_item
=
model
->
item
(
header_index
);
header_item
->
setSelectable
(
false
);
QFont
font
(
comboBox
->
font
());
QFont
font
(
comboBox
->
font
());
font
.
setBold
(
true
);
font
.
setBold
(
true
);
header_item
->
setFont
(
font
);
QStandardItemModel
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
comboBox
->
model
());
QStandardItem
*
firstItem
=
model
->
item
(
header_index
);
firstItem
->
setSelectable
(
false
);
firstItem
->
setFont
(
font
);
comboBox
->
insertSeparator
(
comboBox
->
count
());
comboBox
->
insertSeparator
(
comboBox
->
count
());
}
}
}
}
// comboBox->setToolTip(tooltip);
comboBox
->
setCurrentText
(
m_currentItem
->
commonAlgorithmCombo
().
currentValue
());
comboBox
->
setCurrentText
(
m_currentItem
->
commonAlgorithmCombo
().
currentValue
());
qInfo
()
<<
"TOOLTIPS:
\n
"
<<
m_currentItem
->
commonAlgorithmCombo
().
toolTips
();
// if (comboFunction().toolTips().size() == combo->count())
// if (comboFunction().toolTips().size() == combo->count())
// for (int index = 0; index < combo->count(); index++)
// for (int index = 0; index < combo->count(); index++)
// combo->setItemData(index, comboFunction().toolTips().at(index), Qt::ToolTipRole);
// combo->setItemData(index, comboFunction().toolTips().at(index), Qt::ToolTipRole);
...
@@ -131,13 +131,17 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
...
@@ -131,13 +131,17 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
// skip headers while scrolling
// skip headers while scrolling
if
(
header_indices
.
contains
(
comboBox
->
currentIndex
()))
if
(
header_indices
.
contains
(
comboBox
->
currentIndex
()))
{
{
int
previous
=
comboBox
->
property
(
"previous"
).
toInt
();
int
previous_state
=
comboBox
->
property
(
"previous"
).
toInt
();
if
(
previous
<
comboBox
->
currentIndex
()
&&
comboBox
->
currentIndex
()
+
2
<
comboBox
->
count
())
comboBox
->
setCurrentIndex
(
comboBox
->
currentIndex
()
+
2
);
int
prev
=
comboBox
->
currentIndex
()
-
2
;
else
if
(
previous
>
comboBox
->
currentIndex
()
&&
comboBox
->
currentIndex
()
-
3
>=
0
)
int
next
=
comboBox
->
currentIndex
()
+
2
;
comboBox
->
setCurrentIndex
(
comboBox
->
currentIndex
()
-
3
);
if
(
previous_state
<
comboBox
->
currentIndex
()
&&
next
<
comboBox
->
count
())
comboBox
->
setCurrentIndex
(
next
);
else
if
(
previous_state
>
comboBox
->
currentIndex
()
&&
prev
>=
0
)
comboBox
->
setCurrentIndex
(
prev
);
else
else
comboBox
->
setCurrentIndex
(
previous
);
comboBox
->
setCurrentIndex
(
previous
_state
);
}
}
comboBox
->
setProperty
(
"previous"
,
comboBox
->
currentIndex
());
comboBox
->
setProperty
(
"previous"
,
comboBox
->
currentIndex
());
...
...
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