Hi Pekka,

Thanks for your suggestion.

Den 17-08-2011 07:57, [email protected] skrev:
> Hi, Have you tried to use the push/replace directly from the
> PageStack instead of implementing your own setPage function? This way
> you do not need to worry about the parenting nor the geometries.

I have tried something like it, but not this exactly.

> So, something like QMetaObject::invokeMethod(pageStack, "push",
> Q_ARG(QVariant, qVariantFromValue(mComponent));

QMetaObject::invokeMethod: No such method 
PageStack_QMLTYPE_17::push(QVariant)

I got the same when I tried calling replace.

This is the reason I created a function for it.

The QML file looks like this:

Window {
     id: window
     objectName: "mainWindow"
     PageStack {
         id: pageStack
         objectName: "pageStack"
         anchors.fill: parent
     }
}

The call is made this way:

QDeclarativeItem* const pageStack =
   QMLView::getInstance()->rootObject()
     ->findChild<QDeclarativeItem*>("pageStack");
Q_ASSERT(pageStack);
QMetaObject::invokeMethod(pageStack, "push",
   Q_ARG(QVariant, qVariantFromValue(page->component())));

The page->component() returns a Component object that is valid. (But 
that's not the error anyway.)

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to