diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-09 08:55:09 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-09 09:13:06 +0300 |
commit | 5f02a038891db0cfd6a9fa08d7576141485e5d71 (patch) | |
tree | 383c8173283a043d0815f85d1745a771554fbc2d /examples/widget/main.cpp | |
parent | 36e42a1988e5c88c76c06415a1aaa19209a6e720 (diff) |
Renamed examples
Task-number: QTRD-2418
Change-Id: Ic0cae9a8caebcbd0f1cf57eb98fb7d543d7d7289
Change-Id: Ic0cae9a8caebcbd0f1cf57eb98fb7d543d7d7289
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/widget/main.cpp')
-rw-r--r-- | examples/widget/main.cpp | 211 |
1 files changed, 0 insertions, 211 deletions
diff --git a/examples/widget/main.cpp b/examples/widget/main.cpp deleted file mode 100644 index 158244b4..00000000 --- a/examples/widget/main.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************** -** -** 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#include "graphmodifier.h" - -#include <QApplication> -#include <QWidget> -#include <QHBoxLayout> -#include <QVBoxLayout> -#include <QPushButton> -#include <QCheckBox> -#include <QSlider> -#include <QFontComboBox> -#include <QLabel> -#include <QScreen> -#include <QFontDatabase> - -int main(int argc, char **argv) -{ - //! [0] - QApplication app(argc, argv); - Q3DBars *widgetgraph = new Q3DBars(); - QWidget *container = QWidget::createWindowContainer(widgetgraph); - //! [0] - - QSize screenSize = widgetgraph->screen()->size(); - container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5)); - container->setMaximumSize(screenSize); - container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - container->setFocusPolicy(Qt::StrongFocus); - - //! [1] - QWidget *widget = new QWidget; - QHBoxLayout *hLayout = new QHBoxLayout(widget); - QVBoxLayout *vLayout = new QVBoxLayout(); - hLayout->addWidget(container, 1); - hLayout->addLayout(vLayout); - //! [1] - - widget->setWindowTitle(QStringLiteral("Average temperatures in Oulu, Finland (2006-2012)")); - - QComboBox *themeList = new QComboBox(widget); - themeList->addItem(QStringLiteral("Qt")); - themeList->addItem(QStringLiteral("Primary Colors")); - themeList->addItem(QStringLiteral("Digia")); - themeList->addItem(QStringLiteral("Stone Moss")); - themeList->addItem(QStringLiteral("Army Blue")); - themeList->addItem(QStringLiteral("Retro")); - themeList->addItem(QStringLiteral("Ebony")); - themeList->addItem(QStringLiteral("Isabelle")); - themeList->setCurrentIndex(0); - - QPushButton *labelButton = new QPushButton(widget); - labelButton->setText(QStringLiteral("Change label style")); - - QCheckBox *smoothCheckBox = new QCheckBox(widget); - smoothCheckBox->setText(QStringLiteral("Smooth bars")); - smoothCheckBox->setChecked(false); - - QComboBox *barStyleList = new QComboBox(widget); - barStyleList->addItem(QStringLiteral("Bars")); - barStyleList->addItem(QStringLiteral("Pyramids")); - barStyleList->addItem(QStringLiteral("Cones")); - barStyleList->addItem(QStringLiteral("Cylinders")); - barStyleList->addItem(QStringLiteral("Beveled Bars")); - barStyleList->setCurrentIndex(4); - - QPushButton *cameraButton = new QPushButton(widget); - cameraButton->setText(QStringLiteral("Change camera preset")); - - QComboBox *selectionModeList = new QComboBox(widget); - selectionModeList->addItem(QStringLiteral("None")); - selectionModeList->addItem(QStringLiteral("Bar")); - selectionModeList->addItem(QStringLiteral("Bar and Row")); - selectionModeList->addItem(QStringLiteral("Bar and Column")); - selectionModeList->addItem(QStringLiteral("Bar, Row and Column")); - selectionModeList->addItem(QStringLiteral("Slice into Row")); - selectionModeList->addItem(QStringLiteral("Slice into Column")); - selectionModeList->setCurrentIndex(1); - - QCheckBox *backgroundCheckBox = new QCheckBox(widget); - backgroundCheckBox->setText(QStringLiteral("Show background")); - backgroundCheckBox->setChecked(false); - - QCheckBox *gridCheckBox = new QCheckBox(widget); - gridCheckBox->setText(QStringLiteral("Show grid")); - gridCheckBox->setChecked(true); - - //! [4] - QSlider *rotationSliderX = new QSlider(Qt::Horizontal, widget); - rotationSliderX->setTickInterval(30); - rotationSliderX->setTickPosition(QSlider::TicksBelow); - rotationSliderX->setMinimum(-180); - rotationSliderX->setValue(0); - rotationSliderX->setMaximum(180); - QSlider *rotationSliderY = new QSlider(Qt::Horizontal, widget); - rotationSliderY->setTickInterval(15); - rotationSliderY->setTickPosition(QSlider::TicksAbove); - rotationSliderY->setMinimum(-90); - rotationSliderY->setValue(0); - rotationSliderY->setMaximum(90); - //! [4] - - QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, widget); - fontSizeSlider->setTickInterval(10); - fontSizeSlider->setTickPosition(QSlider::TicksBelow); - fontSizeSlider->setMinimum(1); - fontSizeSlider->setValue(30); - fontSizeSlider->setMaximum(100); - - QFontComboBox *fontList = new QFontComboBox(widget); - fontList->setCurrentFont(QFont("Times New Roman")); - - QComboBox *shadowQuality = new QComboBox(widget); - shadowQuality->addItem(QStringLiteral("None")); - shadowQuality->addItem(QStringLiteral("Low")); - shadowQuality->addItem(QStringLiteral("Medium")); - shadowQuality->addItem(QStringLiteral("High")); - shadowQuality->addItem(QStringLiteral("Low Soft")); - shadowQuality->addItem(QStringLiteral("Medium Soft")); - shadowQuality->addItem(QStringLiteral("High Soft")); - shadowQuality->setCurrentIndex(5); - - //! [5] - vLayout->addWidget(new QLabel(QStringLiteral("Rotate horizontally"))); - vLayout->addWidget(rotationSliderX, 0, Qt::AlignTop); - vLayout->addWidget(new QLabel(QStringLiteral("Rotate vertically"))); - vLayout->addWidget(rotationSliderY, 0, Qt::AlignTop); - //! [5] - vLayout->addWidget(labelButton, 0, Qt::AlignTop); - vLayout->addWidget(cameraButton, 0, Qt::AlignTop); - vLayout->addWidget(backgroundCheckBox); - vLayout->addWidget(gridCheckBox); - vLayout->addWidget(smoothCheckBox, 0, Qt::AlignTop); - vLayout->addWidget(new QLabel(QStringLiteral("Change bar style"))); - vLayout->addWidget(barStyleList); - vLayout->addWidget(new QLabel(QStringLiteral("Change selection mode"))); - vLayout->addWidget(selectionModeList); - vLayout->addWidget(new QLabel(QStringLiteral("Change theme"))); - vLayout->addWidget(themeList); - vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality"))); - vLayout->addWidget(shadowQuality); - vLayout->addWidget(new QLabel(QStringLiteral("Change font"))); - vLayout->addWidget(fontList); - vLayout->addWidget(new QLabel(QStringLiteral("Adjust font size"))); - vLayout->addWidget(fontSizeSlider, 1, Qt::AlignTop); - - //! [2] - GraphModifier *modifier = new GraphModifier(widgetgraph); - //! [2] - - //! [6] - QObject::connect(rotationSliderX, &QSlider::valueChanged, modifier, &GraphModifier::rotateX); - QObject::connect(rotationSliderY, &QSlider::valueChanged, modifier, &GraphModifier::rotateY); - //! [6] - - QObject::connect(labelButton, &QPushButton::clicked, modifier, - &GraphModifier::changeLabelStyle); - QObject::connect(cameraButton, &QPushButton::clicked, modifier, - &GraphModifier::changePresetCamera); - - QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, modifier, - &GraphModifier::setBackgroundEnabled); - QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier, - &GraphModifier::setGridEnabled); - QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, modifier, - &GraphModifier::setSmoothBars); - - QObject::connect(barStyleList, SIGNAL(currentIndexChanged(int)), modifier, - SLOT(changeStyle(int))); - - QObject::connect(selectionModeList, SIGNAL(currentIndexChanged(int)), modifier, - SLOT(changeSelectionMode(int))); - - QObject::connect(themeList, SIGNAL(currentIndexChanged(int)), modifier, - SLOT(changeTheme(int))); - - QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier, - SLOT(changeShadowQuality(int))); - - QObject::connect(modifier, &GraphModifier::shadowQualityChanged, shadowQuality, - &QComboBox::setCurrentIndex); - QObject::connect(widgetgraph, &Q3DBars::shadowQualityChanged, modifier, - &GraphModifier::shadowQualityUpdatedByVisual); - - QObject::connect(fontSizeSlider, &QSlider::valueChanged, modifier, - &GraphModifier::changeFontSize); - QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier, - &GraphModifier::changeFont); - - //! [3] - widget->show(); - modifier->start(); - return app.exec(); - //! [3] -} |