Skip to content

Commit

Permalink
Merge pull request #58 from KDAB/master
Browse files Browse the repository at this point in the history
master
  • Loading branch information
Allen Winter authored Apr 1, 2024
2 parents 7a573c4 + a6b6cc9 commit 60f7f21
Show file tree
Hide file tree
Showing 99 changed files with 968 additions and 952 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Highlights
==================

Version 3.1.0 (unreleased):
--------------------------
* Bug fix: Fix model about to be reset

Version 3.0.1 (unreleased):
---------------------------
* Add WebAssembly demo-example
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ project(
)

set(${PROJECT_NAME}_VERSION_MAJOR 3)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION_MINOR 1)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}
)
Expand Down
2 changes: 1 addition & 1 deletion conan/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class KdchartConan(ConanFile):
name = "KDChart"
version = "3.0.1"
version = "3.1.0"
license = ("https://raw.githubusercontent.com/KDAB/KDChart/master/LICENSES/MIT.txt")
author = "Klaralvdalens Datakonsult AB (KDAB) [email protected]"
url = "https://github.com/KDAB/KDChart.git"
Expand Down
4 changes: 2 additions & 2 deletions examples/Axis/Labels/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ MainWindow::MainWindow(QWidget *parent)
m_legend->setAlignment(Qt::AlignTop);
m_chart->addLegend(m_legend);

connect(m_annotations, SIGNAL(toggled(bool)), SLOT(annotationsToggled(bool)));
connect(m_linesOnAnnotations, SIGNAL(toggled(bool)), SLOT(gridLinesOnAnnotationsToggled(bool)));
connect(m_annotations, &QCheckBox::toggled, this, &MainWindow::annotationsToggled);
connect(m_linesOnAnnotations, &QCheckBox::toggled, this, &MainWindow::gridLinesOnAnnotationsToggled);
}

void MainWindow::annotationsToggled(bool showAnnotations)
Expand Down
2 changes: 1 addition & 1 deletion examples/DrawIntoPainter/framewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void FrameWidget::setChart(KDChart::Chart *chart)
mChart = chart;
// This is necessary because Chart can't automatically schedule somebody else (this object) to
// call its custom paint method.
connect(mChart, SIGNAL(propertiesChanged()), SLOT(update()));
connect(mChart, &KDChart::Chart::propertiesChanged, this, QOverload<>::of(&FrameWidget::update));
}

void FrameWidget::paintEvent(QPaintEvent *e)
Expand Down
4 changes: 2 additions & 2 deletions examples/DrawIntoPainter/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ MainWindow::MainWindow(QWidget *parent)
#ifdef USE_FRAME_WIDGET
chartFrameWidget->setChart(m_chart);
// make sure, we re-draw after changing one of the chart's properties
connect(m_chart, SIGNAL(propertiesChanged()),
chartFrameWidget, SLOT(update()));
connect(m_chart, &KDChart::Chart::propertiesChanged,
chartFrameWidget, QOverload<>::of(&FrameWidget::update));
#else
chartLayout->addWidget(m_chart);
#endif
Expand Down
7 changes: 4 additions & 3 deletions examples/Gantt/legend_example/entrydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ void EntryDialog::init()
for (int row = 0; row < model->rowCount(); ++row)
addDependItem(model, model->index(row, 0));

connect(ui->startDate, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(updateEndDate(const QDateTime &)));
connect(ui->readOnly, SIGNAL(toggled(bool)), this, SLOT(disableEditing(bool)));
connect(ui->type, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
connect(ui->startDate, &QDateTimeEdit::dateTimeChanged,
this, &EntryDialog::updateEndDate);
connect(ui->readOnly, &QCheckBox::toggled, this, &EntryDialog::disableEditing);
connect(ui->type, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EntryDialog::typeChanged);

ui->startDate->setDateTime(QDateTime::currentDateTime());
typeChanged(0);
Expand Down
32 changes: 16 additions & 16 deletions examples/Gantt/legend_example/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
leftView->setColumnHidden(5, true);
leftView->header()->setStretchLastSection(true);

connect(ui->ganttView->leftView(), SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showContextMenu(const QPoint &)));
connect(ui->ganttView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(enableActions(const QItemSelection &)));
connect(ui->ganttView->leftView(), &QAbstractItemView::customContextMenuRequested,
this, &MainWindow::showContextMenu);
connect(ui->ganttView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &MainWindow::enableActions);
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -128,22 +128,22 @@ void MainWindow::initActions()
{
newEntryAction = new QAction(tr("New entry"), this);
newEntryAction->setShortcut(QKeySequence::New);
connect(newEntryAction, SIGNAL(triggered()), this, SLOT(addNewEntry()));
connect(newEntryAction, &QAction::triggered, this, &MainWindow::addNewEntry);

removeEntryAction = new QAction(tr("Remove entry"), this);
removeEntryAction->setShortcut(QKeySequence::Delete);
connect(removeEntryAction, SIGNAL(triggered()), this, SLOT(removeEntry()));
connect(removeEntryAction, &QAction::triggered, this, &MainWindow::removeEntry);

zoomInAction = new QAction(tr("Zoom In"), this);
zoomInAction->setShortcut(QKeySequence::ZoomIn);
connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
connect(zoomInAction, &QAction::triggered, this, &MainWindow::zoomIn);

zoomOutAction = new QAction(tr("Zoom Out"), this);
zoomOutAction->setShortcut(QKeySequence::ZoomOut);
connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut()));
connect(zoomOutAction, &QAction::triggered, this, &MainWindow::zoomOut);

