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