##// END OF EJS Templates
Compilation fix
Compilation fix

File last commit:

r232:ca5ae6ab9869
r232:ca5ae6ab9869
Show More
mainwidget.cpp
431 lines | 15.1 KiB | text/x-c | CppLexer
Tero Ahola
New features like chart type to the test app
r5 #include "mainwidget.h"
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 #include "dataseriedialog.h"
Tero Ahola
Added size factor property to pie
r60 #include "qchartseries.h"
#include "qpieseries.h"
Tero Ahola
Modifying QScatterSeries API
r179 #include "qscatterseries.h"
Michal Klocek
Fix previous broken commit
r145 #include <qlinechartseries.h>
sauimone
Barset and barcategory implememtation. Updated test application
r171 #include <qbarset.h>
#include <qbarcategory.h>
sauimone
Common naming convention for barcharts
r216 #include <qbarchartseries.h>
#include <qstackedbarchartseries.h>
#include <qpercentbarchartseries.h>
Tero Ahola
New features like chart type to the test app
r5 #include <QPushButton>
#include <QComboBox>
#include <QSpinBox>
Tero Ahola
Added auto scaling option to test app
r6 #include <QCheckBox>
Tero Ahola
New features like chart type to the test app
r5 #include <QGridLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QSpacerItem>
#include <QMessageBox>
Tero Ahola
Scatter data point now shown using a picture
r13 #include <cmath>
Tero Ahola
New features like chart type to the test app
r5 #include <QDebug>
sauimone
Added bar chart example
r78 #include <QStandardItemModel>
Tero Ahola
New features like chart type to the test app
r5
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_USE_NAMESPACE
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19
Tero Ahola
New features like chart type to the test app
r5 MainWidget::MainWidget(QWidget *parent) :
QWidget(parent)
{
Michal Klocek
Removes QChartWidget...
r136 m_chartWidget = new QChartView(this);
m_chartWidget->setRubberBandPolicy(QChartView::HorizonalRubberBand);
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77
Tero Ahola
Scaling for scatter series
r111 // Grid layout for the controls for configuring the chart widget
Tero Ahola
Refactored the test app
r110 QGridLayout *grid = new QGridLayout();
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 QPushButton *addSeriesButton = new QPushButton("Add series");
connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries()));
Tero Ahola
Refactored the test app
r110 grid->addWidget(addSeriesButton, 0, 1);
initBackroundCombo(grid);
initScaleControls(grid);
initThemeCombo(grid);
Tero Ahola
Scaling for scatter series
r111 QCheckBox *zoomCheckBox = new QCheckBox("Drag'n drop Zoom");
Tero Ahola
Refactored the test app
r110 connect(zoomCheckBox, SIGNAL(toggled(bool)), m_chartWidget, SLOT(setZoomEnabled(bool)));
zoomCheckBox->setChecked(true);
grid->addWidget(zoomCheckBox, grid->rowCount(), 0);
// add row with empty label to make all the other rows static
grid->addWidget(new QLabel(""), grid->rowCount(), 0);
grid->setRowStretch(grid->rowCount() - 1, 1);
Tero Ahola
Scaling for scatter series
r111
// Another grid layout as a main layout
QGridLayout *mainLayout = new QGridLayout();
Tero Ahola
Refactored the test app
r110 mainLayout->addLayout(grid, 0, 0);
// Init series type specific controls
initPieControls();
mainLayout->addLayout(m_pieLayout, 2, 0);
// Scatter series specific settings
// m_scatterLayout = new QGridLayout();
// m_scatterLayout->addWidget(new QLabel("scatter"), 0, 0);
// m_scatterLayout->setEnabled(false);
// mainLayout->addLayout(m_scatterLayout, 1, 0);
// Add layouts and the chart widget to the main layout
mainLayout->addWidget(m_chartWidget, 0, 1, 3, 1);
setLayout(mainLayout);
// force an update to test data
testDataChanged(0);
}
Tero Ahola
New features like chart type to the test app
r5
Tero Ahola
Refactored the test app
r110 // Combo box for selecting the chart's background
void MainWidget::initBackroundCombo(QGridLayout *grid)
{
Tero Ahola
New features like chart type to the test app
r5 QComboBox *backgroundCombo = new QComboBox(this);
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 backgroundCombo->addItem("Color");
backgroundCombo->addItem("Gradient");
backgroundCombo->addItem("Image");
Tero Ahola
New features like chart type to the test app
r5 connect(backgroundCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(backgroundChanged(int)));
Tero Ahola
Refactored the test app
r110 grid->addWidget(new QLabel("Background:"), grid->rowCount(), 0);
grid->addWidget(backgroundCombo, grid->rowCount() - 1, 1);
}
// Scale related controls (auto-scale vs. manual min-max values)
void MainWidget::initScaleControls(QGridLayout *grid)
{
Tero Ahola
Drafting scatter type plotting...
r8 m_autoScaleCheck = new QCheckBox("Automatic scaling");
connect(m_autoScaleCheck, SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)));
Tero Ahola
New features like chart type to the test app
r5 // Allow setting also non-sense values (like -2147483648 and 2147483647)
Tero Ahola
Added auto scaling option to test app
r6 m_xMinSpin = new QSpinBox();
m_xMinSpin->setMinimum(INT_MIN);
m_xMinSpin->setMaximum(INT_MAX);
m_xMinSpin->setValue(0);
connect(m_xMinSpin, SIGNAL(valueChanged(int)), this, SLOT(xMinChanged(int)));
m_xMaxSpin = new QSpinBox();
m_xMaxSpin->setMinimum(INT_MIN);
m_xMaxSpin->setMaximum(INT_MAX);
m_xMaxSpin->setValue(10);
connect(m_xMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(xMaxChanged(int)));
m_yMinSpin = new QSpinBox();
m_yMinSpin->setMinimum(INT_MIN);
m_yMinSpin->setMaximum(INT_MAX);
m_yMinSpin->setValue(0);
connect(m_yMinSpin, SIGNAL(valueChanged(int)), this, SLOT(yMinChanged(int)));
m_yMaxSpin = new QSpinBox();
m_yMaxSpin->setMinimum(INT_MIN);
m_yMaxSpin->setMaximum(INT_MAX);
m_yMaxSpin->setValue(10);
connect(m_yMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(yMaxChanged(int)));
Tero Ahola
New features like chart type to the test app
r5
Tero Ahola
Refactored the test app
r110 grid->addWidget(m_autoScaleCheck, grid->rowCount(), 0);
grid->addWidget(new QLabel("x min:"), grid->rowCount(), 0);
grid->addWidget(m_xMinSpin, grid->rowCount() - 1, 1);
grid->addWidget(new QLabel("x max:"), grid->rowCount(), 0);
grid->addWidget(m_xMaxSpin, grid->rowCount() - 1, 1);
grid->addWidget(new QLabel("y min:"), grid->rowCount(), 0);
grid->addWidget(m_yMinSpin, grid->rowCount() - 1, 1);
grid->addWidget(new QLabel("y max:"), grid->rowCount(), 0);
grid->addWidget(m_yMaxSpin, grid->rowCount() - 1, 1);
m_autoScaleCheck->setChecked(true);
}
// Combo box for selecting theme
void MainWidget::initThemeCombo(QGridLayout *grid)
{
Tero Ahola
Draft implementation for setting color themes for a chart
r64 QComboBox *chartTheme = new QComboBox();
Tero Ahola
Added theme named 'default'
r81 chartTheme->addItem("Default");
Tero Ahola
Draft implementation for setting color themes for a chart
r64 chartTheme->addItem("Vanilla");
chartTheme->addItem("Icy");
chartTheme->addItem("Grayscale");
Tero Ahola
tuning theme colors
r125 chartTheme->addItem("Scientific");
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 chartTheme->addItem("Unnamed1");
Tero Ahola
Draft implementation for setting color themes for a chart
r64 connect(chartTheme, SIGNAL(currentIndexChanged(int)),
this, SLOT(changeChartTheme(int)));
grid->addWidget(new QLabel("Chart theme:"), 8, 0);
grid->addWidget(chartTheme, 8, 1);
Tero Ahola
Refactored the test app
r110 }
Tero Ahola
Added size factor property to pie
r60
Tero Ahola
Refactored the test app
r110 void MainWidget::initPieControls()
{
// Pie series specific settings
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 // Pie size factory
Tero Ahola
Added size factor property to pie
r60 QDoubleSpinBox *pieSizeSpin = new QDoubleSpinBox();
pieSizeSpin->setMinimum(LONG_MIN);
pieSizeSpin->setMaximum(LONG_MAX);
pieSizeSpin->setValue(1.0);
pieSizeSpin->setSingleStep(0.1);
connect(pieSizeSpin, SIGNAL(valueChanged(double)), this, SLOT(setPieSizeFactor(double)));
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 // Pie position
QComboBox *piePosCombo = new QComboBox(this);
piePosCombo->addItem("Maximized");
piePosCombo->addItem("Top left");
piePosCombo->addItem("Top right");
piePosCombo->addItem("Bottom left");
piePosCombo->addItem("Bottom right");
connect(piePosCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(setPiePosition(int)));
m_pieLayout = new QGridLayout();
Tero Ahola
Added size factor property to pie
r60 m_pieLayout->setEnabled(false);
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 m_pieLayout->addWidget(new QLabel("Pie size factor"), 0, 0);
Tero Ahola
Added size factor property to pie
r60 m_pieLayout->addWidget(pieSizeSpin, 0, 1);
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77 m_pieLayout->addWidget(new QLabel("Pie position"), 1, 0);
m_pieLayout->addWidget(piePosCombo, 1, 1);
Tero Ahola
New features like chart type to the test app
r5 }
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 void MainWidget::addSeries()
{
Tero Ahola
Added size factor property to pie
r60 DataSerieDialog dialog(m_defaultSeriesName, this);
Tero Ahola
Test app now adds n data series of different type
r20 connect(&dialog, SIGNAL(accepted(QString, QString)), this, SLOT(addSeries(QString, QString)));
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 dialog.exec();
}
Tero Ahola
Test app now adds n data series of different type
r20 void MainWidget::addSeries(QString series, QString data)
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 {
Tero Ahola
Test app now adds n data series of different type
r20 qDebug() << "addSeries: " << series << " data: " << data;
Tero Ahola
Added size factor property to pie
r60 m_defaultSeriesName = series;
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48
Tero Ahola
Integrated scatter type series...
r42 // TODO: a dedicated data class for storing x and y values
QList<qreal> x;
QList<qreal> y;
Tero Ahola
Test app now adds n data series of different type
r20
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 QBarSet *set0 = new QBarSet;
QBarSet *set1 = new QBarSet;
QBarSet *set2 = new QBarSet;
QBarSet *set3 = new QBarSet;
QBarSet *set4 = new QBarSet;
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165
Tero Ahola
Test app now adds n data series of different type
r20 if (data == "linear") {
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 for (int i = 0; i < 20; i++) {
Tero Ahola
Integrated scatter type series...
r42 x.append(i);
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 y.append(i);
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Fixed compilation of test/example apps
r27 } else if (data == "linear, 1M") {
Tero Ahola
Added theme named 'default'
r81 // 1 million data points from 0.0001 to 100
// TODO: What is the requirement? Should we be able to show this kind of data with
// reasonable performance, or can we expect the application developer to do "data mining"
// for us, so that the count of data points given to QtCommercial Chart is always
// reasonable?
for (qreal i = 0; i < 100; i += 0.0001) {
Tero Ahola
Integrated scatter type series...
r42 x.append(i);
y.append(20);
}
Tero Ahola
Test app now adds n data series of different type
r20 } else if (data == "SIN") {
Tero Ahola
Integrated scatter type series...
r42 for (int i = 0; i < 100; i++) {
x.append(i);
y.append(abs(sin(3.14159265358979 / 50 * i) * 100));
}
Tero Ahola
Test app now adds n data series of different type
r20 } else if (data == "SIN + random") {
Tero Ahola
Integrated scatter type series...
r42 for (qreal i = 0; i < 100; i += 0.1) {
x.append(i + (rand() % 5));
y.append(abs(sin(3.14159265358979 / 50 * i) * 100) + (rand() % 5));
Tero Ahola
Test app now adds n data series of different type
r20 }
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 } else if (data == "Table, 5 series"){
sauimone
Barset and barcategory implememtation. Updated test application
r171 // Create some test data to chart
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12;
*set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2;
*set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5;
*set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7;
*set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6;
Tero Ahola
Test app now adds n data series of different type
r20 } else {
// TODO: check if data has a valid file name
Tero Ahola
Refactored series creation with QChart
r61 Q_ASSERT(false);
Tero Ahola
Test app now adds n data series of different type
r20 }
Tero Ahola
Integrated scatter type series...
r42 // TODO: color of the series
Tero Ahola
Refactored series creation with QChart
r61 QChartSeries *newSeries = 0;
Tero Ahola
Integrated scatter type series...
r42 if (series == "Scatter") {
Tero Ahola
added stream operator to scatter series
r180 QScatterSeries *scatter = new QScatterSeries();
Tero Ahola
Modifying QScatterSeries API
r179 for (int i(0); i < x.count() && i < y.count(); i++)
Tero Ahola
added stream operator to scatter series
r180 (*scatter) << QPointF(x.at(i), y.at(i));
m_chartWidget->addSeries(scatter);
Tero Ahola
Integrated draft version of pie series
r51 } else if (series == "Pie") {
Michal Klocek
Compilation fix
r232 newSeries = new QPieSeries();
m_chartWidget->addSeries(newSeries);
Tero Ahola
Refactored series creation with QChart
r61 Q_ASSERT(newSeries->setData(y));
Tero Ahola
Integrated scatter type series...
r42 } else if (series == "Line") {
Tero Ahola
Fixed line series usage in the test app
r65 // TODO: adding data to an existing line series does not give any visuals for some reason
// newSeries = m_chartWidget->createSeries(QChartSeries::SeriesTypeLine);
// QXYChartSeries *lineSeries = static_cast<QXYChartSeries *>(newSeries);
// lineSeries->setColor(Qt::blue);
// for (int i(0); i < x.count() && i < y.count(); i++) {
// lineSeries->add(x.at(i), y.at(i));
// }
//Q_ASSERT(newSeries->setData(x, y));
Michal Klocek
Clean up obsolete create metods in series
r156 QLineChartSeries* series0 = new QLineChartSeries();
Tero Ahola
Fixed line series usage in the test app
r65 for (int i(0); i < x.count() && i < y.count(); i++)
series0->add(x.at(i), y.at(i));
m_chartWidget->addSeries(series0);
newSeries = series0;
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 } else if (series == "Bar") {
qDebug() << "Bar chart series";
sauimone
Barset and barcategory implememtation. Updated test application
r171
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 QBarCategory *category = new QBarCategory;
*category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
sauimone
Barset and barcategory implememtation. Updated test application
r171
Michal Klocek
Compilation fix
r232 QBarChartSeries* series0 = new QBarChartSeries(category, this);
sauimone
Barset and barcategory implememtation. Updated test application
r171
series0->addBarSet(set0);
series0->addBarSet(set1);
series0->addBarSet(set2);
series0->addBarSet(set3);
series0->addBarSet(set4);
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 m_chartWidget->addSeries(series0);
newSeries = series0;
} else if (series == "StackedBar") {
sauimone
Barset and barcategory implememtation. Updated test application
r171 qDebug() << "Stacked bar chart series";
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 QBarCategory *category = new QBarCategory;
*category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
sauimone
Barset and barcategory implememtation. Updated test application
r171
Michal Klocek
Compilation fix
r232 QStackedBarChartSeries* series0 = new QStackedBarChartSeries(category, this);
sauimone
Barset and barcategory implememtation. Updated test application
r171
series0->addBarSet(set0);
series0->addBarSet(set1);
series0->addBarSet(set2);
series0->addBarSet(set3);
series0->addBarSet(set4);
sauimone
integrating bar charts to test app.. crashes for now
r164 m_chartWidget->addSeries(series0);
newSeries = series0;
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 } else if (series == "PercentBar") {
sauimone
Barset and barcategory implememtation. Updated test application
r171 qDebug() << "Percent bar chart series";
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 QBarCategory *category = new QBarCategory;
*category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
sauimone
Barset and barcategory implememtation. Updated test application
r171
Michal Klocek
Compilation fix
r232 QPercentBarChartSeries* series0 = new QPercentBarChartSeries(category, this);
sauimone
Barset and barcategory implememtation. Updated test application
r171
series0->addBarSet(set0);
series0->addBarSet(set1);
series0->addBarSet(set2);
series0->addBarSet(set3);
series0->addBarSet(set4);
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 m_chartWidget->addSeries(series0);
newSeries = series0;
} else {
qDebug() << "Something weird going on in MainWidget::addSeries";
sauimone
Refactored series creation.
r62 }
Tero Ahola
Added size factor property to pie
r60 setCurrentSeries(newSeries);
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 }
Tero Ahola
Added size factor property to pie
r60 void MainWidget::setCurrentSeries(QChartSeries *series)
Tero Ahola
New features like chart type to the test app
r5 {
Tero Ahola
added stream operator to scatter series
r180 if (series) {
m_currentSeries = series;
switch (m_currentSeries->type()) {
case QChartSeries::SeriesTypeLine:
break;
case QChartSeries::SeriesTypeScatter:
break;
case QChartSeries::SeriesTypePie:
break;
case QChartSeries::SeriesTypeBar:
qDebug() << "setCurrentSeries (bar)";
break;
case QChartSeries::SeriesTypeStackedBar:
qDebug() << "setCurrentSeries (Stackedbar)";
break;
case QChartSeries::SeriesTypePercentBar:
qDebug() << "setCurrentSeries (Percentbar)";
break;
default:
Q_ASSERT(false);
break;
}
Tero Ahola
Scatter data point now shown using a picture
r13 }
Tero Ahola
New features like chart type to the test app
r5 }
Tero Ahola
Added test data
r16 void MainWidget::testDataChanged(int itemIndex)
Tero Ahola
New features like chart type to the test app
r5 {
Tero Ahola
Added test data
r16 qDebug() << "testDataChanged: " << itemIndex;
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 // switch (itemIndex) {
// case 0: {
// QList<QChartDataPoint> data;
// for (int x = 0; x < 20; x++) {
// data.append(QChartDataPoint() << x << x / 2);
// }
// m_chartWidget->setData(data);
// break;
// }
// case 1: {
// QList<QChartDataPoint> data;
// for (int x = 0; x < 100; x++) {
// data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100));
// }
// m_chartWidget->setData(data);
// break;
// }
// case 2: {
// QList<QChartDataPoint> data;
// for (int x = 0; x < 1000; x++) {
// data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
// data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
// data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
// }
// m_chartWidget->setData(data);
// break;
// }
// default:
// break;
// }
Tero Ahola
New features like chart type to the test app
r5 }
void MainWidget::backgroundChanged(int itemIndex)
{
qDebug() << "backgroundChanged: " << itemIndex;
}
Tero Ahola
Added auto scaling option to test app
r6 void MainWidget::autoScaleChanged(int value)
{
Tero Ahola
Drafting scatter type plotting...
r8 if (value) {
// TODO: enable auto scaling
} else {
// TODO: set scaling manually (and disable auto scaling)
Tero Ahola
Added auto scaling option to test app
r6 }
Tero Ahola
Drafting scatter type plotting...
r8 m_xMinSpin->setEnabled(!value);
m_xMaxSpin->setEnabled(!value);
m_yMinSpin->setEnabled(!value);
m_yMaxSpin->setEnabled(!value);
Tero Ahola
Added auto scaling option to test app
r6 }
Tero Ahola
New features like chart type to the test app
r5 void MainWidget::xMinChanged(int value)
{
qDebug() << "xMinChanged: " << value;
}
void MainWidget::xMaxChanged(int value)
{
qDebug() << "xMaxChanged: " << value;
}
void MainWidget::yMinChanged(int value)
{
qDebug() << "yMinChanged: " << value;
}
void MainWidget::yMaxChanged(int value)
{
qDebug() << "yMaxChanged: " << value;
}
Tero Ahola
Added size factor property to pie
r60
Tero Ahola
Draft implementation for setting color themes for a chart
r64 void MainWidget::changeChartTheme(int themeIndex)
{
qDebug() << "changeChartTheme: " << themeIndex;
Michal Klocek
minor. compilation fix for test widget
r154 m_chartWidget->setChartTheme((QChart::ChartTheme) themeIndex);
sauimone
added labels to series, intergrated with test app. minor hack to test app
r167 //TODO: remove this hack. This is just to make it so that theme change is seen immediately.
QSize s = size();
s.setWidth(s.width()+1);
resize(s);
Tero Ahola
Draft implementation for setting color themes for a chart
r64 }
Tero Ahola
Added size factor property to pie
r60 void MainWidget::setPieSizeFactor(double size)
{
QPieSeries *pie = qobject_cast<QPieSeries *>(m_currentSeries);
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 if (pie)
pie->setSizeFactor(qreal(size));
Tero Ahola
Added size factor property to pie
r60 }
Tero Ahola
Theme now affects background, enabled zoom by default in QChartWidget
r77
void MainWidget::setPiePosition(int position)
{
QPieSeries *pie = qobject_cast<QPieSeries *>(m_currentSeries);
if (pie)
pie->setPosition((QPieSeries::PiePosition) position);
Tero Ahola
Added size factor property to pie
r60 }