git-svn-id: svn://db.shs.com.ru/libs@235 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -1356,6 +1356,7 @@ void Graphic::updateLegend() {
|
||||
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;
|
||||
QPixmap pix(60, 22);
|
||||
pix.fill(back_color);
|
||||
QPainter p(&pix);
|
||||
@@ -1394,6 +1395,16 @@ void Graphic::updateLegend() {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::updateLegendChecks() {
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
if (!graphics[i].pb) continue;
|
||||
bool pbs = graphics[i].pb->blockSignals(true);
|
||||
graphics[i].pb->setChecked(graphics[i].visible);
|
||||
graphics[i].pb->blockSignals(pbs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Graphic::graphicVisibleChange(bool checked) {
|
||||
if (visible_update) return;
|
||||
QCheckBox * cb = qobject_cast<QCheckBox*>(sender());
|
||||
|
||||
@@ -247,7 +247,7 @@ public slots:
|
||||
void setGraphicStyle(const Qt::PenStyle & style) {graphics[curGraphic].pen.setStyle(style); updateLegend(); if (aupdate) update();}
|
||||
void setGridStyle(const Qt::PenStyle & style) {grid_pen.setStyle(style); if (aupdate) update();}
|
||||
void setSelectionStyle(const Qt::PenStyle & style) {selpen.setStyle(style);}
|
||||
void setGraphicVisible(bool visible, int index) {graphics[index].visible = visible; updateLegend(); if (aupdate) update();}
|
||||
void setGraphicVisible(bool visible, int index) {graphics[index].visible = visible; updateLegendChecks(); if (aupdate) update();}
|
||||
void setGraphicVisible(bool visible) {setGraphicVisible(visible, curGraphic);}
|
||||
void setGraphicLineWidth(double w, int index) {if (qRound(w) == w) graphics[index].pen.setWidth(qRound(w)); else graphics[index].pen.setWidthF(w); updateLegend(); if (aupdate) update();}
|
||||
void setGraphicLineWidth(double w) {setGraphicLineWidth(w, curGraphic);}
|
||||
@@ -349,6 +349,7 @@ protected:
|
||||
void drawPause();
|
||||
void drawAction();
|
||||
void updateLegend();
|
||||
void updateLegendChecks();
|
||||
void setCanvasCursor(QCursor cursor);
|
||||
void swapToBuffer();
|
||||
void swapToNormal() {bufferActive = false;}
|
||||
|
||||
Reference in New Issue
Block a user