git-svn-id: svn://db.shs.com.ru/libs@484 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user