##// END OF EJS Templates
Added simple demoLauncher application
Marek Rosa -
r2229:bee551388900
parent child
Show More
1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
@@ -0,0 +1,7
1 !include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
2 include(charts/charts.pri)
3
4 TARGET = demoLauncher
5 SOURCES += main.cpp\
6 widget.cpp
7 HEADERS += widget.h
@@ -0,0 +1,11
1 #include <QApplication>
2 #include "widget.h"
3
4 int main(int argc, char *argv[])
5 {
6 QApplication a(argc, argv);
7 Widget w;
8 w.show();
9
10 return a.exec();
11 }
@@ -0,0 +1,42
1 #include "widget.h"
2 #include <QPushButton>
3 #include <QDir>
4 #include <QGridLayout>
5 #include <QApplication>
6 #include <QProcess>
7 #include <QTimer>
8
9 Widget::Widget(QWidget *parent)
10 : QWidget(parent),
11 m_demoApp(0)
12 {
13 QList<QFileInfo> appList;
14
15 QDir appFolder(QApplication::applicationDirPath());
16 QStringList nameFilters;
17 nameFilters << "[^t][^s][^t]*";
18 appFolder.setNameFilters(nameFilters);
19 appList = appFolder.entryInfoList(QDir::Files);
20
21 QGridLayout* demosLayout = new QGridLayout;
22 for( int i = 0; i < appList.count(); i++) {
23 QPushButton *button = new QPushButton(appList[i].fileName());
24 connect(button, SIGNAL(clicked()), this, SLOT (runApp()));
25 demosLayout->addWidget(button, i%10, i/10);
26 }
27 setLayout(demosLayout);
28 }
29
30 Widget::~Widget()
31 {
32 m_demoApp->close();
33 }
34
35 void Widget::runApp()
36 {
37 QString name = qobject_cast<QPushButton *>(sender())->text();
38 QString program = QApplication::applicationDirPath() + QDir::separator() + name;
39
40 m_demoApp = new QProcess(this);
41 m_demoApp->start(program);
42 }
@@ -0,0 +1,24
1 #ifndef WIDGET_H
2 #define WIDGET_H
3
4 #include <QWidget>
5
6 class QProcess;
7
8 class Widget : public QWidget
9 {
10 Q_OBJECT
11
12 public:
13 Widget(QWidget *parent = 0);
14 ~Widget();
15
16 public slots:
17 void runApp();
18 // void runAppShow();
19
20 private:
21 QProcess *m_demoApp;
22 };
23
24 #endif // WIDGET_H
@@ -1,31 +1,32
1 CURRENTLY_BUILDING_COMPONENTS = "demos"
1 CURRENTLY_BUILDING_COMPONENTS = "demos"
2 !include( ../config.pri ) {
2 !include( ../config.pri ) {
3 error( "Couldn't find the config.pri file!" )
3 error( "Couldn't find the config.pri file!" )
4 }
4 }
5
5
6 TEMPLATE = subdirs
6 TEMPLATE = subdirs
7 SUBDIRS += piechartcustomization \
7 SUBDIRS += piechartcustomization \
8 dynamicspline \
8 dynamicspline \
9 nesteddonuts \
9 nesteddonuts \
10 qmlchart \
10 qmlchart \
11 qmlweather \
11 qmlweather \
12 qmlf1legends \
12 qmlf1legends \
13 qmlcustomizations \
13 qmlcustomizations \
14 qmlcustommodel \
14 qmlcustommodel \
15 chartinteractions \
15 chartinteractions \
16 qmlaxes \
16 qmlaxes \
17 qmlcustomlegend
17 qmlcustomlegend \
18 demoLauncher
18
19
19 contains(QT_CONFIG, opengl) {
20 contains(QT_CONFIG, opengl) {
20 SUBDIRS += chartthemes \
21 SUBDIRS += chartthemes \
21 qmloscilloscope \
22 qmloscilloscope \
22 chartviewer
23 chartviewer
23 } else {
24 } else {
24 message("OpenGL not available. Some demos are disabled")
25 message("OpenGL not available. Some demos are disabled")
25 }
26 }
26
27
27 contains(QT_CONFIG, multimedia) {
28 contains(QT_CONFIG, multimedia) {
28 SUBDIRS += audio
29 SUBDIRS += audio
29 } else {
30 } else {
30 message("QtMultimedia library not available. Some demos are disabled")
31 message("QtMultimedia library not available. Some demos are disabled")
31 }
32 }
General Comments 0
You need to be logged in to leave comments. Login now