diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-04-16 10:07:13 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-04-17 10:14:43 +0300 |
commit | f494279b6366b06e3eeeb4f8c006ce76b08f10d7 (patch) | |
tree | 26951efa14e26eb0791d13ea32624e9afcf48851 /tests/polarcharttest | |
parent | 56fd46a395765db6818f890676e42cc59a9f4a81 (diff) |
Add Polar chart support
This commit also heavily refactors things as polar chart needs
separate implementation of various classes that previously
only needed one, such as ChartAxis and ChartLayout.
Task-number: QTRD-1757
Change-Id: I3d3db23920314987ceef3ae92879960b833b7136
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'tests/polarcharttest')
-rw-r--r-- | tests/polarcharttest/chartview.cpp | 58 | ||||
-rw-r--r-- | tests/polarcharttest/chartview.h | 38 | ||||
-rw-r--r-- | tests/polarcharttest/main.cpp | 31 | ||||
-rw-r--r-- | tests/polarcharttest/mainwindow.cpp | 1136 | ||||
-rw-r--r-- | tests/polarcharttest/mainwindow.h | 155 | ||||
-rw-r--r-- | tests/polarcharttest/mainwindow.ui | 929 | ||||
-rw-r--r-- | tests/polarcharttest/polarcharttest.pro | 20 |
7 files changed, 2367 insertions, 0 deletions
diff --git a/tests/polarcharttest/chartview.cpp b/tests/polarcharttest/chartview.cpp new file mode 100644 index 00000000..4c8c5779 --- /dev/null +++ b/tests/polarcharttest/chartview.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chartview.h" +#include <QMouseEvent> +#include <QDebug> +#include <QAbstractAxis> + +QTCOMMERCIALCHART_USE_NAMESPACE + +ChartView::ChartView(QWidget *parent) : + QChartView(parent) +{ +} + +void ChartView::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Plus: + chart()->zoomIn(); + break; + case Qt::Key_Minus: + chart()->zoomOut(); + break; + case Qt::Key_Left: + chart()->scroll(-1.0, 0); + break; + case Qt::Key_Right: + chart()->scroll(1.0, 0); + break; + case Qt::Key_Up: + chart()->scroll(0, 1.0); + break; + case Qt::Key_Down: + chart()->scroll(0, -1.0); + break; + default: + QGraphicsView::keyPressEvent(event); + break; + } +} diff --git a/tests/polarcharttest/chartview.h b/tests/polarcharttest/chartview.h new file mode 100644 index 00000000..82528c29 --- /dev/null +++ b/tests/polarcharttest/chartview.h @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHARTVIEW_H +#define CHARTVIEW_H + +#include <QChartView> +#include <QPolarChart> + +QTCOMMERCIALCHART_USE_NAMESPACE + +class ChartView : public QChartView +{ +public: + ChartView(QWidget *parent = 0); + +protected: + void keyPressEvent(QKeyEvent *event); +}; + +#endif diff --git a/tests/polarcharttest/main.cpp b/tests/polarcharttest/main.cpp new file mode 100644 index 00000000..30db2e25 --- /dev/null +++ b/tests/polarcharttest/main.cpp @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/tests/polarcharttest/mainwindow.cpp b/tests/polarcharttest/mainwindow.cpp new file mode 100644 index 00000000..7e6cef04 --- /dev/null +++ b/tests/polarcharttest/mainwindow.cpp @@ -0,0 +1,1136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include "chartview.h" +#include <QScatterSeries> +#include <QLineSeries> +#include <QSplineSeries> +#include <QAreaSeries> +#include <QBarSeries> +#include <QBarSet> +#include <QValueAxis> +#include <QLogValueAxis> +#include <QDateTimeAxis> +#include <QCategoryAxis> +#include <QPolarChart> +#include <QDebug> +#include <qmath.h> +#include <QDateTime> + +QTCOMMERCIALCHART_USE_NAMESPACE +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), + m_angularTickCount(9), + m_radialTickCount(11), + m_labelsAngle(0), + m_angularMin(0.0), + m_angularMax(40000.0), + m_radialMin(0.0), + m_radialMax(30000.0), + m_angularShadesVisible(false), + m_radialShadesVisible(false), + m_labelsVisible(true), + m_titleVisible(true), + m_gridVisible(true), + m_arrowVisible(true), + m_angularShadesBrush(new QBrush(Qt::NoBrush)), + m_radialShadesBrush(new QBrush(Qt::NoBrush)), + m_labelBrush(new QBrush(Qt::black)), + m_titleBrush(new QBrush(Qt::black)), + m_angularShadesPen(new QPen(Qt::NoPen)), + m_radialShadesPen(new QPen(Qt::NoPen)), + m_labelPen(new QPen(Qt::NoPen)), + m_titlePen(new QPen(Qt::NoPen)), + m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by + m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround. + m_labelFormat(QString("%.2f")), + m_animationOptions(QChart::NoAnimation), + m_angularTitle(QString("Angular Title")), + m_radialTitle(QString("Radial Title")), + m_base(2.0), + m_chart(0), + m_angularAxis(0), + m_radialAxis(0), + m_angularAxisMode(AxisModeNone), + m_radialAxisMode(AxisModeNone), + m_series1(0), + m_series2(0), + m_series3(0), + m_series4(0), + m_series5(0), + m_series6(0), + m_series7(0), + m_dateFormat(QString("mm-ss-zzz")), + m_moreCategories(false) +{ + ui->setupUi(this); + + ui->angularTicksSpin->setValue(m_angularTickCount); + ui->radialTicksSpin->setValue(m_radialTickCount); + ui->anglesSpin->setValue(m_labelsAngle); + ui->radialMinSpin->setValue(m_radialMin); + ui->radialMaxSpin->setValue(m_radialMax); + ui->angularMinSpin->setValue(m_angularMin); + ui->angularMaxSpin->setValue(m_angularMax); + ui->angularShadesComboBox->setCurrentIndex(0); + ui->radialShadesComboBox->setCurrentIndex(0); + ui->labelFormatEdit->setText(m_labelFormat); + ui->dateFormatEdit->setText(m_dateFormat); + ui->moreCategoriesCheckBox->setChecked(m_moreCategories); + + ui->series1checkBox->setChecked(true); + ui->series2checkBox->setChecked(true); + ui->series3checkBox->setChecked(true); + ui->series4checkBox->setChecked(true); + ui->series5checkBox->setChecked(true); + ui->series6checkBox->setChecked(true); + ui->series7checkBox->setChecked(true); + + m_currentLabelFont.setFamily(ui->labelFontComboBox->currentFont().family()); + m_currentLabelFont.setPixelSize(15); + m_currentTitleFont.setFamily(ui->titleFontComboBox->currentFont().family()); + m_currentTitleFont.setPixelSize(30); + + ui->labelFontSizeSpin->setValue(m_currentLabelFont.pixelSize()); + ui->titleFontSizeSpin->setValue(m_currentTitleFont.pixelSize()); + + ui->logBaseSpin->setValue(m_base); + + initXYValueChart(); + setAngularAxis(AxisModeValue); + setRadialAxis(AxisModeValue); + + ui->angularAxisComboBox->setCurrentIndex(int(m_angularAxisMode)); + ui->radialAxisComboBox->setCurrentIndex(int(m_radialAxisMode)); + + connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularTicksChanged(int))); + connect(ui->radialTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(radialTicksChanged(int))); + connect(ui->anglesSpin, SIGNAL(valueChanged(int)), this, SLOT(anglesChanged(int))); + connect(ui->radialMinSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMinChanged(double))); + connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMaxChanged(double))); + connect(ui->angularMinSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMinChanged(double))); + connect(ui->angularMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMaxChanged(double))); + connect(ui->angularShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularShadesIndexChanged(int))); + connect(ui->radialShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialShadesIndexChanged(int))); + connect(ui->animationsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(animationIndexChanged(int))); + connect(ui->labelFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(labelFormatEdited(QString))); + connect(ui->labelFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(labelFontChanged(QFont))); + connect(ui->labelFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(labelFontSizeChanged(int))); + connect(ui->labelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(labelsIndexChanged(int))); + connect(ui->titleFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(titleFontChanged(QFont))); + connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(titleFontSizeChanged(int))); + connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(titleIndexChanged(int))); + connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridIndexChanged(int))); + connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(arrowIndexChanged(int))); + connect(ui->logBaseSpin, SIGNAL(valueChanged(double)), this, SLOT(logBaseChanged(double))); + connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularAxisIndexChanged(int))); + connect(ui->radialAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialAxisIndexChanged(int))); + connect(ui->niceNumbersCheckBox, SIGNAL(clicked()), this, SLOT(niceNumbersChecked())); + connect(ui->dateFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(dateFormatEdited(QString))); + connect(ui->moreCategoriesCheckBox, SIGNAL(clicked()), this, SLOT(moreCategoriesChecked())); + connect(ui->series1checkBox, SIGNAL(clicked()), this, SLOT(series1CheckBoxChecked())); + connect(ui->series2checkBox, SIGNAL(clicked()), this, SLOT(series2CheckBoxChecked())); + connect(ui->series3checkBox, SIGNAL(clicked()), this, SLOT(series3CheckBoxChecked())); + connect(ui->series4checkBox, SIGNAL(clicked()), this, SLOT(series4CheckBoxChecked())); + connect(ui->series5checkBox, SIGNAL(clicked()), this, SLOT(series5CheckBoxChecked())); + connect(ui->series6checkBox, SIGNAL(clicked()), this, SLOT(series6CheckBoxChecked())); + connect(ui->series7checkBox, SIGNAL(clicked()), this, SLOT(series7CheckBoxChecked())); + connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeIndexChanged(int))); + + ui->chartView->setChart(m_chart); + ui->chartView->setRenderHint(QPainter::Antialiasing); +} + +MainWindow::~MainWindow() +{ + delete ui; + delete m_angularShadesBrush; + delete m_radialShadesBrush; + delete m_angularShadesPen; + delete m_radialShadesPen; +} + +void MainWindow::initXYValueChart() +{ + qreal seriesAngularMin = 1; + qreal seriesAngularMax = 46000; + qreal seriesRadialMin = 1; + qreal seriesRadialMax = 23500; + qreal radialDimension = seriesRadialMax - seriesRadialMin; + qreal angularDimension = seriesAngularMax - seriesAngularMin; + + // Scatter series, points outside min-max ranges should not be drawn + m_series1 = new QScatterSeries(); + m_series1->setName("scatter"); + qreal scatterCount = 10; + qreal scatterAngularStep = angularDimension / scatterCount; + qreal scatterRadialStep = radialDimension / scatterCount; + for (qreal i = 0.0; i < scatterCount; i++) { + m_series1->append((i * scatterAngularStep) + seriesAngularMin, (i * scatterRadialStep) + seriesRadialMin); + //qDebug() << m_series1->points().last(); + } + m_series1->setMarkerSize(10); + *m_series1 << QPointF(50, 50) << QPointF(150, 150) << QPointF(250, 250) << QPointF(350, 350) << QPointF(450, 450); + *m_series1 << QPointF(1050, 0.50) << QPointF(1150, 0.25) << QPointF(1250, 0.12) << QPointF(1350, 0.075) << QPointF(1450, 0.036); + *m_series1 << QPointF(0.50, 2000) << QPointF(0.25, 3500) << QPointF(0.12, 5000) << QPointF(0.075, 6500) << QPointF(0.036, 8000); + + // Line series, points outside min-max ranges should not be drawn, + // but lines should be properly interpolated at chart edges + m_series2 = new QLineSeries(); + m_series2->setName("line 1"); + qreal lineCount = 100; + qreal lineAngularStep = angularDimension / lineCount; + qreal lineRadialStep = radialDimension / lineCount; + for (qreal i = 0.0; i < lineCount; i++) { + m_series2->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin); + //qDebug() << m_series2->points().last(); + } + QPen series2Pen = QPen(Qt::blue, 10); + //series2Pen.setStyle(Qt::DashDotDotLine); + m_series2->setPen(series2Pen); + + m_series3 = new QLineSeries(); + m_series3->setName("Area upper"); + lineCount = 87; + lineAngularStep = angularDimension / lineCount; + lineRadialStep = radialDimension / lineCount; + for (qreal i = 1.0; i <= lineCount; i++) { + m_series3->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin + 200.0); + //qDebug() << m_series3->points().last(); + } + + m_series4 = new QLineSeries(); + m_series4->setName("Area lower"); + lineCount = 89; + lineAngularStep = angularDimension / lineCount; + lineRadialStep = radialDimension / lineCount; + for (qreal i = 1.0; i <= lineCount; i++) { + m_series4->append((i * lineAngularStep) + seriesAngularMin + 100.0, (i * lineRadialStep) + seriesRadialMin + i * 300.0); + //qDebug() << m_series4->points().last(); + } + + m_series5 = new QAreaSeries(); + m_series5->setName("area"); + m_series5->setUpperSeries(m_series3); + m_series5->setLowerSeries(m_series4); + m_series5->setOpacity(0.5); + + m_series6 = new QSplineSeries(); + m_series6->setName("spline"); + qreal ad = angularDimension / 20; + qreal rd = radialDimension / 10; + m_series6->append(seriesAngularMin, seriesRadialMin + rd * 2); + m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 5); + m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 4); + m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 11); + m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); + m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 11); + m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 12); + m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); + m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 8); + m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 11); + m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 12); + m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 3); + m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 2); + m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 20, seriesRadialMin + rd * 6); + m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 2); + m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 7); + m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 3); + m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 1); + m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 7); + m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 5); + m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 1); + m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); + m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 1); + m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 2); + m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 4); + m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 8); + m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); + m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 9); + m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 8); + m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 7); + m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 4); + m_series6->append(seriesAngularMin, seriesRadialMin + rd * 10); + + m_series6->setPointsVisible(true); + QPen series6Pen = QPen(Qt::red, 10); + //series6Pen.setStyle(Qt::DashDotDotLine); + m_series6->setPen(series6Pen); + + // m_series7 shows points at category intersections + m_series7 = new QScatterSeries(); + m_series7->setName("Category check"); + m_series7->setMarkerSize(7); + m_series7->setBrush(QColor(Qt::red)); + m_series7->setMarkerShape(QScatterSeries::MarkerShapeRectangle); + *m_series7 << QPointF(1000, 1000) + << QPointF(1000, 2000) + << QPointF(1000, 4000) + << QPointF(1000, 9000) + << QPointF(1000, 14000) + << QPointF(1000, 16500) + << QPointF(1000, 19000) + + << QPointF(4000, 1000) + << QPointF(4000, 2000) + << QPointF(4000, 4000) + << QPointF(4000, 9000) + << QPointF(4000, 14000) + << QPointF(4000, 16500) + << QPointF(4000, 19000) + + << QPointF(7000, 1000) + << QPointF(7000, 2000) + << QPointF(7000, 4000) + << QPointF(7000, 9000) + << QPointF(7000, 14000) + << QPointF(7000, 16500) + << QPointF(7000, 19000) + + << QPointF(12000, 1000) + << QPointF(12000, 2000) + << QPointF(12000, 4000) + << QPointF(12000, 9000) + << QPointF(12000, 14000) + << QPointF(12000, 16500) + << QPointF(12000, 19000) + + << QPointF(17000, 1000) + << QPointF(17000, 2000) + << QPointF(17000, 4000) + << QPointF(17000, 9000) + << QPointF(17000, 14000) + << QPointF(17000, 16500) + << QPointF(17000, 19000) + + << QPointF(22000, 1000) + << QPointF(22000, 2000) + << QPointF(22000, 4000) + << QPointF(22000, 9000) + << QPointF(22000, 14000) + << QPointF(22000, 16500) + << QPointF(22000, 19000) + + << QPointF(28000, 1000) + << QPointF(28000, 2000) + << QPointF(28000, 4000) + << QPointF(28000, 9000) + << QPointF(28000, 14000) + << QPointF(28000, 16500) + << QPointF(28000, 19000); + + m_chart = new QPolarChart(); + + m_chart->addSeries(m_series1); + m_chart->addSeries(m_series2); + m_chart->addSeries(m_series3); + m_chart->addSeries(m_series4); + m_chart->addSeries(m_series5); + m_chart->addSeries(m_series6); + m_chart->addSeries(m_series7); + + connect(m_series1, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series2, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series3, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series4, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series5, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series6, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series7, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); + connect(m_series1, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series3, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series4, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series5, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series6, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + connect(m_series7, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); + + m_chart->setTitle("Use arrow keys to scroll and +/- to zoom"); + m_chart->setAnimationOptions(m_animationOptions); + //m_chart->legend()->setVisible(false); + m_chart->setAcceptHoverEvents(true); +} + +void MainWindow::setAngularAxis(MainWindow::AxisMode mode) +{ + if (m_angularAxis) { + m_chart->removeAxis(m_angularAxis); + delete m_angularAxis; + m_angularAxis = 0; + } + + m_angularAxisMode = mode; + + switch (m_angularAxisMode) { + case AxisModeNone: + return; + case AxisModeValue: + m_angularAxis = new QValueAxis(); + static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); + static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); + break; + case AxisModeLogValue: + m_angularAxis = new QLogValueAxis(); + static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); + static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); + break; + case AxisModeDateTime: + m_angularAxis = new QDateTimeAxis(); + static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); + static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); + break; + case AxisModeCategory: + m_angularAxis = new QCategoryAxis(); + applyCategories(); + break; + default: + qWarning() << "Unsupported AxisMode"; + break; + } + + m_angularAxis->setLabelsAngle(m_labelsAngle); + m_angularAxis->setLabelsFont(m_currentLabelFont); + m_angularAxis->setLabelsBrush(*m_labelBrush); + m_angularAxis->setLabelsPen(*m_labelPen); + m_angularAxis->setLabelsVisible(m_labelsVisible); + m_angularAxis->setShadesBrush(*m_angularShadesBrush); + m_angularAxis->setShadesPen(*m_angularShadesPen); + m_angularAxis->setShadesVisible(m_angularShadesVisible); + m_angularAxis->setTitleFont(m_currentTitleFont); + m_angularAxis->setTitleBrush(*m_titleBrush); + m_angularAxis->setTitlePen(*m_titlePen); + m_angularAxis->setTitleVisible(m_titleVisible); + m_angularAxis->setTitleText(m_angularTitle); + m_angularAxis->setGridLinePen(*m_gridPen); + m_angularAxis->setGridLineVisible(m_gridVisible); + m_angularAxis->setLinePen(*m_arrowPen); + m_angularAxis->setLineVisible(m_arrowVisible); + + m_chart->addAxis(m_angularAxis, QPolarChart::PolarOrientationAngular); + + m_series1->attachAxis(m_angularAxis); + m_series2->attachAxis(m_angularAxis); + m_series3->attachAxis(m_angularAxis); + m_series4->attachAxis(m_angularAxis); + m_series5->attachAxis(m_angularAxis); + m_series6->attachAxis(m_angularAxis); + m_series7->attachAxis(m_angularAxis); + + applyRanges(); + + //connect(m_angularAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(angularRangeChanged(qreal, qreal))); +} + +void MainWindow::setRadialAxis(MainWindow::AxisMode mode) +{ + if (m_radialAxis) { + m_chart->removeAxis(m_radialAxis); + delete m_radialAxis; + m_radialAxis = 0; + } + + m_radialAxisMode = mode; + + switch (m_radialAxisMode) { + case AxisModeNone: + return; + case AxisModeValue: + m_radialAxis = new QValueAxis(); + static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); + static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); + break; + case AxisModeLogValue: + m_radialAxis = new QLogValueAxis(); + static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); + static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); + break; + case AxisModeDateTime: + m_radialAxis = new QDateTimeAxis(); + static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); + static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); + break; + case AxisModeCategory: + m_radialAxis = new QCategoryAxis(); + applyCategories(); + break; + default: + qWarning() << "Unsupported AxisMode"; + break; + } + + m_radialAxis->setLabelsAngle(m_labelsAngle); + m_radialAxis->setLabelsFont(m_currentLabelFont); + m_radialAxis->setLabelsBrush(*m_labelBrush); + m_radialAxis->setLabelsPen(*m_labelPen); + m_radialAxis->setLabelsVisible(m_labelsVisible); + m_radialAxis->setShadesBrush(*m_radialShadesBrush); + m_radialAxis->setShadesPen(*m_radialShadesPen); + m_radialAxis->setShadesVisible(m_radialShadesVisible); + m_radialAxis->setTitleFont(m_currentTitleFont); + m_radialAxis->setTitleBrush(*m_titleBrush); + m_radialAxis->setTitlePen(*m_titlePen); + m_radialAxis->setTitleVisible(m_titleVisible); + m_radialAxis->setTitleText(m_radialTitle); + m_radialAxis->setGridLinePen(*m_gridPen); + m_radialAxis->setGridLineVisible(m_gridVisible); + m_radialAxis->setLinePen(*m_arrowPen); + m_radialAxis->setLineVisible(m_arrowVisible); + + m_chart->addAxis(m_radialAxis, QPolarChart::PolarOrientationRadial); + + m_series1->attachAxis(m_radialAxis); + m_series2->attachAxis(m_radialAxis); + m_series3->attachAxis(m_radialAxis); + m_series4->attachAxis(m_radialAxis); + m_series5->attachAxis(m_radialAxis); + m_series6->attachAxis(m_radialAxis); + m_series7->attachAxis(m_radialAxis); + + applyRanges(); + + series1CheckBoxChecked(); + series2CheckBoxChecked(); + series3CheckBoxChecked(); + series4CheckBoxChecked(); + series5CheckBoxChecked(); + series6CheckBoxChecked(); + series7CheckBoxChecked(); + + //connect(m_radialAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(radialRangeChanged(qreal, qreal))); +} + +void MainWindow::applyRanges() +{ + if (ui->niceNumbersCheckBox->isChecked()) { + if (m_angularAxisMode == AxisModeValue) { + static_cast<QValueAxis *>(m_angularAxis)->applyNiceNumbers(); + m_angularMin = static_cast<QValueAxis *>(m_angularAxis)->min(); + m_angularMax = static_cast<QValueAxis *>(m_angularAxis)->max(); + m_angularTickCount = static_cast<QValueAxis *>(m_angularAxis)->tickCount(); + } + if (m_radialAxisMode == AxisModeValue) { + static_cast<QValueAxis *>(m_radialAxis)->applyNiceNumbers(); + m_radialMin = static_cast<QValueAxis *>(m_radialAxis)->min(); + m_radialMax = static_cast<QValueAxis *>(m_radialAxis)->max(); + m_radialTickCount = static_cast<QValueAxis *>(m_radialAxis)->tickCount(); + } + } + + if (m_angularAxis) + m_angularAxis->setRange(m_angularMin, m_angularMax); + if (m_radialAxis) + m_radialAxis->setRange(m_radialMin, m_radialMax); +} + +void MainWindow::angularTicksChanged(int value) +{ + m_angularTickCount = value; + if (m_angularAxisMode == AxisModeValue) + static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); + else if (m_angularAxisMode == AxisModeDateTime) + static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); +} + +void MainWindow::radialTicksChanged(int value) +{ + m_radialTickCount = value; + if (m_radialAxisMode == AxisModeValue) + static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); + else if (m_radialAxisMode == AxisModeDateTime) + static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); +} + +void MainWindow::anglesChanged(int value) +{ + m_labelsAngle = value; + m_radialAxis->setLabelsAngle(m_labelsAngle); + m_angularAxis->setLabelsAngle(m_labelsAngle); +} + +void MainWindow::angularMinChanged(double value) +{ + m_angularMin = value; + if (m_angularAxisMode != AxisModeDateTime) { + m_angularAxis->setMin(m_angularMin); + } else { + QDateTime dateTime; + dateTime.setMSecsSinceEpoch(qint64(m_angularMin)); + m_angularAxis->setMin(dateTime); + } +} + +void MainWindow::angularMaxChanged(double value) +{ + m_angularMax = value; + if (m_angularAxisMode != AxisModeDateTime) { + m_angularAxis->setMax(m_angularMax); + } else { + QDateTime dateTime; + dateTime.setMSecsSinceEpoch(qint64(m_angularMax)); + m_angularAxis->setMax(dateTime); + } +} + +void MainWindow::radialMinChanged(double value) +{ + m_radialMin = value; + if (m_radialAxisMode != AxisModeDateTime) { + m_radialAxis->setMin(m_radialMin); + } else { + QDateTime dateTime; + dateTime.setMSecsSinceEpoch(qint64(m_radialMin)); + m_radialAxis->setMin(dateTime); + } +} + +void MainWindow::radialMaxChanged(double value) +{ + m_radialMax = value; + if (m_radialAxisMode != AxisModeDateTime) { + m_radialAxis->setMax(m_radialMax); + } else { + QDateTime dateTime; + dateTime.setMSecsSinceEpoch(qint64(m_radialMax)); + m_radialAxis->setMax(dateTime); + } +} + +void MainWindow::angularShadesIndexChanged(int index) +{ + delete m_angularShadesBrush; + delete m_angularShadesPen; + + switch (index) { + case 0: + m_angularShadesBrush = new QBrush(Qt::NoBrush); + m_angularShadesPen = new QPen(Qt::NoPen); + m_angularShadesVisible = false; + break; + case 1: + m_angularShadesBrush = new QBrush(Qt::lightGray); + m_angularShadesPen = new QPen(Qt::NoPen); + m_angularShadesVisible = true; + break; + case 2: + m_angularShadesBrush = new QBrush(Qt::yellow); + m_angularShadesPen = new QPen(Qt::DotLine); + m_angularShadesPen->setWidth(2); + m_angularShadesVisible = true; + break; + default: + break; + } + + m_angularAxis->setShadesBrush(*m_angularShadesBrush); + m_angularAxis->setShadesPen(*m_angularShadesPen); + m_angularAxis->setShadesVisible(m_angularShadesVisible); +} + +void MainWindow::radialShadesIndexChanged(int index) +{ + delete m_radialShadesBrush; + delete m_radialShadesPen; + + switch (index) { + case 0: + m_radialShadesBrush = new QBrush(Qt::NoBrush); + m_radialShadesPen = new QPen(Qt::NoPen); + m_radialShadesVisible = false; + break; + case 1: + m_radialShadesBrush = new QBrush(Qt::green); + m_radialShadesPen = new QPen(Qt::NoPen); + m_radialShadesVisible = true; + break; + case 2: + m_radialShadesBrush = new QBrush(Qt::blue); + m_radialShadesPen = new QPen(Qt::DotLine); + m_radialShadesPen->setWidth(2); + m_radialShadesVisible = true; + break; + default: + break; + } + + m_radialAxis->setShadesBrush(*m_radialShadesBrush); + m_radialAxis->setShadesPen(*m_radialShadesPen); + m_radialAxis->setShadesVisible(m_radialShadesVisible); +} + +void MainWindow::labelFormatEdited(const QString &text) +{ + m_labelFormat = text; + if (m_angularAxisMode == AxisModeValue) + static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); + else if (m_angularAxisMode == AxisModeLogValue) + static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); + + if (m_radialAxisMode == AxisModeValue) + static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); + else if (m_radialAxisMode == AxisModeLogValue) + static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); +} + +void MainWindow::labelFontChanged(const QFont &font) +{ + m_currentLabelFont = font; + m_currentLabelFont.setPixelSize(ui->labelFontSizeSpin->value()); + m_angularAxis->setLabelsFont(m_currentLabelFont); + m_radialAxis->setLabelsFont(m_currentLabelFont); +} + +void MainWindow::labelFontSizeChanged(int value) +{ + m_currentLabelFont = ui->labelFontComboBox->currentFont(); + m_currentLabelFont.setPixelSize(value); + m_angularAxis->setLabelsFont(m_currentLabelFont); + m_radialAxis->setLabelsFont(m_currentLabelFont); +} + +void MainWindow::animationIndexChanged(int index) +{ + switch (index) { + case 0: + m_animationOptions = QChart::NoAnimation; + break; + case 1: + m_animationOptions = QChart::SeriesAnimations; + break; + case 2: + m_animationOptions = QChart::GridAxisAnimations; + break; + case 3: + m_animationOptions = QChart::AllAnimations; + break; + default: + break; + } + + m_chart->setAnimationOptions(m_animationOptions); +} + +void MainWindow::labelsIndexChanged(int index) +{ + delete m_labelBrush; + delete m_labelPen; + + switch (index) { + case 0: + m_labelBrush = new QBrush(Qt::NoBrush); + m_labelPen = new QPen(Qt::NoPen); + m_labelsVisible = false; + break; + case 1: + m_labelBrush = new QBrush(Qt::black); + m_labelPen = new QPen(Qt::NoPen); + m_labelsVisible = true; + break; + case 2: + m_labelBrush = new QBrush(Qt::white); + m_labelPen = new QPen(Qt::blue); + m_labelsVisible = true; + break; + default: + break; + } + + m_radialAxis->setLabelsBrush(*m_labelBrush); + m_radialAxis->setLabelsPen(*m_labelPen); + m_radialAxis->setLabelsVisible(m_labelsVisible); + m_angularAxis->setLabelsBrush(*m_labelBrush); + m_angularAxis->setLabelsPen(*m_labelPen); + m_angularAxis->setLabelsVisible(m_labelsVisible); +} + +void MainWindow::titleIndexChanged(int index) +{ + delete m_titleBrush; + delete m_titlePen; + + switch (index) { + case 0: + m_titleBrush = new QBrush(Qt::NoBrush); + m_titlePen = new QPen(Qt::NoPen); + m_titleVisible = false; + m_angularTitle = QString(); + m_radialTitle = QString(); + break; + case 1: + m_titleBrush = new QBrush(Qt::NoBrush); + m_titlePen = new QPen(Qt::NoPen); + m_titleVisible = true; + m_angularTitle = QString(); + m_radialTitle = QString(); + break; + case 2: + m_titleBrush = new QBrush(Qt::NoBrush); + m_titlePen = new QPen(Qt::NoPen); + m_titleVisible = false; + m_angularTitle = QString("Invisible Ang. Title!"); + m_radialTitle = QString("Invisible Rad. Title!"); + break; + case 3: + m_titleBrush = new QBrush(Qt::black); + m_titlePen = new QPen(Qt::NoPen); + m_titleVisible = true; + m_angularTitle = QString("Angular Title"); + m_radialTitle = QString("Radial Title"); + break; + case 4: + m_titleBrush = new QBrush(Qt::white); + m_titlePen = new QPen(Qt::blue); + m_titleVisible = true; + m_angularTitle = QString("Angular Blue Title"); + m_radialTitle = QString("Radial Blue Title"); + break; + default: + break; + } + + m_radialAxis->setTitleBrush(*m_titleBrush); + m_radialAxis->setTitlePen(*m_titlePen); + m_radialAxis->setTitleVisible(m_titleVisible); + m_radialAxis->setTitleText(m_radialTitle); + m_angularAxis->setTitleBrush(*m_titleBrush); + m_angularAxis->setTitlePen(*m_titlePen); + m_angularAxis->setTitleVisible(m_titleVisible); + m_angularAxis->setTitleText(m_angularTitle); +} + +void MainWindow::titleFontChanged(const QFont &font) +{ + m_currentTitleFont = font; + m_currentTitleFont.setPixelSize(ui->titleFontSizeSpin->value()); + m_angularAxis->setTitleFont(m_currentTitleFont); + m_radialAxis->setTitleFont(m_currentTitleFont); +} + +void MainWindow::titleFontSizeChanged(int value) +{ + m_currentTitleFont = ui->titleFontComboBox->currentFont(); + m_currentTitleFont.setPixelSize(value); + m_angularAxis->setTitleFont(m_currentTitleFont); + m_radialAxis->setTitleFont(m_currentTitleFont); +} + +void MainWindow::gridIndexChanged(int index) +{ + delete m_gridPen; + + switch (index) { + case 0: + m_gridPen = new QPen(Qt::NoPen); + m_gridVisible = false; + break; + case 1: + m_gridPen = new QPen(Qt::black); + m_gridVisible = true; + break; + case 2: + m_gridPen = new QPen(Qt::red); + m_gridPen->setStyle(Qt::DashDotLine); + m_gridPen->setWidth(3); + m_gridVisible = true; + break; + default: + break; + } + + m_angularAxis->setGridLinePen(*m_gridPen); + m_angularAxis->setGridLineVisible(m_gridVisible); + m_radialAxis->setGridLinePen(*m_gridPen); + m_radialAxis->setGridLineVisible(m_gridVisible); +} + +void MainWindow::arrowIndexChanged(int index) +{ + delete m_arrowPen; + + switch (index) { + case 0: + m_arrowPen = new QPen(Qt::NoPen); + m_arrowVisible = false; + break; + case 1: + m_arrowPen = new QPen(Qt::black); + m_arrowVisible = true; + break; + case 2: + m_arrowPen = new QPen(Qt::red); + m_arrowPen->setStyle(Qt::DashDotLine); + m_arrowPen->setWidth(3); + m_arrowVisible = true; + break; + default: + break; + } + + m_angularAxis->setLinePen(*m_arrowPen); + m_angularAxis->setLineVisible(m_arrowVisible); + m_radialAxis->setLinePen(*m_arrowPen); + m_radialAxis->setLineVisible(m_arrowVisible); +} + +void MainWindow::angularRangeChanged(qreal min, qreal max) +{ + if (!qFuzzyCompare(ui->angularMinSpin->value(), min)) + ui->angularMinSpin->setValue(min); + if (!qFuzzyCompare(ui->angularMaxSpin->value(), max)) + ui->angularMaxSpin->setValue(max); +} + +void MainWindow::radialRangeChanged(qreal min, qreal max) +{ + if (!qFuzzyCompare(ui->radialMinSpin->value(), min)) + ui->radialMinSpin->setValue(min); + if (!qFuzzyCompare(ui->radialMaxSpin->value(), max)) + ui->radialMaxSpin->setValue(max); +} + +void MainWindow::angularAxisIndexChanged(int index) +{ + switch (index) { + case 0: + setAngularAxis(AxisModeNone); + break; + case 1: + setAngularAxis(AxisModeValue); + break; + case 2: + setAngularAxis(AxisModeLogValue); + break; + case 3: + setAngularAxis(AxisModeDateTime); + break; + case 4: + setAngularAxis(AxisModeCategory); + break; + default: + qWarning("Invalid Index!"); + } +} + +void MainWindow::radialAxisIndexChanged(int index) +{ + switch (index) { + case 0: + setRadialAxis(AxisModeNone); + break; + case 1: + setRadialAxis(AxisModeValue); + break; + case 2: + setRadialAxis(AxisModeLogValue); + break; + case 3: + setRadialAxis(AxisModeDateTime); + break; + case 4: + setRadialAxis(AxisModeCategory); + break; + default: + qWarning("Invalid Index!"); + } +} + +void MainWindow::logBaseChanged(double value) +{ + m_base = value; + if (m_angularAxisMode == AxisModeLogValue) + static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); + if (m_radialAxisMode == AxisModeLogValue) + static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); +} + +void MainWindow::niceNumbersChecked() +{ + if (ui->niceNumbersCheckBox->isChecked()) + applyRanges(); +} + +void MainWindow::dateFormatEdited(const QString &text) +{ + m_dateFormat = text; + if (m_angularAxisMode == AxisModeDateTime) + static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); + if (m_radialAxisMode == AxisModeDateTime) + static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); +} + +void MainWindow::moreCategoriesChecked() +{ + applyCategories(); + m_moreCategories = ui->moreCategoriesCheckBox->isChecked(); +} + +void MainWindow::series1CheckBoxChecked() +{ + if (ui->series1checkBox->isChecked()) + m_series1->setVisible(true); + else + m_series1->setVisible(false); +} + +void MainWindow::series2CheckBoxChecked() +{ + if (ui->series2checkBox->isChecked()) + m_series2->setVisible(true); + else + m_series2->setVisible(false); +} + +void MainWindow::series3CheckBoxChecked() +{ + if (ui->series3checkBox->isChecked()) + m_series3->setVisible(true); + else + m_series3->setVisible(false); +} + +void MainWindow::series4CheckBoxChecked() +{ + if (ui->series4checkBox->isChecked()) + m_series4->setVisible(true); + else + m_series4->setVisible(false); +} + +void MainWindow::series5CheckBoxChecked() +{ + if (ui->series5checkBox->isChecked()) + m_series5->setVisible(true); + else + m_series5->setVisible(false); +} + +void MainWindow::series6CheckBoxChecked() +{ + if (ui->series6checkBox->isChecked()) + m_series6->setVisible(true); + else + m_series6->setVisible(false); +} + +void MainWindow::series7CheckBoxChecked() +{ + if (ui->series7checkBox->isChecked()) + m_series7->setVisible(true); + else + m_series7->setVisible(false); +} + +void MainWindow::themeIndexChanged(int index) +{ + m_chart->setTheme(QChart::ChartTheme(index)); +} + +void MainWindow::seriesHovered(QPointF point, bool state) +{ + QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); + if (series) { + if (state) { + QString str("'%3' - %1 x %2"); + ui->hoverLabel->setText(str.arg(point.x()).arg(point.y()).arg(series->name())); + } else { + ui->hoverLabel->setText("No hover"); + } + } else { + qDebug() << "seriesHovered - invalid sender!"; + } +} + +void MainWindow::seriesClicked(const QPointF &point) +{ + QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); + if (series) { + QString str("'%3' clicked at: %1 x %2"); + m_angularTitle = str.arg(point.x()).arg(point.y()).arg(series->name()); + m_angularAxis->setTitleText(m_angularTitle); + } else { + qDebug() << "seriesClicked - invalid sender!"; + } +} + +void MainWindow::applyCategories() +{ + // Basic layout is three categories, extended has five + if (m_angularAxisMode == AxisModeCategory) { + QCategoryAxis *angCatAxis = static_cast<QCategoryAxis *>(m_angularAxis); + if (angCatAxis->count() == 0) { + angCatAxis->setStartValue(4000); + angCatAxis->append("Category A", 7000); + angCatAxis->append("Category B", 12000); + angCatAxis->append("Category C", 17000); + } + if (angCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { + angCatAxis->setStartValue(1000); + angCatAxis->replaceLabel("Category A", "Cat A"); + angCatAxis->replaceLabel("Category B", "Cat B"); + angCatAxis->replaceLabel("Category C", "Cat C"); + angCatAxis->append("Cat D", 22000); + angCatAxis->append("Cat E", 28000); + } else if (angCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { + angCatAxis->setStartValue(4000); + angCatAxis->replaceLabel("Cat A", "Category A"); + angCatAxis->replaceLabel("Cat B", "Category B"); + angCatAxis->replaceLabel("Cat C", "Category C"); + angCatAxis->remove("Cat D"); + angCatAxis->remove("Cat E"); + } + } + + if (m_radialAxisMode == AxisModeCategory) { + QCategoryAxis *radCatAxis = static_cast<QCategoryAxis *>(m_radialAxis); + if (radCatAxis->count() == 0) { + radCatAxis->setStartValue(2000); + radCatAxis->append("Category 1", 4000); + radCatAxis->append("Category 2", 9000); + radCatAxis->append("Category 3", 14000); + } + if (radCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { + radCatAxis->setStartValue(1000); + radCatAxis->replaceLabel("Category 1", "Cat 1"); + radCatAxis->replaceLabel("Category 2", "Cat 2"); + radCatAxis->replaceLabel("Category 3", "Cat 3"); + radCatAxis->append("Cat 4", 16500); + radCatAxis->append("Cat 5", 19000); + } else if (radCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { + radCatAxis->setStartValue(2000); + radCatAxis->replaceLabel("Cat 1", "Category 1"); + radCatAxis->replaceLabel("Cat 2", "Category 2"); + radCatAxis->replaceLabel("Cat 3", "Category 3"); + radCatAxis->remove("Cat 4"); + radCatAxis->remove("Cat 5"); + } + } +} diff --git a/tests/polarcharttest/mainwindow.h b/tests/polarcharttest/mainwindow.h new file mode 100644 index 00000000..94aa7d84 --- /dev/null +++ b/tests/polarcharttest/mainwindow.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QPolarChart> +#include <QMainWindow> +#include <QFont> +#include <QChart> +#include <QScatterSeries> +#include <QLineSeries> +#include <QSplineSeries> +#include <QAreaSeries> + +namespace Ui { +class MainWindow; +} + +QTCOMMERCIALCHART_USE_NAMESPACE + +class QBrush; +class QPen; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +public slots: + void angularTicksChanged(int value); + void radialTicksChanged(int value); + void anglesChanged(int value); + void angularMinChanged(double value); + void angularMaxChanged(double value); + void radialMinChanged(double value); + void radialMaxChanged(double value); + void angularShadesIndexChanged(int index); + void radialShadesIndexChanged(int index); + void labelFormatEdited(const QString &text); + void labelFontChanged(const QFont &font); + void labelFontSizeChanged(int value); + void animationIndexChanged(int index); + void labelsIndexChanged(int index); + void titleIndexChanged(int index); + void titleFontChanged(const QFont &font); + void titleFontSizeChanged(int value); + void gridIndexChanged(int index); + void arrowIndexChanged(int index); + void angularRangeChanged(qreal min, qreal max); + void radialRangeChanged(qreal min, qreal max); + void angularAxisIndexChanged(int index); + void radialAxisIndexChanged(int index); + void logBaseChanged(double value); + void niceNumbersChecked(); + void dateFormatEdited(const QString &text); + void moreCategoriesChecked(); + void series1CheckBoxChecked(); + void series2CheckBoxChecked(); + void series3CheckBoxChecked(); + void series4CheckBoxChecked(); + void series5CheckBoxChecked(); + void series6CheckBoxChecked(); + void series7CheckBoxChecked(); + void themeIndexChanged(int index); + void seriesHovered(QPointF point, bool state); + void seriesClicked(const QPointF &point); + +private: + enum AxisMode { + AxisModeNone, + AxisModeValue, + AxisModeLogValue, + AxisModeDateTime, + AxisModeCategory + }; + + void initXYValueChart(); + void setAngularAxis(AxisMode mode); + void setRadialAxis(AxisMode mode); + + void applyRanges(); + void applyCategories(); + + Ui::MainWindow *ui; + + int m_angularTickCount; + int m_radialTickCount; + qreal m_labelsAngle; + qreal m_angularMin; + qreal m_angularMax; + qreal m_radialMin; + qreal m_radialMax; + bool m_angularShadesVisible; + bool m_radialShadesVisible; + bool m_labelsVisible; + bool m_titleVisible; + bool m_gridVisible; + bool m_arrowVisible; + QBrush *m_angularShadesBrush; + QBrush *m_radialShadesBrush; + QBrush *m_labelBrush; + QBrush *m_titleBrush; + QPen *m_angularShadesPen; + QPen *m_radialShadesPen; + QPen *m_labelPen; + QPen *m_titlePen; + QPen *m_gridPen; + QPen *m_arrowPen; + QString m_labelFormat; + QFont m_currentLabelFont; + QFont m_currentTitleFont; + QChart::AnimationOptions m_animationOptions; + QString m_angularTitle; + QString m_radialTitle; + qreal m_base; + QString m_dateFormat; + + QPolarChart *m_chart; + QAbstractAxis *m_angularAxis; + QAbstractAxis *m_radialAxis; + AxisMode m_angularAxisMode; + AxisMode m_radialAxisMode; + bool m_moreCategories; + + QScatterSeries *m_series1; + QLineSeries *m_series2; + QLineSeries *m_series3; + QLineSeries *m_series4; + QAreaSeries *m_series5; + QSplineSeries *m_series6; + QScatterSeries *m_series7; +}; + +#endif // MAINWINDOW_H diff --git a/tests/polarcharttest/mainwindow.ui b/tests/polarcharttest/mainwindow.ui new file mode 100644 index 00000000..79cf3793 --- /dev/null +++ b/tests/polarcharttest/mainwindow.ui @@ -0,0 +1,929 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1207</width> + <height>905</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="ChartView" name="chartView"/> + </item> + <item> + <widget class="QGroupBox" name="settingsBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Settings</string> + </property> + <widget class="QSpinBox" name="radialTicksSpin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>90</y> + <width>71</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>10</x> + <y>90</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Radial Tick count</string> + </property> + </widget> + <widget class="QLabel" name="label_2"> + <property name="geometry"> + <rect> + <x>10</x> + <y>120</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Angular Tick count</string> + </property> + </widget> + <widget class="QSpinBox" name="angularTicksSpin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>120</y> + <width>71</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QSpinBox" name="anglesSpin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>150</y> + <width>71</width> + <height>22</height> + </rect> + </property> + <property name="minimum"> + <number>-9999</number> + </property> + <property name="maximum"> + <number>9999</number> + </property> + <property name="singleStep"> + <number>5</number> + </property> + </widget> + <widget class="QLabel" name="label_3"> + <property name="geometry"> + <rect> + <x>10</x> + <y>150</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Label angles</string> + </property> + </widget> + <widget class="QLabel" name="label_4"> + <property name="geometry"> + <rect> + <x>10</x> + <y>180</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Angular min</string> + </property> + </widget> + <widget class="QLabel" name="label_5"> + <property name="geometry"> + <rect> + <x>10</x> + <y>210</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Angular max</string> + </property> + </widget> + <widget class="QDoubleSpinBox" name="angularMinSpin"> + <property name="geometry"> + <rect> + <x>90</x> + <y>180</y> + <width>91</width> + <height>22</height> + </rect> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + <widget class="QDoubleSpinBox" name="angularMaxSpin"> + <property name="geometry"> + <rect> + <x>90</x> + <y>210</y> + <width>91</width> + <height>22</height> + </rect> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + <widget class="QDoubleSpinBox" name="radialMaxSpin"> + <property name="geometry"> + <rect> + <x>90</x> + <y>270</y> + <width>91</width> + <height>22</height> + </rect> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + <widget class="QDoubleSpinBox" name="radialMinSpin"> + <property name="geometry"> + <rect> + <x>90</x> + <y>240</y> + <width>91</width> + <height>22</height> + </rect> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + <widget class="QLabel" name="label_11"> + <property name="geometry"> + <rect> + <x>10</x> + <y>270</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Radial max</string> + </property> + </widget> + <widget class="QLabel" name="label_12"> + <property name="geometry"> + <rect> + <x>10</x> + <y>240</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Radial min</string> + </property> + </widget> + <widget class="QComboBox" name="angularShadesComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>300</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <item> + <property name="text"> + <string>No angular shades</string> + </property> + </item> + <item> + <property name="text"> + <string>Gray angular shades</string> + </property> + </item> + <item> + <property name="text"> + <string>Yellow ang. shades + custom pen</string> + </property> + </item> + </widget> + <widget class="QComboBox" name="radialShadesComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>330</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <item> + <property name="text"> + <string>No radial shades</string> + </property> + </item> + <item> + <property name="text"> + <string>Green radial shades</string> + </property> + </item> + <item> + <property name="text"> + <string>Blue rad. shades + custom pen</string> + </property> + </item> + </widget> + <widget class="QLabel" name="label_13"> + <property name="geometry"> + <rect> + <x>10</x> + <y>360</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Label format</string> + </property> + </widget> + <widget class="QLineEdit" name="labelFormatEdit"> + <property name="geometry"> + <rect> + <x>100</x> + <y>360</y> + <width>81</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_14"> + <property name="geometry"> + <rect> + <x>10</x> + <y>390</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Label font size</string> + </property> + </widget> + <widget class="QFontComboBox" name="labelFontComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>420</y> + <width>171</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QSpinBox" name="labelFontSizeSpin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>390</y> + <width>81</width> + <height>22</height> + </rect> + </property> + <property name="minimum"> + <number>-100000</number> + </property> + <property name="maximum"> + <number>100000</number> + </property> + </widget> + <widget class="QComboBox" name="animationsComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>480</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <item> + <property name="text"> + <string>No animations</string> + </property> + </item> + <item> + <property name="text"> + <string>Series animation</string> + </property> + </item> + <item> + <property name="text"> + <string>Grid animation</string> + </property> + </item> + <item> + <property name="text"> + <string>All animations</string> + </property> + </item> + </widget> + <widget class="QComboBox" name="labelComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>450</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>No labels</string> + </property> + </item> + <item> + <property name="text"> + <string>Black label</string> + </property> + </item> + <item> + <property name="text"> + <string>White label + blue pen</string> + </property> + </item> + </widget> + <widget class="QSpinBox" name="titleFontSizeSpin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>510</y> + <width>81</width> + <height>22</height> + </rect> + </property> + <property name="minimum"> + <number>-100000</number> + </property> + <property name="maximum"> + <number>100000</number> + </property> + </widget> + <widget class="QComboBox" name="titleComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>570</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>3</number> + </property> + <item> + <property name="text"> + <string>Invisible empty title</string> + </property> + </item> + <item> + <property name="text"> + <string>Visible empty title</string> + </property> + </item> + <item> + <property name="text"> + <string>Invisible title</string> + </property> + </item> + <item> + <property name="text"> + <string>Black title</string> + </property> + </item> + <item> + <property name="text"> + <string>White title + blue pen</string> + </property> + </item> + </widget> + <widget class="QFontComboBox" name="titleFontComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>540</y> + <width>171</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_15"> + <property name="geometry"> + <rect> + <x>10</x> + <y>510</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Title font size</string> + </property> + </widget> + <widget class="QComboBox" name="gridComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>600</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>Invisible grid</string> + </property> + </item> + <item> + <property name="text"> + <string>Black grid</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom grid pen</string> + </property> + </item> + </widget> + <widget class="QComboBox" name="arrowComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>630</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>Invisible arrow</string> + </property> + </item> + <item> + <property name="text"> + <string>Black arrow</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom arrow pen</string> + </property> + </item> + </widget> + <widget class="QComboBox" name="angularAxisComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>20</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>No Angular Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Angular Value Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Angular Log Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Angular DateTime Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Angular Category Axis</string> + </property> + </item> + </widget> + <widget class="QComboBox" name="radialAxisComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <item> + <property name="text"> + <string>No Radial Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Radial Value Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Radial Log Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Radial DateTime Axis</string> + </property> + </item> + <item> + <property name="text"> + <string>Radial Category Axis</string> + </property> + </item> + </widget> + <widget class="QLabel" name="label_16"> + <property name="geometry"> + <rect> + <x>10</x> + <y>660</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Log Base</string> + </property> + </widget> + <widget class="QDoubleSpinBox" name="logBaseSpin"> + <property name="geometry"> + <rect> + <x>90</x> + <y>660</y> + <width>91</width> + <height>22</height> + </rect> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="value"> + <double>8.000000000000000</double> + </property> + </widget> + <widget class="QCheckBox" name="niceNumbersCheckBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>690</y> + <width>91</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Nice Numbers</string> + </property> + </widget> + <widget class="QLineEdit" name="dateFormatEdit"> + <property name="geometry"> + <rect> + <x>100</x> + <y>710</y> + <width>81</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_17"> + <property name="geometry"> + <rect> + <x>10</x> + <y>710</y> + <width>101</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>DateTime format</string> + </property> + </widget> + <widget class="QCheckBox" name="moreCategoriesCheckBox"> + <property name="geometry"> + <rect> + <x>100</x> + <y>690</y> + <width>141</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>More Categories</string> + </property> + </widget> + <widget class="QCheckBox" name="series1checkBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>730</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>1</string> + </property> + </widget> + <widget class="QCheckBox" name="series2checkBox"> + <property name="geometry"> + <rect> + <x>40</x> + <y>730</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + <widget class="QCheckBox" name="series3checkBox"> + <property name="geometry"> + <rect> + <x>70</x> + <y>730</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>3</string> + </property> + </widget> + <widget class="QCheckBox" name="series4checkBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>750</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>4</string> + </property> + </widget> + <widget class="QCheckBox" name="series5checkBox"> + <property name="geometry"> + <rect> + <x>40</x> + <y>750</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>5</string> + </property> + </widget> + <widget class="QCheckBox" name="series6checkBox"> + <property name="geometry"> + <rect> + <x>70</x> + <y>750</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>6</string> + </property> + </widget> + <widget class="QCheckBox" name="series7checkBox"> + <property name="geometry"> + <rect> + <x>100</x> + <y>740</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>7</string> + </property> + </widget> + <widget class="QComboBox" name="themeComboBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>770</y> + <width>171</width> + <height>22</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>Theme: Light</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: Blue Cerulean</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: Dark</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: Brown Sand</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: Blue Ncs</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: High Contrast</string> + </property> + </item> + <item> + <property name="text"> + <string>Theme: Blue Icy</string> + </property> + </item> + </widget> + <widget class="QLabel" name="hoverLabel"> + <property name="geometry"> + <rect> + <x>10</x> + <y>800</y> + <width>171</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Hover coordinates here!</string> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1207</width> + <height>21</height> + </rect> + </property> + </widget> + <widget class="QToolBar" name="mainToolBar"> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QStatusBar" name="statusBar"/> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>ChartView</class> + <extends>QGraphicsView</extends> + <header>chartview.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/tests/polarcharttest/polarcharttest.pro b/tests/polarcharttest/polarcharttest.pro new file mode 100644 index 00000000..25f4b4e3 --- /dev/null +++ b/tests/polarcharttest/polarcharttest.pro @@ -0,0 +1,20 @@ +!include( ../tests.pri ) { + error( "Couldn't find the test.pri file!" ) +} + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = polarcharttest +TEMPLATE = app + + +SOURCES += main.cpp \ + mainwindow.cpp \ + chartview.cpp + +HEADERS += mainwindow.h \ + chartview.h + +FORMS += mainwindow.ui |