Graphic legend fix

This commit is contained in:
2021-04-02 11:29:34 +03:00
parent 42f445d7ca
commit 8f7672b7be
2 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(qad) project(qad)
set(qad_MAJOR 2) set(qad_MAJOR 2)
set(qad_MINOR 2) set(qad_MINOR 2)
set(qad_REVISION 0) set(qad_REVISION 1)
set(qad_SUFFIX ) set(qad_SUFFIX )
set(qad_COMPANY SHS) set(qad_COMPANY SHS)
set(qad_DOMAIN org.SHS) set(qad_DOMAIN org.SHS)

View File

@@ -1727,11 +1727,11 @@ void Graphic::updateLegend(bool es) {
int cps = graphics[i].pb->sizeHint().width() + 4; int cps = graphics[i].pb->sizeHint().width() + 4;
if (cps > ps) ps = cps; if (cps > ps) ps = cps;
} }
int maxcol = qMax<int>(ui->widgetLegend->width() / ps - 1, 1); LegendScrollArea * leg_sa = (LegendScrollArea *)ui->scrollLegend->layout()->itemAt(0)->widget();
int maxcol = qMax<int>(leg_sa->width() / ps - 1, 1);
int row = 0, col = 0; int row = 0, col = 0;
bool lv = ui->scrollLegend->isVisibleTo(this); bool lv = ui->scrollLegend->isVisibleTo(this);
ui->scrollLegend->hide(); ui->scrollLegend->hide();
LegendScrollArea * leg_sa = (LegendScrollArea *)ui->scrollLegend->layout()->itemAt(0)->widget();
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);
QCheckBox * check = graphics[i].pb; QCheckBox * check = graphics[i].pb;