![]() |
2013-01-29
, 14:56
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#2
|
![]() |
2013-01-29
, 15:00
|
Posts: 15 |
Thanked: 2 times |
Joined on Sep 2012
|
#3
|
![]() |
2013-01-29
, 15:35
|
|
Posts: 2,448 |
Thanked: 9,523 times |
Joined on Aug 2010
@ Wigan, UK
|
#4
|
![]() |
2013-01-29
, 15:47
|
Posts: 15 |
Thanked: 2 times |
Joined on Sep 2012
|
#5
|
![]() |
2013-01-29
, 16:10
|
|
Posts: 2,448 |
Thanked: 9,523 times |
Joined on Aug 2010
@ Wigan, UK
|
#6
|
Nice one, exactly what I was looking for. Thank you very much!
But I have a question which I couldn't figure out - at least not yet. Let's say I'd like to list the current files and folders in directory "/home/user/" for example, how I do that?
EDIT * I do know that using 'ls' or 'ls -a' lists the files and folders, but how I make the list using using TextArea for example.
I don't actually need that one yet, but for future projects if I need it some day.
Page { id: root Process { id: process workingDirectory: "/home/user" command: "ls" onFinished: textArea.text = process.readAllStandardOutput() } TextArea { id: textArea anchors.centerIn: parent } Component.onCompleted: process.start() }
The Following 2 Users Say Thank You to marxian For This Useful Post: | ||
![]() |
2013-04-29
, 19:18
|
Posts: 15 |
Thanked: 2 times |
Joined on Sep 2012
|
#8
|
#include <QtGui/QApplication> #include <QtDeclarative> #include "qmlapplicationviewer.h" #include "qdeclarativeprocess.h" #include "qdeclarativesettings.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; qmlRegisterType<QDeclarativeProcess>("org.component.Processes", 1, 0, "Process"); qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes"); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/filecontrol/main.qml")); viewer.showExpanded(); return app->exec(); }
![]() |
2013-04-29
, 20:01
|
|
Posts: 2,448 |
Thanked: 9,523 times |
Joined on Aug 2010
@ Wigan, UK
|
#9
|
Hmm.. I have a problem that I just can not figure out by myself.
When I use your qdeclarativesettings.h and *.cpp files it complains about the <QDeclarativeProcess> in main.cpp file. Well, I found your qdeclarativeprocess.h and *.cpp files and that made it.
However it now complains about "...\main.cpp:13: error: no matching function for call to 'qmlRegisterUncreatableType(const char [24], int, int, const char [10])'". Here's the main.cpp file:
If I try without the line it complains about (line 13: qmlRegisterUncreatableType<QDeclarativeProcessEnum s>) it works without any problems. Well, then it only displays onError statement in my *.qml file and not the onFinished state.Code:#include <QtGui/QApplication> #include <QtDeclarative> #include "qmlapplicationviewer.h" #include "qdeclarativeprocess.h" #include "qdeclarativesettings.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; qmlRegisterType<QDeclarativeProcess>("org.component.Processes", 1, 0, "Process"); qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes"); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/filecontrol/main.qml")); viewer.showExpanded(); return app->exec(); }
Any advice what I'm doing wrong here? I have added *.cpp and *.h files in *.pro file so that should not be a problem.
qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes", "Cannot be created in QML");
The Following User Says Thank You to marxian For This Useful Post: | ||
![]() |
2013-04-30
, 03:02
|
Posts: 15 |
Thanked: 2 times |
Joined on Sep 2012
|
#10
|
There is a missing argument (the error string) in your call to qmlRegisterUncreatableType. The error string can be anything you like, for example:
Code:qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes", "Cannot be created in QML");
I have done few basic applications for my own usage and fun. I haven't found any kind of information of how to execute a command through terminal? For instance, let's say that I would like to simply display a basic functions such as showing the IP.
How am I able to do that? Do I need to call the command through SSH or directly into terminal?
Appreciated!