mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +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 <QGraphicsScene>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
@ -494,8 +495,23 @@ void GraphView::setPalette(const Palette &palette)
|
|||||||
_palette = palette;
|
_palette = palette;
|
||||||
_palette.reset();
|
_palette.reset();
|
||||||
|
|
||||||
for (int i = 0; i < _graphs.count(); i++)
|
QSet<GraphItem*> secondary;
|
||||||
_graphs.at(i)->setColor(_palette.nextColor());
|
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)
|
void GraphView::setGraphWidth(int width)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSet>
|
|
||||||
#include "data/graph.h"
|
#include "data/graph.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user