From b9c8f7c0a46a3e4a4742e79cdd157b03c6ba9b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Mon, 28 Jan 2019 16:19:47 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@484 a8b55f48-bf90-11e4-a774-851b48703e85 --- qad/graphic/graphic.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/qad/graphic/graphic.cpp b/qad/graphic/graphic.cpp index 95a304b..39bef03 100644 --- a/qad/graphic/graphic.cpp +++ b/qad/graphic/graphic.cpp @@ -1499,6 +1499,18 @@ void Graphic::on_checkGuides_toggled(bool checked) { void Graphic::updateLegend(bool es) { + QPixmap pix(60, 22); + for (int i = 0; i < graphics.size(); i++) { + pix.fill(back_color); + QPainter p(&pix); + QPen pen = graphics[i].pen; + if (qRound(pen.widthF()) == pen.widthF()) pen.setWidth(pen.width()*thick); + else pen.setWidthF(pen.widthF()*thick); + p.setPen(pen); + p.drawLine(0, pix.height() / 2, pix.width(), pix.height() / 2); + p.end(); + graphics[i].icon = QIcon(pix); + } if (!ui->widgetLegend->isVisibleTo(this)) { if (es) emit graphicSettingsChanged(); // qDebug() << "skip updateLegend"; @@ -1518,19 +1530,6 @@ void Graphic::updateLegend(bool es) { } ui->layoutLegend->invalidate(); for (int i = 0; i < graphics.size(); i++) { - /*while (!graphics[i].pb->actions().isEmpty()) graphics[i].pb->removeAction(graphics[i].pb->actions()[0]); - graphics[i].pb->deleteLater();*/ -// qDebug() << "new legend item" << graphics[i].name; - QPixmap pix(60, 22); - pix.fill(back_color); - QPainter p(&pix); - QPen pen = graphics[i].pen; - if (qRound(pen.widthF()) == pen.widthF()) pen.setWidth(pen.width()*thick); - else pen.setWidthF(pen.widthF()*thick); - p.setPen(pen); - p.drawLine(0, pix.height() / 2, pix.width(), pix.height() / 2); - p.end(); - graphics[i].icon = QIcon(pix); graphics[i].pb = new QCheckBox(graphics[i].name); graphics[i].pb->setIconSize(pix.size()); //graphics[i].pb->setFlat(true);