mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Fixed broken graph color change when secondary graphs present
This commit is contained in:
parent
d94938261a
commit
c9244c0684
@ -1,3 +1,4 @@
|
||||
#include <QSet>
|
||||
#include <QGraphicsScene>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
@ -494,8 +495,23 @@ void GraphView::setPalette(const Palette &palette)
|
||||
_palette = palette;
|
||||
_palette.reset();
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
_graphs.at(i)->setColor(_palette.nextColor());
|
||||
QSet<GraphItem*> secondary;
|
||||
for (int i = 0; i < _graphs.count(); i++) {
|
||||
GraphItem *g = _graphs[i];
|
||||
if (g->secondaryGraph())
|
||||
secondary.insert(g->secondaryGraph());
|
||||
}
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++) {
|
||||
GraphItem *g = _graphs[i];
|
||||
if (secondary.contains(g))
|
||||
continue;
|
||||
|
||||
QColor color(_palette.nextColor());
|
||||
g->setColor(color);
|
||||
if (g->secondaryGraph())
|
||||
g->secondaryGraph()->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::setGraphWidth(int width)
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include "data/graph.h"
|
||||
#include "palette.h"
|
||||
#include "units.h"
|
||||
|
Loading…
Reference in New Issue
Block a user