[Interest] QML import from database

Alan Alpert 416365416c at gmail.com
Thu Aug 8 19:13:17 CEST 2013

Have you tried using a Loader? If StackView can't cope with delayed
loading components, then you can have an immediately loaded loader
which wraps the delayed loading. Something like:

Loader {
    id: pushThisIntoPagestack
    sourceComponent: Component { MyComponents.SomeType {
    } }

Also you shouldn't need the extra event loop. That might even be
messing things up, QML often breaks if you run your own event loop on
the side.

Alan Alpert

On Thu, Aug 8, 2013 at 9:18 AM, Bruno Tezine <bruno at tezine.com> wrote:
> Hi,
> I have a Qt Quick project that should import all of its internal QML
> components from a database instead of Qt resource system or the filesystem.
> Here is an example:
> import "view:///MyComponents" as MyComponents
> import QtQuick 2.1
> import QtQuick.Controls 1.0
> MyComponents.VTopWindow{
>      id: mainWindow
>      MyComponents.VPageTitle{
>          id: pageTitle;
>          title: 'VMini'
>      }
>      ...
> }
> It works when I execute the following code in c++ before running
> QQuickView.show():
> if(quickView->status()!=QQuickView::Ready){
>          QEventLoop loop;
>          QObject::connect(quickView,
> SIGNAL(statusChanged(QQuickView::Status)), &loop, SLOT(quit()));
>          loop.exec();
> }
> quickView->show();
> The problem appears when I try to push one of these qmls into a
> StackView. I always get the error: "Component is not ready".
> I have already created a NetworkAccessManager to load all qmls that come
> with "view" prefix from the database, but it seems that the StackView
> doesn't wait until all qmls are loaded.
> Any ideas how to make it work?
> Thank you,
>      Bruno.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

More information about the Interest mailing list