mirror of https://github.com/KLayout/klayout.git
Fixing a glitch in the data mapping widget (when editing the value, the node got deselected, but the colors boxes were still enabled)
This commit is contained in:
parent
17f5b4f2da
commit
5c9ccf34f7
|
|
@ -314,46 +314,48 @@ PropertiesPage::min_max_value_changed ()
|
||||||
emit edited ();
|
emit edited ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PropertiesPage::update_controls ()
|
||||||
|
{
|
||||||
|
bool has_error = false;
|
||||||
|
|
||||||
|
value_le->setText (QString ());
|
||||||
|
value_le->setEnabled (false);
|
||||||
|
|
||||||
|
colors->setEnabled (false_color_control->has_selection ());
|
||||||
|
colors->set_single_mode (false);
|
||||||
|
|
||||||
|
if (false_color_control->has_selection () && false_color_control->selected_node () > 0 && false_color_control->selected_node () < int (false_color_control->nodes ().size ()) - 1) {
|
||||||
|
|
||||||
|
double xmin, xmax;
|
||||||
|
get_xmin_xmax (xmin, xmax, has_error);
|
||||||
|
|
||||||
|
if (! has_error) {
|
||||||
|
|
||||||
|
double x = false_color_control->nodes () [false_color_control->selected_node ()].first;
|
||||||
|
double xx = x * (xmax - xmin) + xmin;
|
||||||
|
|
||||||
|
value_le->setText (tl::to_qstring (tl::sprintf ("%.4g", xx)));
|
||||||
|
value_le->setEnabled (true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (false_color_control->has_selection ()) {
|
||||||
|
|
||||||
|
colors->set_single_mode (true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_error;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PropertiesPage::color_mapping_changed ()
|
PropertiesPage::color_mapping_changed ()
|
||||||
{
|
{
|
||||||
if (! m_no_signals) {
|
if (! m_no_signals && ! update_controls ()) {
|
||||||
|
m_in_color_mapping_signal = true;
|
||||||
bool has_error = false;
|
emit edited ();
|
||||||
|
m_in_color_mapping_signal = false;
|
||||||
value_le->setText (QString ());
|
|
||||||
value_le->setEnabled (false);
|
|
||||||
|
|
||||||
colors->setEnabled (false_color_control->has_selection ());
|
|
||||||
colors->set_single_mode (false);
|
|
||||||
|
|
||||||
if (false_color_control->has_selection () && false_color_control->selected_node () > 0 && false_color_control->selected_node () < int (false_color_control->nodes ().size ()) - 1) {
|
|
||||||
|
|
||||||
double xmin, xmax;
|
|
||||||
get_xmin_xmax (xmin, xmax, has_error);
|
|
||||||
|
|
||||||
if (! has_error) {
|
|
||||||
|
|
||||||
double x = false_color_control->nodes () [false_color_control->selected_node ()].first;
|
|
||||||
double xx = x * (xmax - xmin) + xmin;
|
|
||||||
|
|
||||||
value_le->setText (tl::to_qstring (tl::sprintf ("%.4g", xx)));
|
|
||||||
value_le->setEnabled (true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (false_color_control->has_selection ()) {
|
|
||||||
|
|
||||||
colors->set_single_mode (true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! has_error) {
|
|
||||||
m_in_color_mapping_signal = true;
|
|
||||||
emit edited ();
|
|
||||||
m_in_color_mapping_signal = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -509,6 +511,7 @@ PropertiesPage::update ()
|
||||||
|
|
||||||
m_no_signals = false;
|
m_no_signals = false;
|
||||||
|
|
||||||
|
update_controls ();
|
||||||
recompute_histogram ();
|
recompute_histogram ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ private:
|
||||||
void invalidate ();
|
void invalidate ();
|
||||||
void init ();
|
void init ();
|
||||||
void get_xmin_xmax (double &xmin, double &xmax, bool &has_error_out);
|
void get_xmin_xmax (double &xmin, double &xmax, bool &has_error_out);
|
||||||
|
bool update_controls ();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue