##// 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
@@ -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
@@ -14,7 +14,8 SUBDIRS += piechartcustomization \
14 14 qmlcustommodel \
15 15 chartinteractions \
16 16 qmlaxes \
17 qmlcustomlegend
17 qmlcustomlegend \
18 demoLauncher
18 19
19 20 contains(QT_CONFIG, opengl) {
20 21 SUBDIRS += chartthemes \
General Comments 0
You need to be logged in to leave comments. Login now