main.cpp
61 lines
| 1.8 KiB
| text/x-c
|
CppLexer
Jani Honkonen
|
r830 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 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$ | ||||
** | ||||
****************************************************************************/ | ||||
Michal Klocek
|
r131 | #include <QApplication> | ||
#include <QMainWindow> | ||||
#include <qchartview.h> | ||||
Michal Klocek
|
r349 | #include <qlineseries.h> | ||
Michal Klocek
|
r131 | #include <qchart.h> | ||
#include <cmath> | ||||
Michal Klocek
|
r133 | #include "wavegenerator.h" | ||
Michal Klocek
|
r145 | #include <QGLWidget> | ||
Michal Klocek
|
r131 | |||
int main(int argc, char *argv[]) | ||||
{ | ||||
QApplication a(argc, argv); | ||||
QMainWindow window; | ||||
Michal Klocek
|
r349 | QLineSeries* series0 = new QLineSeries(); | ||
Michal Klocek
|
r131 | QPen blue(Qt::blue); | ||
blue.setWidth(3); | ||||
series0->setPen(blue); | ||||
Michal Klocek
|
r349 | QLineSeries* series1 = new QLineSeries(); | ||
Michal Klocek
|
r131 | QPen red(Qt::red); | ||
red.setWidth(3); | ||||
series1->setPen(red); | ||||
Michal Klocek
|
r133 | WaveGenerator generator(series0,series1); | ||
Michal Klocek
|
r131 | |||
QChartView* chartView = new QChartView(&window); | ||||
Michal Klocek
|
r145 | chartView->setViewport( new QGLWidget() ); | ||
Michal Klocek
|
r131 | chartView->setRenderHint(QPainter::Antialiasing); | ||
Michal Klocek
|
r391 | chartView->setAnimationOptions(QChart::AllAnimations); | ||
Michal Klocek
|
r192 | chartView->setChartTitle("This is wave generator buahha."); | ||
Michal Klocek
|
r131 | chartView->addSeries(series0); | ||
chartView->addSeries(series1); | ||||
window.setCentralWidget(chartView); | ||||
window.resize(400, 300); | ||||
window.show(); | ||||
return a.exec(); | ||||
} | ||||