##// END OF EJS Templates
Fix Creator generated files...
Fix Creator generated files Updated generated files with Qt Creator so that it no longer notifies about it. Change-Id: I06f83d5b2e3b517c0a3c8efdfada3c55a64322c6 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2635:d3155254bba4
r2687:fd75a272a8eb
Show More
mainwidget.cpp
487 lines | 15.5 KiB | text/x-c | CppLexer
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 /****************************************************************************
**
** Copyright (C) 2013 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 ** 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 "mainwidget.h"
#include "customtablemodel.h"
Mika Salmela
Added pentool to boxplot tester...
r2566 #include "pentool.h"
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 #include <QVBoxPlotModelMapper>
#include <QTableView>
#include <QHeaderView>
#include <QChartView>
#include <QBoxPlotSeries>
#include <QBoxSet>
#include <QLegend>
#include <QBarCategoryAxis>
#include <QBrush>
#include <QColor>
#include <QPushButton>
#include <QComboBox>
#include <QSpinBox>
#include <QCheckBox>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QSpacerItem>
#include <QMessageBox>
#include <cmath>
#include <QDebug>
#include <QStandardItemModel>
#include <QBarCategoryAxis>
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 #include <QLogValueAxis>
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
QTCOMMERCIALCHART_USE_NAMESPACE
Miikka Heikkinen
Refactor boxplottest...
r2562 static const QString allCategories[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
static const int maxCategories = 12;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
m_chart(0),
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 m_axis(0),
Miikka Heikkinen
Refactor boxplottest...
r2562 m_rowPos(0),
m_seriesCount(0)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 {
m_chart = new QChart();
Mika Salmela
Added pentool to boxplot tester...
r2566 m_penTool = new PenTool("Whiskers pen", this);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 // Grid layout for the controls for configuring the chart widget
QGridLayout *grid = new QGridLayout();
// Create add a series button
QPushButton *addSeriesButton = new QPushButton("Add a series");
connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(addSeriesButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create remove a series button
QPushButton *removeSeriesButton = new QPushButton("Remove a series");
connect(removeSeriesButton, SIGNAL(clicked()), this, SLOT(removeSeries()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(removeSeriesButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create add a single box button
QPushButton *addBoxButton = new QPushButton("Add a box");
connect(addBoxButton, SIGNAL(clicked()), this, SLOT(addBox()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(addBoxButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create insert a box button
QPushButton *insertBoxButton = new QPushButton("Insert a box");
connect(insertBoxButton, SIGNAL(clicked()), this, SLOT(insertBox()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(insertBoxButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create add a single box button
QPushButton *removeBoxButton = new QPushButton("Remove a box");
connect(removeBoxButton, SIGNAL(clicked()), this, SLOT(removeBox()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(removeBoxButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create clear button
QPushButton *clearButton = new QPushButton("Clear");
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(clearButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create clear button
QPushButton *clearBoxButton = new QPushButton("ClearBox");
connect(clearBoxButton, SIGNAL(clicked()), this, SLOT(clearBox()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(clearBoxButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
// Create set brush button
QPushButton *setBrushButton = new QPushButton("Set brush");
connect(setBrushButton, SIGNAL(clicked()), this, SLOT(setBrush()));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(setBrushButton, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Mika Salmela
Added pentool to boxplot tester...
r2566 // Create set whiskers pen button
QPushButton *setWhiskersButton = new QPushButton("Whiskers pen");
connect(setWhiskersButton, SIGNAL(clicked()), m_penTool, SLOT(show()));
connect(m_penTool, SIGNAL(changed()), this, SLOT(changePen()));
grid->addWidget(setWhiskersButton, m_rowPos++, 1);
Mika Salmela
Property to control box width...
r2584 // Box width setting
m_boxWidthSB = new QDoubleSpinBox();
m_boxWidthSB->setMinimum(-1.0);
m_boxWidthSB->setMaximum(2.0);
m_boxWidthSB->setSingleStep(0.1);
m_boxWidthSB->setValue(0.5);
grid->addWidget(new QLabel("Box width:"), m_rowPos, 0);
grid->addWidget(m_boxWidthSB, m_rowPos++, 1);
connect(m_boxWidthSB, SIGNAL(valueChanged(double)), this, SLOT(setBoxWidth(double)));
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 initThemeCombo(grid);
initCheckboxes(grid);
Mika Salmela
Removing unused connections and slots...
r2559 m_model = new CustomTableModel();
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 QTableView *tableView = new QTableView;
tableView->setModel(m_model);
tableView->setMaximumWidth(200);
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(tableView, m_rowPos++, 0, 3, 2, Qt::AlignLeft);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
#else
tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
#endif
// 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);
// Create chart view with the chart
m_chartView = new QChartView(m_chart, this);
Mika Salmela
Added pentool to boxplot tester...
r2566 // As a default antialiasing is off
m_chartView->setRenderHint(QPainter::Antialiasing, false);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 // Another grid layout as a main layout
QGridLayout *mainLayout = new QGridLayout();
mainLayout->addLayout(grid, 0, 0);
mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
setLayout(mainLayout);
legendToggled(false);
animationToggled(false);
}
// Combo box for selecting theme
void MainWidget::initThemeCombo(QGridLayout *grid)
{
QComboBox *chartTheme = new QComboBox();
chartTheme->addItem("Default");
chartTheme->addItem("Light");
chartTheme->addItem("Blue Cerulean");
chartTheme->addItem("Dark");
chartTheme->addItem("Brown Sand");
chartTheme->addItem("Blue NCS");
chartTheme->addItem("High Contrast");
chartTheme->addItem("Blue Icy");
Titta Heikkala
Add the new Qt template to demos and tests...
r2631 chartTheme->addItem("Qt");
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 connect(chartTheme, SIGNAL(currentIndexChanged(int)),
this, SLOT(changeChartTheme(int)));
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(new QLabel("Chart theme:"), m_rowPos, 0);
grid->addWidget(chartTheme, m_rowPos++, 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
// Different check boxes for customizing chart
void MainWidget::initCheckboxes(QGridLayout *grid)
{
QCheckBox *animationCheckBox = new QCheckBox("Animation");
connect(animationCheckBox, SIGNAL(toggled(bool)), this, SLOT(animationToggled(bool)));
animationCheckBox->setChecked(false);
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(animationCheckBox, m_rowPos++, 0);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
QCheckBox *legendCheckBox = new QCheckBox("Legend");
connect(legendCheckBox, SIGNAL(toggled(bool)), this, SLOT(legendToggled(bool)));
legendCheckBox->setChecked(false);
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(legendCheckBox, m_rowPos++, 0);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
QCheckBox *titleCheckBox = new QCheckBox("Title");
connect(titleCheckBox, SIGNAL(toggled(bool)), this, SLOT(titleToggled(bool)));
titleCheckBox->setChecked(false);
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(titleCheckBox, m_rowPos++, 0);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Mika Salmela
Pentool to boxplot tester...
r2567 QCheckBox *antialiasingCheckBox = new QCheckBox("Antialiasing");
connect(antialiasingCheckBox, SIGNAL(toggled(bool)), this, SLOT(antialiasingToggled(bool)));
antialiasingCheckBox->setChecked(false);
grid->addWidget(antialiasingCheckBox, m_rowPos++, 0);
Mika Salmela
Added pentool to boxplot tester...
r2566
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 QCheckBox *modelMapperCheckBox = new QCheckBox("Use model mapper");
connect(modelMapperCheckBox, SIGNAL(toggled(bool)), this, SLOT(modelMapperToggled(bool)));
modelMapperCheckBox->setChecked(false);
Miikka Heikkinen
Refactor boxplottest...
r2562 grid->addWidget(modelMapperCheckBox, m_rowPos++, 0);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Mika Salmela
Selectable outlines for box...
r2573 m_boxOutlined = new QCheckBox("Box outlined");
connect(m_boxOutlined, SIGNAL(toggled(bool)), this, SLOT(boxOutlineToggled(bool)));
m_boxOutlined->setChecked(true);
grid->addWidget(m_boxOutlined, m_rowPos++, 0);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
Miikka Heikkinen
Refactor boxplottest...
r2562 void MainWidget::updateAxis(int categoryCount)
{
if (!m_axis) {
m_chart->createDefaultAxes();
m_axis = new QBarCategoryAxis();
}
QStringList categories;
for (int i = 0; i < categoryCount; i++)
categories << allCategories[i];
m_axis->setCategories(categories);
}
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 void MainWidget::addSeries()
{
qDebug() << "BoxPlotTester::MainWidget::addSeries()";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 9)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 return;
// Initial data
QBoxSet *set0 = new QBoxSet();
QBoxSet *set1 = new QBoxSet();
QBoxSet *set2 = new QBoxSet();
QBoxSet *set3 = new QBoxSet();
QBoxSet *set4 = new QBoxSet();
QBoxSet *set5 = new QBoxSet();
// low bot med top upp
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 *set0 << -1 << 2 << 4 << 13 << 15;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 *set1 << 5 << 6 << 7.5 << 8 << 12;
*set2 << 3 << 5 << 5.7 << 8 << 9;
*set3 << 5 << 6 << 6.8 << 7 << 8;
*set4 << 4 << 5 << 5.2 << 6 << 7;
*set5 << 4 << 7 << 8.2 << 9 << 10;
Miikka Heikkinen
Refactor boxplottest...
r2562 m_series[m_seriesCount] = new QBoxPlotSeries();
m_series[m_seriesCount]->append(set0);
m_series[m_seriesCount]->append(set1);
m_series[m_seriesCount]->append(set2);
m_series[m_seriesCount]->append(set3);
m_series[m_seriesCount]->append(set4);
m_series[m_seriesCount]->append(set5);
m_series[m_seriesCount]->setName("Box & Whiskers");
connect(m_series[m_seriesCount], SIGNAL(clicked(QBoxSet*)), this, SLOT(boxClicked(QBoxSet*)));
connect(m_series[m_seriesCount], SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(boxHovered(bool, QBoxSet*)));
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 connect(set1, SIGNAL(clicked()), this, SLOT(singleBoxClicked()));
connect(set2, SIGNAL(hovered(bool)), this, SLOT(singleBoxHovered(bool)));
Mika Salmela
Selectable outlines for box...
r2573 m_series[m_seriesCount]->setBoxOutlineVisible(m_boxOutlined->checkState());
Mika Salmela
Property to control box width...
r2584 m_series[m_seriesCount]->setBoxWidth(m_boxWidthSB->value());
Mika Salmela
Selectable outlines for box...
r2573
Miikka Heikkinen
Refactor boxplottest...
r2562 m_chart->addSeries(m_series[m_seriesCount]);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Miikka Heikkinen
Refactor boxplottest...
r2562 updateAxis(m_series[0]->count());
m_chart->setAxisX(m_axis, m_series[m_seriesCount]);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Miikka Heikkinen
Refactor boxplottest...
r2562 m_seriesCount++;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
void MainWidget::removeSeries()
{
qDebug() << "BoxPlotTester::MainWidget::removeSeries()";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0) {
m_seriesCount--;
m_chart->removeSeries(m_series[m_seriesCount]);
delete m_series[m_seriesCount];
m_series[m_seriesCount] = 0;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 } else {
qDebug() << "Create a series first";
}
}
void MainWidget::addBox()
{
qDebug() << "BoxPlotTester::MainWidget::addBox()";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0 && m_series[0]->count() < maxCategories) {
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 QBoxSet *newSet = new QBoxSet();
newSet->setValue(QBoxSet::LowerExtreme, 5.0);
newSet->setValue(QBoxSet::LowerQuartile, 6.0);
newSet->setValue(QBoxSet::Median, 6.8);
newSet->setValue(QBoxSet::UpperQuartile, 7.0);
newSet->setValue(QBoxSet::UpperExtreme, 8.0);
Miikka Heikkinen
Refactor boxplottest...
r2562 updateAxis(m_series[0]->count() + 1);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Miikka Heikkinen
Refactor boxplottest...
r2562 m_series[0]->append(newSet);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
}
void MainWidget::insertBox()
{
qDebug() << "BoxPlotTester::MainWidget::insertBox()";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0 && m_series[0]->count() < maxCategories) {
updateAxis(m_series[0]->count() + 1);
for (int i = 0; i < m_seriesCount; i++) {
QBoxSet *newSet = new QBoxSet();
*newSet << 2 << 6 << 6.8 << 7 << 10;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 m_series[i]->insert(1, newSet);
Miikka Heikkinen
Refactor boxplottest...
r2562 }
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
}
void MainWidget::removeBox()
{
qDebug() << "BoxPlotTester::MainWidget::removeBox";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0) {
for (int i = 0; i < m_seriesCount; i++) {
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 qDebug() << "m_series[i]->count() = " << m_series[i]->count();
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_series[i]->count()) {
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 QList<QBoxSet *> sets = m_series[i]->boxSets();
Miikka Heikkinen
Refactor boxplottest...
r2562 m_series[i]->remove(sets.at(m_series[i]->count() - 1));
Mika Salmela
Changed BoxPlot to use domain for calculating geometry points....
r2554 }
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
Miikka Heikkinen
Refactor boxplottest...
r2562 updateAxis(m_series[0]->count());
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 } else {
qDebug() << "Create a series first";
}
}
void MainWidget::clear()
{
qDebug() << "BoxPlotTester::MainWidget::clear";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 m_series[0]->clear();
else
qDebug() << "Create a series first";
}
void MainWidget::clearBox()
{
qDebug() << "BoxPlotTester::MainWidget::clearBox";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0) {
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 QList<QBoxSet *> sets = m_series[0]->boxSets();
Titta Heikkala
Fix crash with boxplotttester...
r2630 if (sets.count() > 1)
sets.at(1)->clear();
else
qDebug() << "Create a series with at least two items first";
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 } else {
qDebug() << "Create a series first";
}
}
void MainWidget::setBrush()
{
qDebug() << "BoxPlotTester::MainWidget::setBrush";
Miikka Heikkinen
Refactor boxplottest...
r2562 if (m_seriesCount > 0) {
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 QList<QBoxSet *> sets = m_series[0]->boxSets();
Titta Heikkala
Fix crash with boxplottertester brush...
r2635 if (sets.count() > 1)
sets.at(1)->setBrush(QBrush(QColor(Qt::yellow)));
else
qDebug() << "Create a series with at least two items first";
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 } else {
qDebug() << "Create a series first";
}
}
void MainWidget::animationToggled(bool enabled)
{
qDebug() << "BoxPlotTester::Animation toggled to " << enabled;
if (enabled)
m_chart->setAnimationOptions(QChart::SeriesAnimations);
else
m_chart->setAnimationOptions(QChart::NoAnimation);
}
void MainWidget::legendToggled(bool enabled)
{
qDebug() << "BoxPlotTester::Legend toggled to " << enabled;
m_chart->legend()->setVisible(enabled);
if (enabled)
m_chart->legend()->setAlignment(Qt::AlignBottom);
}
void MainWidget::titleToggled(bool enabled)
{
qDebug() << "BoxPlotTester::Title toggled to " << enabled;
if (enabled)
m_chart->setTitle("Simple boxplotchart example");
else
m_chart->setTitle("");
}
Mika Salmela
Pentool to boxplot tester...
r2567 void MainWidget::antialiasingToggled(bool enabled)
Mika Salmela
Added pentool to boxplot tester...
r2566 {
Mika Salmela
Pentool to boxplot tester...
r2567 qDebug() << "BoxPlotTester::antialiasingToggled toggled to " << enabled;
Mika Salmela
Added pentool to boxplot tester...
r2566 m_chartView->setRenderHint(QPainter::Antialiasing, enabled);
}
Mika Salmela
Selectable outlines for box...
r2573 void MainWidget::boxOutlineToggled(bool visible)
{
qDebug() << "BoxPlotTester::boxOutlineToggled toggled to " << visible;
for (int i = 0; i < m_seriesCount; i++)
m_series[i]->setBoxOutlineVisible(visible);
}
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 void MainWidget::modelMapperToggled(bool enabled)
{
if (enabled) {
Miikka Heikkinen
Refactor boxplottest...
r2562 m_series[m_seriesCount] = new QBoxPlotSeries();
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
int first = 0;
int count = 5;
QVBoxPlotModelMapper *mapper = new QVBoxPlotModelMapper(this);
mapper->setFirstBoxSetColumn(0);
mapper->setLastBoxSetColumn(5);
mapper->setFirstRow(first);
mapper->setRowCount(count);
Miikka Heikkinen
Refactor boxplottest...
r2562 mapper->setSeries(m_series[m_seriesCount]);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 mapper->setModel(m_model);
Miikka Heikkinen
Refactor boxplottest...
r2562 m_chart->addSeries(m_series[m_seriesCount]);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Miikka Heikkinen
Refactor boxplottest...
r2562 m_seriesCount++;
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 } else {
removeSeries();
}
}
void MainWidget::changeChartTheme(int themeIndex)
{
qDebug() << "BoxPlotTester::changeChartTheme: " << themeIndex;
if (themeIndex == 0)
m_chart->setTheme(QChart::ChartThemeLight);
else
m_chart->setTheme((QChart::ChartTheme) (themeIndex - 1));
}
void MainWidget::boxClicked(QBoxSet *set)
{
qDebug() << "boxClicked, median = " << set->at(QBoxSet::Median);
}
void MainWidget::boxHovered(bool state, QBoxSet *set)
{
if (state)
qDebug() << "box median " << set->at(QBoxSet::Median) << " hover started";
else
qDebug() << "box median " << set->at(QBoxSet::Median) << " hover ended";
}
void MainWidget::singleBoxClicked()
{
qDebug() << "singleBoxClicked";
}
void MainWidget::singleBoxHovered(bool state)
{
if (state)
qDebug() << "single box hover started";
else
qDebug() << "single box hover ended";
}
Mika Salmela
Added pentool to boxplot tester...
r2566
void MainWidget::changePen()
{
qDebug() << "changePen() = " << m_penTool->pen();
for (int i = 0; i < m_seriesCount; i++)
m_series[i]->setPen(m_penTool->pen());
}
Mika Salmela
Property to control box width...
r2584
void MainWidget::setBoxWidth(double width)
{
qDebug() << "setBoxWidth to " << width;
for (int i = 0; i < m_seriesCount; i++)
m_series[i]->setBoxWidth(qreal(width));
}