Commit ff6ecfe6 authored by Bryant's avatar Bryant

Now update QGC to use the new Qwt 6.1 code.

I was unsure how to update the QwtPlotPrintFilter code, so I just commented it out with a FIXME.
parent c96458cf
...@@ -320,7 +320,9 @@ INCLUDEPATH += \ ...@@ -320,7 +320,9 @@ INCLUDEPATH += \
# #
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities. # [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
# #
include(libs/qwt/qwt.pri) include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
# #
# [REQUIRED] QSerialPort library. Provides serial port wrapper library. # [REQUIRED] QSerialPort library. Provides serial port wrapper library.
......
...@@ -172,19 +172,20 @@ void QGCDataPlot2D::print() ...@@ -172,19 +172,20 @@ void QGCDataPlot2D::print()
if ( dialog.exec() ) { if ( dialog.exec() ) {
plot->setStyleSheet("QWidget { background-color: #FFFFFF; color: #000000; background-clip: border; font-size: 10pt;}"); plot->setStyleSheet("QWidget { background-color: #FFFFFF; color: #000000; background-clip: border; font-size: 10pt;}");
plot->setCanvasBackground(Qt::white); plot->setCanvasBackground(Qt::white);
QwtPlotPrintFilter filter; // FIXME: QwtPlotPrintFilter no longer exists in Qwt 6.1
filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground); //QwtPlotPrintFilter filter;
filter.color(Qt::black, QwtPlotPrintFilter::AxisScale); //filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground);
filter.color(Qt::black, QwtPlotPrintFilter::AxisTitle); //filter.color(Qt::black, QwtPlotPrintFilter::AxisScale);
filter.color(Qt::black, QwtPlotPrintFilter::MajorGrid); //filter.color(Qt::black, QwtPlotPrintFilter::AxisTitle);
filter.color(Qt::black, QwtPlotPrintFilter::MinorGrid); //filter.color(Qt::black, QwtPlotPrintFilter::MajorGrid);
if ( printer.colorMode() == QPrinter::GrayScale ) { //filter.color(Qt::black, QwtPlotPrintFilter::MinorGrid);
int options = QwtPlotPrintFilter::PrintAll; //if ( printer.colorMode() == QPrinter::GrayScale ) {
options &= ~QwtPlotPrintFilter::PrintBackground; // int options = QwtPlotPrintFilter::PrintAll;
options |= QwtPlotPrintFilter::PrintFrameWithScales; // options &= ~QwtPlotPrintFilter::PrintBackground;
filter.setOptions(options); // options |= QwtPlotPrintFilter::PrintFrameWithScales;
} // filter.setOptions(options);
plot->print(printer, filter); //}
//plot->print(printer);
plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}");
//plot->setCanvasBackground(QColor(5, 5, 8)); //plot->setCanvasBackground(QColor(5, 5, 8));
} }
...@@ -210,6 +211,7 @@ void QGCDataPlot2D::exportPDF(QString fileName) ...@@ -210,6 +211,7 @@ void QGCDataPlot2D::exportPDF(QString fileName)
plot->setStyleSheet("QWidget { background-color: #FFFFFF; color: #000000; background-clip: border; font-size: 10pt;}"); plot->setStyleSheet("QWidget { background-color: #FFFFFF; color: #000000; background-clip: border; font-size: 10pt;}");
// plot->setCanvasBackground(Qt::white); // plot->setCanvasBackground(Qt::white);
// FIXME: QwtPlotPrintFilter no longer exists in Qwt 6.1
// QwtPlotPrintFilter filter; // QwtPlotPrintFilter filter;
// filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground); // filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground);
// filter.color(Qt::black, QwtPlotPrintFilter::AxisScale); // filter.color(Qt::black, QwtPlotPrintFilter::AxisScale);
...@@ -223,7 +225,7 @@ void QGCDataPlot2D::exportPDF(QString fileName) ...@@ -223,7 +225,7 @@ void QGCDataPlot2D::exportPDF(QString fileName)
// options |= QwtPlotPrintFilter::PrintFrameWithScales; // options |= QwtPlotPrintFilter::PrintFrameWithScales;
// filter.setOptions(options); // filter.setOptions(options);
// } // }
plot->print(printer);//, filter); //plot->print(printer);
plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}");
//plot->setCanvasBackground(QColor(5, 5, 8)); //plot->setCanvasBackground(QColor(5, 5, 8));
} }
...@@ -237,14 +239,15 @@ void QGCDataPlot2D::exportSVG(QString fileName) ...@@ -237,14 +239,15 @@ void QGCDataPlot2D::exportSVG(QString fileName)
generator.setFileName(fileName); generator.setFileName(fileName);
generator.setSize(QSize(800, 600)); generator.setSize(QSize(800, 600));
QwtPlotPrintFilter filter; // FIXME: QwtPlotPrintFilter no longer exists in Qwt 6.1
filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground); //QwtPlotPrintFilter filter;
filter.color(Qt::black, QwtPlotPrintFilter::AxisScale); //filter.color(Qt::white, QwtPlotPrintFilter::CanvasBackground);
filter.color(Qt::black, QwtPlotPrintFilter::AxisTitle); //filter.color(Qt::black, QwtPlotPrintFilter::AxisScale);
filter.color(Qt::black, QwtPlotPrintFilter::MajorGrid); //filter.color(Qt::black, QwtPlotPrintFilter::AxisTitle);
filter.color(Qt::black, QwtPlotPrintFilter::MinorGrid); //filter.color(Qt::black, QwtPlotPrintFilter::MajorGrid);
//filter.color(Qt::black, QwtPlotPrintFilter::MinorGrid);
plot->print(generator, filter); //plot->print(generator);
plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}");
} }
} }
......
...@@ -42,7 +42,7 @@ CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) : ...@@ -42,7 +42,7 @@ CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) :
set[i] = static_cast<double>((*setpoints)[i]); set[i] = static_cast<double>((*setpoints)[i]);
} }
curve->setData(pos, set); curve->setSamples(pos, set);
curve->attach(plot); curve->attach(plot);
plot->replot(); plot->replot();
...@@ -99,7 +99,7 @@ void CurveCalibrator::setSetpoint(int setpoint) ...@@ -99,7 +99,7 @@ void CurveCalibrator::setSetpoint(int setpoint)
set[i] = static_cast<double>((*setpoints)[i]); set[i] = static_cast<double>((*setpoints)[i]);
} }
curve->setData(pos, set); curve->setSamples(pos, set);
plot->replot(); plot->replot();
emit setpointChanged(setpoint, setpoints->value(setpoint)); emit setpointChanged(setpoint, setpoints->value(setpoint));
...@@ -118,7 +118,7 @@ void CurveCalibrator::set(const QVector<uint16_t> &data) ...@@ -118,7 +118,7 @@ void CurveCalibrator::set(const QVector<uint16_t> &data)
pos[i] = static_cast<double>((*positions)[i]); pos[i] = static_cast<double>((*positions)[i]);
set[i] = static_cast<double>((*setpoints)[i]); set[i] = static_cast<double>((*setpoints)[i]);
} }
curve->setData(pos, set); curve->setSamples(pos, set);
plot->replot(); plot->replot();
} else { } else {
qDebug() << __FILE__ << __LINE__ << ": wrong data vector size"; qDebug() << __FILE__ << __LINE__ << ": wrong data vector size";
......
...@@ -34,7 +34,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -34,7 +34,6 @@ This file is part of the QGROUNDCONTROL project
#include <QVector> #include <QVector>
#include <qwt_plot.h> #include <qwt_plot.h>
#include <qwt_plot_curve.h> #include <qwt_plot_curve.h>
//#include <qwt_array.h>
#include <QGridLayout> #include <QGridLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
......
...@@ -116,9 +116,8 @@ public: ...@@ -116,9 +116,8 @@ public:
return QwtDoubleRect(xmin,ymin,xmax-xmin,ymax-ymin); return QwtDoubleRect(xmin,ymin,xmax-xmin,ymax-ymin);
} }
protected:
/* From QwtPlotItem. Draw the complete series */ /* From QwtPlotItem. Draw the complete series */
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &canvasRect) const virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const
{ {
Q_UNUSED(canvasRect); Q_UNUSED(canvasRect);
QPointF lastPoint; QPointF lastPoint;
...@@ -151,7 +150,7 @@ protected: ...@@ -151,7 +150,7 @@ protected:
++smoothCount; ++smoothCount;
point = smoothTotal/smoothCount; point = smoothTotal/smoothCount;
} }
QPointF paintCoord = QPointF(xMap.xTransform(point.x()), yMap.xTransform(point.y())); QPointF paintCoord = QPointF(xMap.transform(point.x()), yMap.transform(point.y()));
m_color.setAlpha((m_maxShowPoints - count + i)*255/m_maxShowPoints); m_color.setAlpha((m_maxShowPoints - count + i)*255/m_maxShowPoints);
p->setPen(m_color); p->setPen(m_color);
if(i != 0) if(i != 0)
...@@ -246,7 +245,7 @@ QGCXYPlot::~QGCXYPlot() ...@@ -246,7 +245,7 @@ QGCXYPlot::~QGCXYPlot()
void QGCXYPlot::clearPlot() void QGCXYPlot::clearPlot()
{ {
xycurve->clear(); xycurve->clear();
plot->clear(); plot->detachItems();
ui->timeScrollBar->setMaximum(xycurve->dataSize()); ui->timeScrollBar->setMaximum(xycurve->dataSize());
ui->timeScrollBar->setValue(ui->timeScrollBar->maximum()); ui->timeScrollBar->setValue(ui->timeScrollBar->maximum());
} }
......
...@@ -41,7 +41,8 @@ ChartPlot::ChartPlot(QWidget *parent): ...@@ -41,7 +41,8 @@ ChartPlot::ChartPlot(QWidget *parent):
grid->attach(this); grid->attach(this);
// Enable zooming // Enable zooming
zoomer = new ScrollZoomer(canvas()); QwtPlotCanvas *c = static_cast<QwtPlotCanvas*>(canvas());
zoomer = new ScrollZoomer(c);
colors = QList<QColor>(); colors = QList<QColor>();
...@@ -113,8 +114,8 @@ void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style) ...@@ -113,8 +114,8 @@ void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style)
setCanvasBackground(QColor(0xFF, 0xFF, 0xFF)); setCanvasBackground(QColor(0xFF, 0xFF, 0xFF));
// Configure the plot grid. // Configure the plot grid.
grid->setMinPen(QPen(QColor(0x55, 0x55, 0x55), gridWidth, Qt::DotLine)); grid->setMinorPen(QPen(QColor(0x55, 0x55, 0x55), gridWidth, Qt::DotLine));
grid->setMajPen(QPen(QColor(0x22, 0x22, 0x22), gridWidth, Qt::DotLine)); grid->setMajorPen(QPen(QColor(0x22, 0x22, 0x22), gridWidth, Qt::DotLine));
} }
else else
{ {
...@@ -126,8 +127,8 @@ void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style) ...@@ -126,8 +127,8 @@ void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style)
setCanvasBackground(QColor(0, 0, 0)); setCanvasBackground(QColor(0, 0, 0));
// Configure the plot grid. // Configure the plot grid.
grid->setMinPen(QPen(QColor(0xAA, 0xAA, 0xAA), gridWidth, Qt::DotLine)); grid->setMinorPen(QPen(QColor(0xAA, 0xAA, 0xAA), gridWidth, Qt::DotLine));
grid->setMajPen(QPen(QColor(0xDD, 0xDD, 0xDD), gridWidth, Qt::DotLine)); grid->setMajorPen(QPen(QColor(0xDD, 0xDD, 0xDD), gridWidth, Qt::DotLine));
} }
// And finally refresh the widget to make sure all color changes are redrawn. // And finally refresh the widget to make sure all color changes are redrawn.
......
...@@ -132,7 +132,7 @@ void IncrementalPlot::showLegend(bool show) ...@@ -132,7 +132,7 @@ void IncrementalPlot::showLegend(bool show)
if (legend == NULL) { if (legend == NULL) {
legend = new QwtLegend; legend = new QwtLegend;
legend->setFrameStyle(QFrame::Box); legend->setFrameStyle(QFrame::Box);
legend->setItemMode(QwtLegend::CheckableItem); legend->setDefaultItemMode(QwtLegendData::Checkable);
} }
insertLegend(legend, QwtPlot::RightLegend); insertLegend(legend, QwtPlot::RightLegend);
} else { } else {
...@@ -168,30 +168,32 @@ void IncrementalPlot::updateStyle(QwtPlotCurve *curve) ...@@ -168,30 +168,32 @@ void IncrementalPlot::updateStyle(QwtPlotCurve *curve)
{ {
if(styleText.isNull()) if(styleText.isNull())
return; return;
// Style of datapoints
// Since the symbols always use the same color as the curve line, we just use that color.
// This saves us from having to deal with cases where the symbol is NULL.
QColor oldColor = curve->pen().color();
// Update the symbol style
QwtSymbol *newSymbol = NULL;
if (styleText.contains("circles")) { if (styleText.contains("circles")) {
curve->setSymbol(QwtSymbol(QwtSymbol::Ellipse, newSymbol = new QwtSymbol(QwtSymbol::Ellipse, Qt::NoBrush, QPen(oldColor, symbolWidth), QSize(6, 6));
Qt::NoBrush, QPen(QBrush(curve->symbol().pen().color()), symbolWidth), QSize(6, 6)) );
} else if (styleText.contains("crosses")) { } else if (styleText.contains("crosses")) {
curve->setSymbol(QwtSymbol(QwtSymbol::XCross, newSymbol = new QwtSymbol(QwtSymbol::XCross, Qt::NoBrush, QPen(oldColor, symbolWidth), QSize(5, 5));
Qt::NoBrush, QPen(QBrush(curve->symbol().pen().color()), symbolWidth), QSize(5, 5)) );
} else if (styleText.contains("rect")) { } else if (styleText.contains("rect")) {
curve->setSymbol(QwtSymbol(QwtSymbol::Rect, newSymbol = new QwtSymbol(QwtSymbol::Rect, Qt::NoBrush, QPen(oldColor, symbolWidth), QSize(6, 6));
Qt::NoBrush, QPen(QBrush(curve->symbol().pen().color()), symbolWidth), QSize(6, 6)) );
} else if (styleText.contains("line")) { // Show no symbol
curve->setSymbol(QwtSymbol(QwtSymbol::NoSymbol,
Qt::NoBrush, QPen(QBrush(curve->symbol().pen().color()), symbolWidth), QSize(6, 6)) );
} }
// Else-case already handled by NULL value, which indicates no symbol
curve->setSymbol(newSymbol);
// Style of lines // Update the line style
if (styleText.contains("dotted")) { if (styleText.contains("dotted")) {
curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::DotLine)); curve->setPen(QPen(oldColor, curveWidth, Qt::DotLine));
} else if (styleText.contains("dashed")) { } else if (styleText.contains("dashed")) {
curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::DashLine)); curve->setPen(QPen(oldColor, curveWidth, Qt::DashLine));
} else if (styleText.contains("line") || styleText.contains("solid")) { } else if (styleText.contains("line") || styleText.contains("solid")) {
curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::SolidLine)); curve->setPen(QPen(oldColor, curveWidth, Qt::SolidLine));
} else { } else {
curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::NoPen)); curve->setPen(QPen(oldColor, curveWidth, Qt::NoPen));
} }
curve->setStyle(QwtPlotCurve::Lines); curve->setStyle(QwtPlotCurve::Lines);
} }
...@@ -273,23 +275,27 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s ...@@ -273,23 +275,27 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s
data = d_data.value(key); data = d_data.value(key);
} }
// If this is a new curve, create it.
if (!curves.contains(key)) { if (!curves.contains(key)) {
curve = new QwtPlotCurve(key); curve = new QwtPlotCurve(key);
curves.insert(key, curve); curves.insert(key, curve);
curve->setStyle(QwtPlotCurve::NoCurve); curve->setStyle(QwtPlotCurve::NoCurve);
curve->setPaintAttribute(QwtPlotCurve::PaintFiltered); curve->setPaintAttribute(QwtPlotCurve::FilterPoints);
// Set the color. Only the pen needs to be set
const QColor &c = getNextColor(); const QColor &c = getNextColor();
curve->setSymbol(QwtSymbol(QwtSymbol::XCross, curve->setPen(c, symbolWidth);
QBrush(c), QPen(c, symbolWidth), QSize(5, 5)) );
updateStyle(curve); //Apply any user-set style qDebug() << "Creating curve" << key << "with color" << c;
updateStyle(curve);
curve->attach(this); curve->attach(this);
} else { } else {
curve = curves.value(key); curve = curves.value(key);
} }
data->append(x, y, size); data->append(x, y, size);
curve->setRawData(data->x(), data->y(), data->count()); curve->setRawSamples(data->x(), data->y(), data->count());
bool scaleChanged = false; bool scaleChanged = false;
...@@ -326,17 +332,10 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s ...@@ -326,17 +332,10 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s
updateScale(); updateScale();
} else { } else {
const bool cacheMode = QwtPlotCanvas *c = static_cast<QwtPlotCanvas*>(canvas());
canvas()->testPaintAttribute(QwtPlotCanvas::PaintCached); const bool cacheMode = c->testPaintAttribute(QwtPlotCanvas::BackingStore);
#if QT_VERSION >= 0x040000 && defined(Q_WS_X11)
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has an tremendous effect on the performance..
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
#endif
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); c->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
// FIXME Check if here all curves should be drawn // FIXME Check if here all curves should be drawn
// QwtPlotCurve* plotCurve; // QwtPlotCurve* plotCurve;
// foreach(plotCurve, curves) // foreach(plotCurve, curves)
...@@ -344,12 +343,11 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s ...@@ -344,12 +343,11 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s
// plotCurve->draw(0, curve->dataSize()-1); // plotCurve->draw(0, curve->dataSize()-1);
// } // }
curve->draw(curve->dataSize() - size, curve->dataSize() - 1); // FIXME: Unsure what this call should be now.
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, cacheMode); //curve->draw(curve->dataSize() - size, curve->dataSize() - 1);
replot();
c->setPaintAttribute(QwtPlotCanvas::BackingStore, cacheMode);
#if QT_VERSION >= 0x040000 && defined(Q_WS_X11)
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, false);
#endif
} }
} }
......
...@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project
#define INCREMENTALPLOT_H #define INCREMENTALPLOT_H
#include <QTimer> #include <QTimer>
#include <qwt_array.h>
#include <qwt_plot.h> #include <qwt_plot.h>
#include <qwt_legend.h> #include <qwt_legend.h>
#include <QMap> #include <QMap>
...@@ -59,8 +58,8 @@ public: ...@@ -59,8 +58,8 @@ public:
private: private:
int d_count; int d_count;
QwtArray<double> d_x; QVector<double> d_x;
QwtArray<double> d_y; QVector<double> d_y;
}; };
/** /**
......
...@@ -277,7 +277,7 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value) ...@@ -277,7 +277,7 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
// Assign dataset to curve // Assign dataset to curve
QwtPlotCurve* curve = curves.value(dataname); QwtPlotCurve* curve = curves.value(dataname);
curve->setRawData(dataset->getPlotX(), dataset->getPlotY(), dataset->getPlotCount()); curve->setRawSamples(dataset->getPlotX(), dataset->getPlotY(), dataset->getPlotCount());
// qDebug() << "mintime" << minTime << "maxtime" << maxTime << "last max time" << "window position" << getWindowPosition(); // qDebug() << "mintime" << minTime << "maxtime" << maxTime << "last max time" << "window position" << getWindowPosition();
...@@ -324,7 +324,7 @@ void LinechartPlot::addCurve(QString id) ...@@ -324,7 +324,7 @@ void LinechartPlot::addCurve(QString id)
curves.insert(id, curve); curves.insert(id, curve);
curve->setStyle(QwtPlotCurve::Lines); curve->setStyle(QwtPlotCurve::Lines);
curve->setPaintAttribute(QwtPlotCurve::PaintFiltered); curve->setPaintAttribute(QwtPlotCurve::FilterPoints, true);
setCurveColor(id, currentColor); setCurveColor(id, currentColor);
//curve->setBrush(currentColor); Leads to a filled curve //curve->setBrush(currentColor); Leads to a filled curve
// curve->setRenderHint(QwtPlotItem::RenderAntialiased); // curve->setRenderHint(QwtPlotItem::RenderAntialiased);
...@@ -468,10 +468,18 @@ void LinechartPlot::showCurve(QString id) ...@@ -468,10 +468,18 @@ void LinechartPlot::showCurve(QString id)
void LinechartPlot::setCurveColor(QString id, QColor color) void LinechartPlot::setCurveColor(QString id, QColor color)
{ {
QwtPlotCurve* curve = curves.value(id); QwtPlotCurve* curve = curves.value(id);
// Change the color of the curve.
curve->setPen(QPen(QBrush(color), curveWidth)); curve->setPen(QPen(QBrush(color), curveWidth));
QwtSymbol x = curve->symbol();
x.setPen(QPen(QBrush(color), symbolWidth)); qDebug() << "Setting curve" << id << "to" << color;
curve->setSymbol(x);
// And change the color of the symbol, making sure to preserve the symbol style
const QwtSymbol *oldSymbol = curve->symbol();
QwtSymbol *newSymbol = NULL;
if (oldSymbol) {
newSymbol = new QwtSymbol(oldSymbol->style(), QBrush(color), QPen(color, symbolWidth), QSize(symbolWidth, symbolWidth));
}
curve->setSymbol(newSymbol);
} }
/** /**
...@@ -609,7 +617,7 @@ quint64 LinechartPlot::getDataInterval() ...@@ -609,7 +617,7 @@ quint64 LinechartPlot::getDataInterval()
**/ **/
void LinechartPlot::setLogarithmicScaling() void LinechartPlot::setLogarithmicScaling()
{ {
yScaleEngine = new QwtLog10ScaleEngine(); yScaleEngine = new QwtLogScaleEngine();
setAxisScaleEngine(QwtPlot::yLeft, yScaleEngine); setAxisScaleEngine(QwtPlot::yLeft, yScaleEngine);
} }
...@@ -671,24 +679,6 @@ void LinechartPlot::paintRealtime() ...@@ -671,24 +679,6 @@ void LinechartPlot::paintRealtime()
windowLock.unlock(); windowLock.unlock();
// Defined both on windows 32- and 64 bit
#if !(defined Q_OS_WIN)
// const bool cacheMode =
// canvas()->testPaintAttribute(QwtPlotCanvas::PaintCached);
const bool oldDirectPaint =
canvas()->testAttribute(Qt::WA_PaintOutsidePaintEvent);
const QPaintEngine *pe = canvas()->paintEngine();
bool directPaint = pe->hasFeature(QPaintEngine::PaintOutsidePaintEvent);
//if ( pe->type() == QPaintEngine::X11 ) {
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has an tremendous effect on the performance..
directPaint = true;
//}
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, directPaint);
#endif
// Only set current view as zoombase if zoomer is not active // Only set current view as zoombase if zoomer is not active
// else we could not zoom out any more // else we could not zoom out any more
...@@ -698,10 +688,6 @@ void LinechartPlot::paintRealtime() ...@@ -698,10 +688,6 @@ void LinechartPlot::paintRealtime()
replot(); replot();
} }
#if !(defined Q_OS_WIN)
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, oldDirectPaint);
#endif
/* /*
QMap<QString, QwtPlotCurve*>::iterator i; QMap<QString, QwtPlotCurve*>::iterator i;
......
...@@ -45,7 +45,7 @@ This file is part of the PIXHAWK project ...@@ -45,7 +45,7 @@ This file is part of the PIXHAWK project
#include <qwt_scale_draw.h> #include <qwt_scale_draw.h>
#include <qwt_scale_widget.h> #include <qwt_scale_widget.h>
#include <qwt_scale_engine.h> #include <qwt_scale_engine.h>
#include <qwt_array.h> #include <qwt_compat.h>
#include <qwt_plot.h> #include <qwt_plot.h>
#include "ChartPlot.h" #include "ChartPlot.h"
#include "MG.h" #include "MG.h"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <qscrollview.h> #include <qscrollview.h>
#endif #endif
#include <qwt_plot_zoomer.h> #include <qwt_plot_zoomer.h>
#include <qwt_plot_canvas.h>
class ScrollData; class ScrollData;
class ScrollBar; class ScrollBar;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment