##// END OF EJS Templates
Updated tools folder...
Titta Heikkala -
r2846:9d857959743f
parent child
Show More
@@ -1,7 +1,8
1 QT += core gui widgets
1 TARGET = demoLauncher
2 TARGET = demoLauncher
2 SOURCES += main.cpp\
3 SOURCES += main.cpp\
3 widget.cpp \
4 widget.cpp \
4 graphicsbutton.cpp
5 graphicsbutton.cpp
5
6
6 HEADERS += widget.h \
7 HEADERS += widget.h \
7 graphicsbutton.h
8 graphicsbutton.h
@@ -1,60 +1,60
1 /******************************************************************************
1 /******************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
4 ** Contact: http://www.qt.io/licensing/
5 **
5 **
6 ** This file is part of the Qt Charts module.
6 ** This file is part of the Qt Charts module.
7 **
7 **
8 ** $QT_BEGIN_LICENSE:COMM$
8 ** $QT_BEGIN_LICENSE:COMM$
9 **
9 **
10 ** Commercial License Usage
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** and conditions see http://www.qt.io/terms-conditions. For further
16 ** information use the contact form at http://www.qt.io/contact-us.
16 ** information use the contact form at http://www.qt.io/contact-us.
17 **
17 **
18 ** $QT_END_LICENSE$
18 ** $QT_END_LICENSE$
19 **
19 **
20 ******************************************************************************/
20 ******************************************************************************/
21
21
22 #include "graphicsbutton.h"
22 #include "graphicsbutton.h"
23 #include <QPainter>
23 #include <QtGui/QPainter>
24 #include <QProcess>
24 #include <QtCore/QProcess>
25 #include <QMouseEvent>
25 #include <QtGui/QMouseEvent>
26
26
27 GraphicsButton::GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent) :
27 GraphicsButton::GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent) :
28 QWidget(parent),
28 QWidget(parent),
29 m_path(path),
29 m_path(path),
30 m_appFolder(appFolder),
30 m_appFolder(appFolder),
31 m_app(app),
31 m_app(app),
32 m_demoApp(0)
32 m_demoApp(0)
33 {
33 {
34 m_pixmap = QPixmap(path);
34 m_pixmap = QPixmap(path);
35 }
35 }
36
36
37 GraphicsButton::~GraphicsButton()
37 GraphicsButton::~GraphicsButton()
38 {
38 {
39 if (m_demoApp)
39 if (m_demoApp)
40 m_demoApp->close();
40 m_demoApp->close();
41 }
41 }
42
42
43 void GraphicsButton::mousePressEvent(QMouseEvent *event)
43 void GraphicsButton::mousePressEvent(QMouseEvent *event)
44 {
44 {
45 QString program = m_appFolder.absolutePath() + QDir::separator() + m_app;
45 QString program = m_appFolder.absolutePath() + QDir::separator() + m_app;
46 if (m_demoApp) {
46 if (m_demoApp) {
47 m_demoApp->close();
47 m_demoApp->close();
48 delete m_demoApp;
48 delete m_demoApp;
49 }
49 }
50 m_demoApp = new QProcess(this);
50 m_demoApp = new QProcess(this);
51 m_demoApp->start(program);
51 m_demoApp->start(program);
52 event->accept();
52 event->accept();
53 }
53 }
54
54
55 void GraphicsButton::paintEvent(QPaintEvent *event)
55 void GraphicsButton::paintEvent(QPaintEvent *event)
56 {
56 {
57 QPainter painter(this);
57 QPainter painter(this);
58 painter.drawPixmap(0, 0, this->width(), this->height(), m_pixmap);
58 painter.drawPixmap(0, 0, this->width(), this->height(), m_pixmap);
59 QWidget::paintEvent(event);
59 QWidget::paintEvent(event);
60 }
60 }
@@ -1,49 +1,49
1 /******************************************************************************
1 /******************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
4 ** Contact: http://www.qt.io/licensing/
5 **
5 **
6 ** This file is part of the Qt Charts module.
6 ** This file is part of the Qt Charts module.
7 **
7 **
8 ** $QT_BEGIN_LICENSE:COMM$
8 ** $QT_BEGIN_LICENSE:COMM$
9 **
9 **
10 ** Commercial License Usage
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** and conditions see http://www.qt.io/terms-conditions. For further
16 ** information use the contact form at http://www.qt.io/contact-us.
16 ** information use the contact form at http://www.qt.io/contact-us.
17 **
17 **
18 ** $QT_END_LICENSE$
18 ** $QT_END_LICENSE$
19 **
19 **
20 ******************************************************************************/
20 ******************************************************************************/
21
21
22 #ifndef GRAPHICSBUTTON_H
22 #ifndef GRAPHICSBUTTON_H
23 #define GRAPHICSBUTTON_H
23 #define GRAPHICSBUTTON_H
24
24
25 #include <QWidget>
25 #include <QtWidgets/QWidget>
26 #include <QDir>
26 #include <QDir>
27
27
28 class QProcess;
28 class QProcess;
29
29
30 class GraphicsButton : public QWidget
30 class GraphicsButton : public QWidget
31 {
31 {
32 Q_OBJECT
32 Q_OBJECT
33 public:
33 public:
34 explicit GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent = 0);
34 explicit GraphicsButton(const QString &path, QDir appFolder, const QString &app, QWidget *parent = 0);
35 ~GraphicsButton();
35 ~GraphicsButton();
36
36
37 protected:
37 protected:
38 void mousePressEvent(QMouseEvent *event);
38 void mousePressEvent(QMouseEvent *event);
39 void paintEvent(QPaintEvent *event);
39 void paintEvent(QPaintEvent *event);
40
40
41 private:
41 private:
42 QPixmap m_pixmap;
42 QPixmap m_pixmap;
43 QString m_path;
43 QString m_path;
44 QDir m_appFolder;
44 QDir m_appFolder;
45 QString m_app;
45 QString m_app;
46 QProcess *m_demoApp;
46 QProcess *m_demoApp;
47 };
47 };
48
48
49 #endif // GRAPHICSBUTTON_H
49 #endif // GRAPHICSBUTTON_H
@@ -1,32 +1,32
1 /******************************************************************************
1 /******************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
4 ** Contact: http://www.qt.io/licensing/
5 **
5 **
6 ** This file is part of the Qt Charts module.
6 ** This file is part of the Qt Charts module.
7 **
7 **
8 ** $QT_BEGIN_LICENSE:COMM$
8 ** $QT_BEGIN_LICENSE:COMM$
9 **
9 **
10 ** Commercial License Usage
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** and conditions see http://www.qt.io/terms-conditions. For further
16 ** information use the contact form at http://www.qt.io/contact-us.
16 ** information use the contact form at http://www.qt.io/contact-us.
17 **
17 **
18 ** $QT_END_LICENSE$
18 ** $QT_END_LICENSE$
19 **
19 **
20 ******************************************************************************/
20 ******************************************************************************/
21
21
22 #include <QApplication>
22 #include <QtWidgets/QApplication>
23 #include "widget.h"
23 #include "widget.h"
24
24
25 int main(int argc, char *argv[])
25 int main(int argc, char *argv[])
26 {
26 {
27 QApplication a(argc, argv);
27 QApplication a(argc, argv);
28 Widget w;
28 Widget w;
29 w.show();
29 w.show();
30
30
31 return a.exec();
31 return a.exec();
32 }
32 }
@@ -1,82 +1,84
1 /******************************************************************************
1 /******************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
4 ** Contact: http://www.qt.io/licensing/
5 **
5 **
6 ** This file is part of the Qt Charts module.
6 ** This file is part of the Qt Charts module.
7 **
7 **
8 ** $QT_BEGIN_LICENSE:COMM$
8 ** $QT_BEGIN_LICENSE:COMM$
9 **
9 **
10 ** Commercial License Usage
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** and conditions see http://www.qt.io/terms-conditions. For further
16 ** information use the contact form at http://www.qt.io/contact-us.
16 ** information use the contact form at http://www.qt.io/contact-us.
17 **
17 **
18 ** $QT_END_LICENSE$
18 ** $QT_END_LICENSE$
19 **
19 **
20 ******************************************************************************/
20 ******************************************************************************/
21
21
22 #include "widget.h"
22 #include "widget.h"
23 #include <QDir>
23 #include <QtCore/QDir>
24 #include <QGridLayout>
24 #include <QtWidgets/QGridLayout>
25 #include <QApplication>
25 #include <QtWidgets/QApplication>
26 #include "graphicsbutton.h"
26 #include "graphicsbutton.h"
27
27
28 Widget::Widget(QWidget *parent)
28 Widget::Widget(QWidget *parent)
29 : QWidget(parent)
29 : QWidget(parent)
30 {
30 {
31 setMinimumSize(800, 600);
31 setMinimumSize(800, 600);
32
32
33 m_appFolder = QDir(QApplication::applicationDirPath());
33 m_appFolder = QDir(QApplication::applicationDirPath());
34 #ifdef Q_OS_MAC
34 #ifdef Q_OS_MAC
35 // The executable is inside an application bundle (a folder) on OSX
35 // The executable is inside an application bundle (a folder) on OSX
36 m_appFolder.cdUp();
36 m_appFolder.cdUp();
37 m_appFolder.cdUp();
37 m_appFolder.cdUp();
38 m_appFolder.cdUp();
38 m_appFolder.cdUp();
39 #endif
39 #endif
40
40
41 QDir imageFolder = m_appFolder;
41 QDir imageFolder = m_appFolder;
42 imageFolder.cdUp();
42 imageFolder.cdUp();
43 imageFolder.cdUp();
43 imageFolder.cdUp();
44 imageFolder.cd("src");
45 imageFolder.cd("charts");
44 imageFolder.cd("doc");
46 imageFolder.cd("doc");
45 imageFolder.cd("images");
47 imageFolder.cd("images");
46
48
47 // Create push buttons for starting the executables
49 // Create push buttons for starting the executables
48 QGridLayout* demosLayout = new QGridLayout;
50 QGridLayout* demosLayout = new QGridLayout;
49
51
50 GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "examples_audio.png", m_appFolder, "audio", this);
52 GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "examples_audio.png", m_appFolder, "audio", this);
51 demosLayout->addWidget(button, 0, 0);
53 demosLayout->addWidget(button, 0, 0);
52
54
53 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_callout.png", m_appFolder, "callout", this);
55 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_callout.png", m_appFolder, "callout", this);
54 demosLayout->addWidget(button, 0, 1);
56 demosLayout->addWidget(button, 0, 1);
55
57
56 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demo_chartthemes_blue_cerulean.png", m_appFolder, "chartthemes", this);
58 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demo_chartthemes_blue_cerulean.png", m_appFolder, "chartthemes", this);
57 demosLayout->addWidget(button, 0, 2);
59 demosLayout->addWidget(button, 0, 2);
58
60
59 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_nesteddonuts.png", m_appFolder, "nesteddonuts", this);
61 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_nesteddonuts.png", m_appFolder, "nesteddonuts", this);
60 demosLayout->addWidget(button, 1, 0);
62 demosLayout->addWidget(button, 1, 0);
61
63
62 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_zoomlinechart1.png", m_appFolder, "zoomlinechart", this);
64 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_zoomlinechart1.png", m_appFolder, "zoomlinechart", this);
63 demosLayout->addWidget(button, 1, 1);
65 demosLayout->addWidget(button, 1, 1);
64
66
65 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_stackedbarchartdrilldown1.png", m_appFolder, "stackedbarchartdrilldown", this);
67 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_stackedbarchartdrilldown1.png", m_appFolder, "stackedbarchartdrilldown", this);
66 demosLayout->addWidget(button, 1, 2);
68 demosLayout->addWidget(button, 1, 2);
67
69
68 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"piechart_customization.png", m_appFolder, "piechartcustomization", this);
70 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"piechart_customization.png", m_appFolder, "piechartcustomization", this);
69 demosLayout->addWidget(button, 2, 0);
71 demosLayout->addWidget(button, 2, 0);
70
72
71 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_datetimeaxis.png", m_appFolder, "datetimeaxis", this);
73 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_datetimeaxis.png", m_appFolder, "datetimeaxis", this);
72 demosLayout->addWidget(button, 2, 1);
74 demosLayout->addWidget(button, 2, 1);
73
75
74 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_donutbreakdown.png", m_appFolder, "donutbreakdown", this);
76 button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_donutbreakdown.png", m_appFolder, "donutbreakdown", this);
75 demosLayout->addWidget(button, 2, 2);
77 demosLayout->addWidget(button, 2, 2);
76
78
77 setLayout(demosLayout);
79 setLayout(demosLayout);
78 }
80 }
79
81
80 Widget::~Widget()
82 Widget::~Widget()
81 {
83 {
82 }
84 }
@@ -1,40 +1,40
1 /******************************************************************************
1 /******************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
4 ** Contact: http://www.qt.io/licensing/
5 **
5 **
6 ** This file is part of the Qt Charts module.
6 ** This file is part of the Qt Charts module.
7 **
7 **
8 ** $QT_BEGIN_LICENSE:COMM$
8 ** $QT_BEGIN_LICENSE:COMM$
9 **
9 **
10 ** Commercial License Usage
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** and conditions see http://www.qt.io/terms-conditions. For further
16 ** information use the contact form at http://www.qt.io/contact-us.
16 ** information use the contact form at http://www.qt.io/contact-us.
17 **
17 **
18 ** $QT_END_LICENSE$
18 ** $QT_END_LICENSE$
19 **
19 **
20 ******************************************************************************/
20 ******************************************************************************/
21
21
22 #ifndef WIDGET_H
22 #ifndef WIDGET_H
23 #define WIDGET_H
23 #define WIDGET_H
24
24
25 #include <QWidget>
25 #include <QtWidgets/QWidget>
26 #include <QDir>
26 #include <QDir>
27
27
28 class Widget : public QWidget
28 class Widget : public QWidget
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31
31
32 public:
32 public:
33 Widget(QWidget *parent = 0);
33 Widget(QWidget *parent = 0);
34 ~Widget();
34 ~Widget();
35
35
36 private:
36 private:
37 QDir m_appFolder;
37 QDir m_appFolder;
38 };
38 };
39
39
40 #endif // WIDGET_H
40 #endif // WIDGET_H
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now