Commit 31fb21ee authored by LE BRETON Come's avatar LE BRETON Come
Browse files

Working, not elegant.

parent 255811b6
Pipeline #138937 passed with stage
in 0 seconds
......@@ -104,7 +104,7 @@
"parameter": {
"widget": "dtkWidgetsParameterLongLongSpinBox",
"uid": "spin_long",
"advanced": false,
"advanced": true,
"widget_read_only": false
}
},
......
......@@ -99,7 +99,7 @@ QObject *dtkWidgetsMainWindowPrivate::populateAdvancedParametersSwitch(dtkWidget
return;
}
menubar->displayAdvancedParameters(v.value<dtk::d_bool>());
menubar->advancedParametersDisplayed(v.value<dtk::d_bool>());
});
switch_widget = menu->addParameter("Switch", switch_parameter, "dtkWidgetsParameterBoolCheckBox", true);
......
......@@ -12,10 +12,14 @@
// Code:
#include "dtkWidgetsMainWindow.h"
#include "dtkWidgetsParameter.h" // TODO: Rename to dtkWidgetsParameterBase.h
#include "dtkWidgetsMenu+ux.h"
#include "dtkWidgetsParameter.h"
#include "dtkWidgetsMenuItem+custom.h"
#include "dtkWidgetsMenuBar.h"
#include <dtkApplication.h>
#include <dtkFonts/dtkFontAwesome>
......@@ -236,17 +240,10 @@ dtkWidgetsMenuItemParameterFacade::dtkWidgetsMenuItemParameterFacade(dtkWidgetsM
layout->setRowWrapPolicy(QFormLayout::WrapAllRows);
layout->addRow(source->title(), source->widget());
if (source->widget()->advanced()) {
if (source->widget()->advanced() && !dtkApp->window()->menubar()->isAdvancedParametersDisplayed()) {
this->hide();
}
this->param_connect = connect(source->widget(), &dtkWidgetsParameter::advancedChanged, [this] (bool advanced) {
if (advanced)
this->hide();
else
this->show();
});
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
}
......
......@@ -1142,9 +1142,17 @@ QWidget *dtkWidgetsMenuBar::container(void)
return d->c;
}
void dtkWidgetsMenuBar::displayAdvancedParameters(bool display)
void dtkWidgetsMenuBar::advancedParametersDisplayed(bool display)
{
if(display != d->advanced_parameters_displayed) {
d->advanced_parameters_displayed = display;
this->touch();
}
}
bool dtkWidgetsMenuBar::isAdvancedParametersDisplayed(void)
{
return d->advanced_parameters_displayed;
}
// /////////////////////////////////////////////////////////////////////////////
......
......@@ -61,7 +61,8 @@ public:
#pragma mark - Handling of advanced parameters
void displayAdvancedParameters(bool);
void advancedParametersDisplayed(bool);
bool isAdvancedParametersDisplayed(void);
// /////////////////////////////////////////////////////////////////////////////
#pragma mark - Convenience builders
......
......@@ -162,6 +162,9 @@ public:
public:
bool interactive = true;
public:
bool advanced_parameters_displayed = false;
};
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment