qml in qt4 - ugly shit... Some experiments

This commit is contained in:
Samoilenko Yuri 2014-01-29 09:16:23 +04:00
parent 42b927bcab
commit 9ce35fbd4d
2 changed files with 39 additions and 11 deletions

View file

@ -5,6 +5,7 @@
#include <QCoreApplication>
#include <qdeclarativeexpression.h>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include "responsewaiter.h"
@ -73,22 +74,21 @@ void DBusResponse::onCallFinished(QDBusPendingCallWatcher* watcher)
qDebug() << "ocf 2";
if (call->isError())
{
qDebug() << "ocf 3";
// onError failure = watcher->property("onError").value<onError>();
// failure(call->error().message());
}
else
{
qDebug() << "ocf 4444";
qDebug() << "ocf 4444:" << this;
// onComplete success = watcher->property("onComplete").value<onComplete>();
QDeclarativeExpression *expr = new QDeclarativeExpression(e_->rootContext(), this, "console.debug(this.onError)");
// e_->rootContext()->setContextProperty("test_func", m_onSuccess);
QDeclarativeExpression *expr = new QDeclarativeExpression(e_->rootContext(), this, "wow");
qDebug() << "ocf 555";
expr->evaluate(); // result = 400
qDebug() << "ocf 666";
// qDebug() << "ocf 666" << expr->error();
//
QDBusMessage reply = call->reply();
if (reply.arguments().count() > 0)

View file

@ -28,17 +28,45 @@ PlasmaComponents.ListItem
id: root
property string deviceId: model.deviceId
property variant sftp: null
DBusResponse
{
id: resp
function wow() {
console.log("wow")
}
}
Component.onCompleted: {
sftp = SftpDbusInterfaceFactory.create(deviceId)
// resp.wow()
// resp.wow()
// resp.wow()
// resp.func = bb
resp.pendingCall = sftp.isMounted()
var response = DBusResponseFactory.create()
response.onSuccess = function(v) {console.log("gggggggggggggggggg", v)}
response.pendingCall = sftp.isMounted()
/*
response.onSuccess = bb;
// function (v) {
// console.debug("SUCCESSS");
// console.debug(v);
// }
console.log("o3")
response.onError = function(v) {console.log("eeeeee")}
console.log("o4")
response.pendingCall = sftp.isMounted()
console.log("o5")
console.log("o5")*/
// rr.pendingCall = 1;
// onCompleted: {