zoomFitAction = new QAction(tr("Zoom to Fit"), this);
connect(zoomFitAction, SIGNAL(triggered()), this, SLOT(zoomFit()));
connect(zoomFitAction, &QAction::triggered, this, &MainWindow::zoomFit);

ui->ganttView->leftView()->setContextMenuPolicy(Qt::CustomContextMenu);
ui->ganttView->leftView()->addAction(newEntryAction);
Expand All @@ -160,11 +160,11 @@ void MainWindow::initActions()

QMenu *scaleMenu = menuBar()->addMenu(tr("Scale"));

scaleMenu->addAction(tr("Auto"), this, SLOT(scaleAuto()));
scaleMenu->addAction(tr("Hour"), this, SLOT(scaleHour()));
scaleMenu->addAction(tr("Day"), this, SLOT(scaleDay()));
scaleMenu->addAction(tr("Week"), this, SLOT(scaleWeek()));
scaleMenu->addAction(tr("Month"), this, SLOT(scaleMonth()));
scaleMenu->addAction(tr("Auto"), this, &MainWindow::scaleAuto);
scaleMenu->addAction(tr("Hour"), this, &MainWindow::scaleHour);
scaleMenu->addAction(tr("Day"), this, &MainWindow::scaleDay);
scaleMenu->addAction(tr("Week"), this, &MainWindow::scaleWeek);
scaleMenu->addAction(tr("Month"), this, &MainWindow::scaleMonth);

enableActions(QItemSelection());
}
Expand Down Expand Up @@ -314,14 +314,14 @@ void MainWindow::zoomOut()

