diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-05-19 13:58:19 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-06-13 14:23:13 +0300 |
commit | cf7c6bd4900e333b45964740f0a199b9d8709a3d (patch) | |
tree | fb3e56fc1d7e9f7becad52857d282f437630a6b7 /examples/charts/horizontalstackedbarchart/main.cpp | |
parent | 143a6627b30954ae05c49bd59dd5f91427651a97 (diff) |
Revamp examples
Separate gallery example was created for widget and qml examples and
most example code was moved under those two gallery examples.
Examples left outside galleries for various reasons:
- audio: Requires multimedia, which is an optional addon
- openglseries: Requires OpenGL backend
- qmloscilloscope: Complicated hybrid C++/QML example
- qmlweather: Uses optional command line parameter
- zoomlinechart: Uses gestures, which require grabbing main window
Cleaned up the code of the remaining examples to same standard as
galleries.
Examples documentation will be updated in a separate commit.
Task-number: QTBUG-94181
Task-number: QTBUG-111053
Task-number: QTBUG-113655
Change-Id: I6a98a4386364fcb2530e2667aea95760e6ff2983
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
(cherry picked from commit 8f4629814f3df83e9ea85aebefb0e0c9929be476)
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples/charts/horizontalstackedbarchart/main.cpp')
-rw-r--r-- | examples/charts/horizontalstackedbarchart/main.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/examples/charts/horizontalstackedbarchart/main.cpp b/examples/charts/horizontalstackedbarchart/main.cpp deleted file mode 100644 index cd507f12..00000000 --- a/examples/charts/horizontalstackedbarchart/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only - -#include <QtWidgets/QApplication> -#include <QtWidgets/QMainWindow> -#include <QtCharts/QChartView> -#include <QtCharts/QBarSeries> -#include <QtCharts/QBarSet> -#include <QtCharts/QLegend> -#include <QtCharts/QBarCategoryAxis> -#include <QtCharts/QHorizontalStackedBarSeries> -#include <QtCharts/QValueAxis> - -QT_USE_NAMESPACE - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - -//![1] - QBarSet *set0 = new QBarSet("Jane"); - QBarSet *set1 = new QBarSet("John"); - QBarSet *set2 = new QBarSet("Axel"); - QBarSet *set3 = new QBarSet("Mary"); - QBarSet *set4 = new QBarSet("Samantha"); - - *set0 << 1 << 2 << 3 << 4 << 5 << 6; - *set1 << 5 << 0 << 0 << 4 << 0 << 7; - *set2 << 3 << 5 << 8 << 13 << 8 << 5; - *set3 << 5 << 6 << 7 << 3 << 4 << 5; - *set4 << 9 << 7 << 5 << 3 << 1 << 2; -//![1] - -//![2] - QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries(); - series->append(set0); - series->append(set1); - series->append(set2); - series->append(set3); - series->append(set4); - -//![2] - -//![3] - QChart *chart = new QChart(); - chart->addSeries(series); - chart->setTitle("Simple horizontal stacked barchart example"); - chart->setAnimationOptions(QChart::SeriesAnimations); -//![3] - -//![4] - QStringList categories; - categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; - QBarCategoryAxis *axisY = new QBarCategoryAxis(); - axisY->append(categories); - chart->addAxis(axisY, Qt::AlignLeft); - series->attachAxis(axisY); - QValueAxis *axisX = new QValueAxis(); - chart->addAxis(axisX, Qt::AlignBottom); - series->attachAxis(axisX); -//![4] - -//![5] - chart->legend()->setVisible(true); - chart->legend()->setAlignment(Qt::AlignBottom); -//![5] - -//![6] - QChartView *chartView = new QChartView(chart); - chartView->setRenderHint(QPainter::Antialiasing); -//![6] - -//![7] - QMainWindow window; - window.setCentralWidget(chartView); - window.resize(420, 300); - window.show(); -//![7] - - return a.exec(); -} |