git-svn-id: svn://db.shs.com.ru/libs@237 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-06-15 14:31:12 +00:00
parent 10f8898d2e
commit 4e90eef9bc

View File

@@ -1350,10 +1350,12 @@ void Graphic::on_checkGuides_toggled(bool checked) {
void Graphic::updateLegend(bool es) { void Graphic::updateLegend(bool es) {
if (!ui->widgetLegend->isVisible()) { if (!ui->widgetLegend->isVisibleTo(this)) {
emit graphicSettingsChanged(); if (es) emit graphicSettingsChanged();
// qDebug() << "skip updateLegend";
return; return;
} }
// qDebug() << "updateLegend" << graphics.size();
leg_update = false; leg_update = false;
int ps = 100; int ps = 100;
for (int i = 0; i < graphics.size(); i++) { for (int i = 0; i < graphics.size(); i++) {
@@ -1386,16 +1388,17 @@ void Graphic::updateLegend(bool es) {
} }
int maxcol = qMax<int>(ui->widgetLegend->width() / ps - 1, 1); int maxcol = qMax<int>(ui->widgetLegend->width() / ps - 1, 1);
int row = 0, col = 0; int row = 0, col = 0;
bool lv = ui->widgetLegend->isVisible(); bool lv = ui->widgetLegend->isVisibleTo(this);
ui->widgetLegend->hide(); ui->widgetLegend->hide();
for (int i = 0; i < graphics.size(); i++) { for (int i = 0; i < graphics.size(); i++) {
ui->layoutLegend->addWidget(graphics[i].pb,row,col); ui->layoutLegend->addWidget(graphics[i].pb,row,col);
graphics[i].pb->show();
col++; col++;
if (col > maxcol) {col = 0; row++;} if (col > maxcol) {col = 0; row++;}
} }
ui->widgetLegend->setVisible(lv); ui->widgetLegend->setVisible(lv);
leg_update = true; leg_update = true;
emit graphicSettingsChanged(); if (es) emit graphicSettingsChanged();
} }
@@ -1492,8 +1495,9 @@ void Graphic::load(QByteArray ba) {
s >> a; setAntialiasing(a); s >> a; setAntialiasing(a);
s >> a; setBorderInputsVisible(a); s >> a; setBorderInputsVisible(a);
s >> a; setStatusVisible(a); s >> a; setStatusVisible(a);
s >> a; setLegendVisible(a); s >> a;
s >> graphics; s >> graphics;
setLegendVisible(a);
} }