void MainWindow::zoomFit()
{
QModelIndexList selectedIndexes = ui->ganttView->selectionModel()->selectedIndexes();
const QModelIndexList selectedIndexes = ui->ganttView->selectionModel()->selectedIndexes();

if (selectedIndexes.isEmpty()) {
return;
}

KDGantt::Span span;
Q_FOREACH (QModelIndex idx, selectedIndexes) {
for (QModelIndex idx : selectedIndexes) {
const KDGantt::Span s = grid->mapToChart(grid->model()->index(idx.row(), 0));
if (span.isValid()) {
span = span.expandedTo(s);
Expand Down
28 changes: 14 additions & 14 deletions examples/Gantt/project/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,28 +275,28 @@ MainWindow::MainWindow(QWidget *parent)
auto *fileMenu = new QMenu(tr("&File"));

#ifndef QT_NO_PRINTER
fileMenu->addAction(tr("&Save as PDF..."), this, SLOT(slotFileSavePdf()));
fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()));
fileMenu->addAction(tr("&Save as PDF..."), this, &MainWindow::slotFileSavePdf);
fileMenu->addAction(tr("&Print..."), this, &MainWindow::slotFilePrint);
#endif

fileMenu->addSeparator();
fileMenu->addAction(tr("&Quit"), this, SLOT(slotFileQuit()));
fileMenu->addAction(tr("&Quit"), this, &MainWindow::slotFileQuit);

mb->addMenu(fileMenu);

auto *toolsMenu = new QMenu(tr("&Tools"));

toolsMenu->addAction(tr("&New Item"), this, SLOT(slotToolsNewItem()));
toolsMenu->addAction(tr("&Add Item"), this, SLOT(slotToolsAppendItem()));
toolsMenu->addAction(tr("&New Item"), this, &MainWindow::slotToolsNewItem);
toolsMenu->addAction(tr("&Add Item"), this, &MainWindow::slotToolsAppendItem);
toolsMenu->addSeparator();
QMenu *alignMenu = toolsMenu->addMenu(tr("Ali&gn"));
alignMenu->addAction(tr("&Left"), this, SLOT(slotAlignLeft()));
alignMenu->addAction(tr("&Center"), this, SLOT(slotAlignCenter()));
alignMenu->addAction(tr("&Right"), this, SLOT(slotAlignRight()));
alignMenu->addAction(tr("&Hidden"), this, SLOT(slotAlignHidden()));
alignMenu->addAction(tr("&Left"), this, &MainWindow::slotAlignLeft);
alignMenu->addAction(tr("&Center"), this, &MainWindow::slotAlignCenter);
alignMenu->addAction(tr("&Right"), this, &MainWindow::slotAlignRight);
alignMenu->addAction(tr("&Hidden"), this, &MainWindow::slotAlignHidden);
toolsMenu->addSeparator();
toolsMenu->addAction(tr("&Collapse All"), this, SLOT(slotCollapseAll()));
toolsMenu->addAction(tr("&Expand All"), this, SLOT(slotExpandAll()));
toolsMenu->addAction(tr("&Collapse All"), this, &MainWindow::slotCollapseAll);
toolsMenu->addAction(tr("&Expand All"), this, &MainWindow::slotExpandAll);

mb->addMenu(toolsMenu);

Expand Down Expand Up @@ -331,7 +331,7 @@ SavePdfDialog::SavePdfDialog(QWidget *parent)
m_fileEdit->setText(QFileInfo(QDir::homePath(), "gantt.pdf").absoluteFilePath());
fileLayout->addWidget(m_fileEdit);
auto *m_fileButton = new QPushButton("...", this);
connect(m_fileButton, SIGNAL(clicked()), this, SLOT(fileButtonClicked()));
connect(m_fileButton, &QPushButton::clicked, this, &SavePdfDialog::fileButtonClicked);
fileLayout->addWidget(m_fileButton);

m_rowLabels = new QCheckBox(tr("Row Header"), this);
Expand All @@ -344,8 +344,8 @@ SavePdfDialog::SavePdfDialog(QWidget *parent)

auto *btnBox = new QDialogButtonBox(this);
btnBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(btnBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(btnBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(btnBox, &QDialogButtonBox::accepted, this, &SavePdfDialog::accept);
connect(btnBox, &QDialogButtonBox::rejected, this, &SavePdfDialog::reject);
l->addWidget(btnBox);

resize(QSize(400, 100).expandedTo(minimumSizeHint()));
Expand Down
2 changes: 1 addition & 1 deletion examples/LeveyJennings/Simple/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SelectionAnimator : public QObject
, view(view)
{
auto *const t = new QTimer(this);
connect(t, SIGNAL(timeout()), this, SLOT(animate()));
connect(t, &QTimer::timeout, this, &SelectionAnimator::animate);
t->start(1000);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Lines/Advanced/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ MainWindow::MainWindow(QWidget *parent)
m_chart->setGlobalLeading(20, 20, 20, 20);
// Instantiate the timer
auto *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(slot_timerFired()));
connect(timer, &QTimer::timeout, this, &MainWindow::slot_timerFired);
timer->start(30);

// Change the cursor to IBeamCursor inside Chart widget.
Expand Down
14 changes: 8 additions & 6 deletions examples/ModelView/TableView/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ MainWindow::MainWindow()
initializeData();
setupViews();

connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(openAction, &QAction::triggered, this, [this] {
openFile();
});
connect(saveAction, &QAction::triggered, this, &MainWindow::saveFile);
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);

connect(m_selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
connect(m_selectionModel, &QItemSelectionModel::selectionChanged,
this, &MainWindow::selectionChanged);

connect(m_diagramView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
connect(m_diagramView, &BarDiagram::clicked, this, &MainWindow::itemClicked);

menuBar()->addMenu(fileMenu);
statusBar();
Expand Down
2 changes: 1 addition & 1 deletion examples/Pie/Advanced/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent)
m_chart->coordinatePlane()->replaceDiagram(m_pie);

m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotNextFrame()));
connect(m_timer, &QTimer::timeout, this, &MainWindow::slotNextFrame);
}

void MainWindow::on_startPositionSB_valueChanged(double pos)
Expand Down
12 changes: 6 additions & 6 deletions examples/Plotter/BigDataset/MainWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ MainWidget::MainWidget()
m_functionSelector << m_controls.sineRadio << m_controls.triangleRadio << m_controls.squareRadio
<< m_controls.noiseRadio << m_controls.oneDivSineRadio
<< m_controls.sineOneDivRadio;
foreach (QRadioButton *r, m_functionSelector) {
connect(r, SIGNAL(toggled(bool)), SLOT(functionToggled(bool)));
for (QRadioButton *r : qAsConst(m_functionSelector)) {
connect(r, &QRadioButton::toggled, this, &MainWidget::functionToggled);
}

connect(m_controls.runButton, SIGNAL(toggled(bool)),
&m_model, SLOT(setRunning(bool)));
connect(m_controls.runButton, &QPushButton::toggled,
&m_model, &Model::setRunning);

// order matters again
m_addPointsButtons << m_controls.add1kButton << m_controls.add10kButton << m_controls.add100kButton;
foreach (QPushButton *b, m_addPointsButtons) {
connect(b, SIGNAL(clicked(bool)), SLOT(addPointsButtonClicked()));
for (QPushButton *b : qAsConst(m_addPointsButtons)) {
connect(b, &QPushButton::clicked, this, &MainWidget::addPointsButtonClicked);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Plotter/BigDataset/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static const qreal s_stepWidth = 0.1;
Model::Model()
{
m_appendTimer.setInterval(3);
connect(&m_appendTimer, SIGNAL(timeout()), SLOT(appendPoint()));
connect(&m_appendTimer, &QTimer::timeout, this, &Model::appendPoint);
// pre-fill some values
appendPoints(100);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/Plotter/BubbleChart/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent)
m_plotter->addAxis(xAxis2);
m_plotter->addAxis(yAxis);
m_plotter->addAxis(yAxis2);
connect(threeDEnabled, SIGNAL(toggled(bool)), this, SLOT(setMarkerAttributes()));
connect(threeDEnabled, &QCheckBox::toggled, this, &MainWindow::setMarkerAttributes);

m_chart->coordinatePlane()->replaceDiagram(m_plotter);
m_chart->setGlobalLeading(20, 20, 20, 20);
Expand Down
16 changes: 9 additions & 7 deletions examples/Plotter/Timeline/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ChartWidget : public QWidget
auto *button = new QPushButton("Animate", leftWidget);
leftLayout->addWidget(button);
button->setCheckable(true);
connect(button, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));
connect(button, &QPushButton::toggled, this, &ChartWidget::buttonToggled);

auto *tv = new QTreeView(leftWidget);
leftLayout->addWidget(tv);
Expand Down Expand Up @@ -74,17 +74,19 @@ class ChartWidget : public QWidget

plotter->setModel(proxy);

connect(proxy, SIGNAL(rowsInserted(QModelIndex, int, int)),
m_chart->coordinatePlane(), SLOT(adjustRangesToData()));
connect(proxy, SIGNAL(rowsRemoved(QModelIndex, int, int)),
m_chart->coordinatePlane(), SLOT(adjustRangesToData()));
auto coordinatePlane = qobject_cast<KDChart::CartesianCoordinatePlane *>(m_chart->coordinatePlane());
connect(proxy, &TimeChartModel::rowsInserted,
coordinatePlane, &KDChart::CartesianCoordinatePlane::adjustRangesToData);
connect(proxy, &TimeChartModel::rowsRemoved,
coordinatePlane, &KDChart::CartesianCoordinatePlane::adjustRangesToData);

proxy->setVisibleRange(QDateTime(QDate(2010, 3, 15), QTime()),
QDateTime(QDate(2010, 5, 18), QTime()));
qobject_cast<KDChart::CartesianCoordinatePlane *>(m_chart->coordinatePlane())->adjustRangesToData();
coordinatePlane->adjustRangesToData();


m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
connect(m_timer, &QTimer::timeout, this, &ChartWidget::slotTimeout);
}
private slots:
void slotTimeout()
Expand Down
4 changes: 2 additions & 2 deletions examples/RealTime/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class ChartWidget : public QWidget
l->addWidget(&m_chart);
setLayout(l);
m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()),
this, SLOT(slotTimeout()));
connect(m_timer, &QTimer::timeout,
this, &ChartWidget::slotTimeout);
m_timer->start(200);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Stock/Advanced/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent)
m_diagram.addAxis(bottomAxis);
m_diagram.addAxis(bottomAxis);
applyColor(QColor("chartreuse"));
const bool connected = connect(colorChooser, SIGNAL(clicked()), SLOT(chooseColor()));
const bool connected = connect(colorChooser, &QPushButton::clicked, this, &MainWindow::chooseColor);
Q_ASSERT(connected);
Q_UNUSED(connected);

Expand Down
4 changes: 2 additions & 2 deletions examples/TernaryCharts/Advanced/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ MainWindow::MainWindow(QWidget *parent)

setupModel();
m_diagram->setModel(&m_model);
connect(m_diagram, SIGNAL(clicked(QModelIndex)),
SLOT(indexClicked(QModelIndex)));
connect(m_diagram, &KDChart::TernaryPointDiagram::clicked,
this, &MainWindow::indexClicked);
}

void MainWindow::setupModel()
Expand Down
Loading

0 comments on commit 60f7f21

Please sign in to comment.