git-svn-id: svn://db.shs.com.ru/libs@237 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -1350,16 +1350,18 @@ void Graphic::on_checkGuides_toggled(bool checked) {
|
||||
|
||||
|
||||
void Graphic::updateLegend(bool es) {
|
||||
if (!ui->widgetLegend->isVisible()) {
|
||||
emit graphicSettingsChanged();
|
||||
if (!ui->widgetLegend->isVisibleTo(this)) {
|
||||
if (es) emit graphicSettingsChanged();
|
||||
// qDebug() << "skip updateLegend";
|
||||
return;
|
||||
}
|
||||
// qDebug() << "updateLegend" << graphics.size();
|
||||
leg_update = false;
|
||||
int ps = 100;
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
while (!graphics[i].pb->actions().isEmpty()) graphics[i].pb->removeAction(graphics[i].pb->actions()[0]);
|
||||
delete graphics[i].pb;
|
||||
//qDebug() << "new legend item" << graphics[i].name;
|
||||
// qDebug() << "new legend item" << graphics[i].name;
|
||||
QPixmap pix(60, 22);
|
||||
pix.fill(back_color);
|
||||
QPainter p(&pix);
|
||||
@@ -1386,16 +1388,17 @@ void Graphic::updateLegend(bool es) {
|
||||
}
|
||||
int maxcol = qMax<int>(ui->widgetLegend->width() / ps - 1, 1);
|
||||
int row = 0, col = 0;
|
||||
bool lv = ui->widgetLegend->isVisible();
|
||||
bool lv = ui->widgetLegend->isVisibleTo(this);
|
||||
ui->widgetLegend->hide();
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
ui->layoutLegend->addWidget(graphics[i].pb,row,col);
|
||||
graphics[i].pb->show();
|
||||
col++;
|
||||
if (col > maxcol) {col = 0; row++;}
|
||||
}
|
||||
ui->widgetLegend->setVisible(lv);
|
||||
leg_update = true;
|
||||
emit graphicSettingsChanged();
|
||||
if (es) emit graphicSettingsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -1418,7 +1421,7 @@ void Graphic::graphicVisibleChange(bool checked) {
|
||||
if (isFit) on_buttonAutofit_clicked();
|
||||
else update();
|
||||
emit graphicSettingsChanged();
|
||||
// update();
|
||||
// update();
|
||||
}
|
||||
|
||||
|
||||
@@ -1492,8 +1495,9 @@ void Graphic::load(QByteArray ba) {
|
||||
s >> a; setAntialiasing(a);
|
||||
s >> a; setBorderInputsVisible(a);
|
||||
s >> a; setStatusVisible(a);
|
||||
s >> a; setLegendVisible(a);
|
||||
s >> a;
|
||||
s >> graphics;
|
||||
setLegendVisible(a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user