From 3ff20044e0317b28b6279539af10012d0ef7e15c Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Wed, 27 Jan 2016 21:19:53 +0100 Subject: [PATCH] Plot: Minor code improvement Use the actual data for type guessing, i.e. nothing for NULL values instead of 'NULL'. This should be a bit simpler and faster and overall more correct (even though it doesn't change the behaviour at all). --- src/MainWindow.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index e513d82e..e4aa4fe2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1632,7 +1632,7 @@ QVariant::Type guessdatatype(SqliteTableModel* model, int column) QVariant::Type type = QVariant::Invalid; for(int i = 0; i < std::min(10, model->rowCount()) && type != QVariant::String; ++i) { - QVariant data = model->data(model->index(i, column)); + QVariant data = model->data(model->index(i, column), Qt::EditRole); if(data.convert(QVariant::Double)) { type = QVariant::Double; @@ -1797,8 +1797,7 @@ void MainWindow::updatePlot(SqliteTableModel *model, bool update) ydata[i] = model->data(model->index(i, y)).toDouble(); } - // set some graph styles, this could also be improved to let the user choose - // some styling + // set some graph styles graph->setData(xdata, ydata); graph->setLineStyle((QCPGraph::LineStyle) ui->comboLineType->currentIndex()); // WARN: ssDot is removed