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