From 8f7672b7be858380d53f3e90f5554c71f470713e Mon Sep 17 00:00:00 2001 From: peri4 Date: Fri, 2 Apr 2021 11:29:34 +0300 Subject: [PATCH] Graphic legend fix --- CMakeLists.txt | 2 +- libs/graphic/graphic.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61ef18e..c5d0b54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(qad) set(qad_MAJOR 2) set(qad_MINOR 2) -set(qad_REVISION 0) +set(qad_REVISION 1) set(qad_SUFFIX ) set(qad_COMPANY SHS) set(qad_DOMAIN org.SHS) diff --git a/libs/graphic/graphic.cpp b/libs/graphic/graphic.cpp index 5635d32..7c6e6e7 100644 --- a/libs/graphic/graphic.cpp +++ b/libs/graphic/graphic.cpp @@ -1727,11 +1727,11 @@ void Graphic::updateLegend(bool es) { int cps = graphics[i].pb->sizeHint().width() + 4; if (cps > ps) ps = cps; } - int maxcol = qMax(ui->widgetLegend->width() / ps - 1, 1); + LegendScrollArea * leg_sa = (LegendScrollArea *)ui->scrollLegend->layout()->itemAt(0)->widget(); + int maxcol = qMax(leg_sa->width() / ps - 1, 1); int row = 0, col = 0; bool lv = ui->scrollLegend->isVisibleTo(this); ui->scrollLegend->hide(); - LegendScrollArea * leg_sa = (LegendScrollArea *)ui->scrollLegend->layout()->itemAt(0)->widget(); for (int i = 0; i < graphics.size(); i++) { ui->layoutLegend->addWidget(graphics[i].pb,row,col); QCheckBox * check = graphics[i].pb;