Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

QQuickView vs QDeclarativeView

$
0
0
Hi, thanks for your answer! I’m reassured and glad to know QQuickView is the way to go, though I still need to figure out the optimal way how to achieve what I want. I’d rather keep everything contained inside the plugins instead of messing around with external resource files. Because my original post could have been clearer, here’s exactly what I would like to achieve; 1. Application loads a shared library, which has a QML file integrated as a resource. These are defined with a prefix which is identical to the IID of the plugin; 2. Immediately after loading the plugin, it would look for the availability of this QML file (using QResource) and if it’s present, create it as an unparented QQuickItem from the C++ side; 3. Connect the signals/slots from this QML file to C++ slots from this plugin; 4. Insert the QQuickItem into the QQuickView. (reparent it to the rootObject?) As far as I can tell, the only way to create the QML component is to do it from within QtQuick (using Qt.createComponent) and that’s precisely what i would like to avoid because it means I would need to ‘switch’ back and forth between QtQuick and C++ several times (using signals) Here’s my current approach: 1. Load plugin, check for availability of QML file within; 2. Send path of resource to QtQuick through a signal, and create the component there (with Qt.createComponent). When done, send signal back to C++ backend 3. Use QQuickView.findChild to look for the objectName of this component and retrieve a QQuickItem; 4. Connect slots and signals; 5. Send signal back to QtQuick to notify it’s ready and continue initialisation of plugin. Since some of the plugins also require the use of SQL (with a ListView or GridView in QtQuick), there needs to be an additional step using QQmlContext.setContextProperty in there in there as well. So, as you can imagine, I need several extra signals and slots on both sides to get it working, in addition to storing the currently processed plugin as a tempory variable since this process can’t be contained within a single scope. Thanks for reading once again!

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images