Graphic config: checkboxes for all graphics now gather current states
This commit is contained in:
@@ -2315,12 +2315,29 @@ void Graphic::on_graphic_buttonAutofit_clicked() {
|
||||
|
||||
void Graphic::on_graphic_buttonConfigure_clicked() {
|
||||
conf->graphicItems.clear();
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
GraphicConf::GraphicItem item;
|
||||
item.icon = graphics[i].icon;
|
||||
item.name = graphics[i].name;
|
||||
conf->graphicItems.append(item);
|
||||
int all_checks[2] = {-1, -1};
|
||||
auto addAllChecks = [](int & out, bool is_vis) {
|
||||
if (out < 0)
|
||||
out = is_vis ? Qt::Checked : Qt::Unchecked;
|
||||
else {
|
||||
if (is_vis && out == Qt::Unchecked) out = Qt::PartiallyChecked;
|
||||
if (!is_vis && out == Qt::Checked) out = Qt::PartiallyChecked;
|
||||
}
|
||||
};
|
||||
for (const auto & g: graphics) {
|
||||
GraphicConf::GraphicItem item;
|
||||
item.icon = g.icon;
|
||||
item.name = g.name;
|
||||
conf->graphicItems.append(item);
|
||||
addAllChecks(all_checks[0], g.lines);
|
||||
addAllChecks(all_checks[1], g.points);
|
||||
}
|
||||
conf->ui->checkLinesAll->blockSignals(true);
|
||||
conf->ui->checkPointsAll->blockSignals(true);
|
||||
conf->ui->checkLinesAll->setCheckState((Qt::CheckState)all_checks[0]);
|
||||
conf->ui->checkPointsAll->setCheckState((Qt::CheckState)all_checks[1]);
|
||||
conf->ui->checkLinesAll->blockSignals(false);
|
||||
conf->ui->checkPointsAll->blockSignals(false);
|
||||
conf->ui->colorGrid->setColor(grid_pen.color());
|
||||
conf->ui->comboStyleGrid->setCurrentIndex((int)grid_pen.style());
|
||||
conf->ui->spinWidthGrid->setValue(grid_pen.widthF());
|
||||
|
||||
Reference in New Issue
Block a user