hi forum.my qml:
ListModel {
id: list
objectName:"list"
}
ListModel {
id: list
objectName:"list"
}
To copy to clipboard, switch view to plain text mode
my cpp:
int main( int argc, char ** argv )
{
QGuiApplication app(argc,argv);
QQmlApplicationEngine* engine = new QQmlApplicationEngine();
engine
->load
(QUrl::fromLocalFile("main.qml"));
QObject* root
= engine
->rootObjects
()[0];
QObject* list
= root
->findChild<QObject
*>
("list");
QString qq
("list.append({\"file\":\"/home/pc/afile\", \"mode\":660})");
QQmlExpression zz(engine->rootContext(), root, qq);
zz.evaluate();
if(zz.hasError())qDebug()<<"No luck";
return app.exec();
}
int main( int argc, char ** argv )
{
QGuiApplication app(argc,argv);
QQmlApplicationEngine* engine = new QQmlApplicationEngine();
engine->load(QUrl::fromLocalFile("main.qml"));
QObject* root = engine->rootObjects()[0];
QObject* list = root->findChild<QObject*>("list");
QString qq("list.append({\"file\":\"/home/pc/afile\", \"mode\":660})");
QQmlExpression zz(engine->rootContext(), root, qq);
zz.evaluate();
if(zz.hasError())qDebug()<<"No luck";
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Above approach didnt work.i already tried 3-4 diffrerent approach.but no luck. always i get "No luck"
BTW: FileDialog from QtQuick.Dialogs didnt work for me.
import QtQuick 2.3
import QtQuick.Dialogs 1.1
FileDialog {
title: "Please choose a file"
Component.onCompleted: visible = true
}
import QtQuick 2.3
import QtQuick.Dialogs 1.1
FileDialog {
title: "Please choose a file"
Component.onCompleted: visible = true
}
To copy to clipboard, switch view to plain text mode
[pc@pc ~]$ qmlscene-qt5 above.qml
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
QObject::connect: No such
signal org
::freedesktop::UPower::DeviceAdded(QString) QObject::connect: No such
signal org
::freedesktop::UPower::DeviceRemoved(QString) "URL cannot be listed
trash:/"
"URL cannot be listed
trash:/"
KSambaShare: Could not find smb.conf!
[pc@pc ~]$
[pc@pc ~]$ qmlscene-qt5 above.qml
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
QObject::connect: No such signal org::freedesktop::UPower::DeviceAdded(QString)
QObject::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QString)
"URL cannot be listed
trash:/"
"URL cannot be listed
trash:/"
KSambaShare: Could not find smb.conf!
[pc@pc ~]$
To copy to clipboard, switch view to plain text mode
anyone can help me a bit. i am using 64bit arch-linux with updated.Thanks.
Bookmarks