Deprecated: Non-static method Joomla\CMS\Application\SiteApplication::getMenu() should not be called statically in /home/berryinf/public_html/templates/gk_magazine/lib/framework/helper.layout.php on line 152

Deprecated: Non-static method Joomla\CMS\Application\CMSApplication::getMenu() should not be called statically in /home/berryinf/public_html/libraries/src/Application/SiteApplication.php on line 275

Quick Tip: Update QML on a live device in real-time! Featured

UI testing just got a great deal easier for Cascades developers! Developers can now make changes to their QML, and when the file is saved in the Momentics IDE, the changes are instantly seen on the currently paired test device. Want to use this? If so, follow along below.

 First, make sure you are using the latest IDE and using an API level of 10.2. Once that is verified, open the 'Window' menu and go to Window->Preferences > BlackBerry > check the "Send QML files to device on save" checkbox. Save your preferences.

Easy so far...

Next, you will need to add some code to your projects in which you want to use this new feature, so below is a quick way to make that happen.

In your project's 'src' directory create a new directory and name it 'support', and in that directory place the qmlbeam.cpp and qmlbeam.h files attached to the bottom of this post.

Once this is done, open your application cpp file (typically called applicationui.cpp) and add the following two lines (in bold)

#include "applicationui.hpp"
#include "support/qmlbeam.h"
#include <bb/cascades/Application> #include <bb/cascades/QmlDocument> #include <bb/cascades/AbstractPane> #include <bb/cascades/LocaleHandler> using namespace bb::cascades; ApplicationUI::ApplicationUI(bb::cascades::Application *app) : QObject(app) { // prepare the localization mTranslator = new QTranslator(this); mLocaleHandler = new LocaleHandler(this); bool res = QObject::connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged())); // This is only available in Debug builds Q_ASSERT(res); // Since the variable is not used in the app, this is added to avoid a // compiler warning Q_UNUSED(res); // initial load onSystemLanguageChanged(); // Create scene document from main.qml asset, the parent is set // to ensure the document gets destroyed properly at shut down. QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); // Create root object for the UI AbstractPane *root = qml->createRootObject<abstractpane>(); // Set created root object as the application scene app->setScene(root); // Add DevelopmentSupport, so that QML is reloaded on the fly. If a non-default // name of the main file asset is used the mainFile property can be set by calling // setMainFile() function on the qmlBeam object (responsible for beaming up the new QML).

new QmlBeam(this); }

Now, compile and deploy your project to your paired device, and you will see your QML changes occur in real time on your device each time you save a QML document!

Note: Thanks to BerryReview for pointing out the availablity of this feature


Leave your comments

Post comment as a guest


People in this conversation

  • Guest (Martin Allen)

    I am happy to read article about QML update, you have made a great effort in making this post which is appreciable. I must say you have work hard in collecting data to write this post. Keep writing more similar articles they are good to read.
    visit website to buy playground tiles from our online shop

    Like 0 Short URL:
  • Guest (Jahon)

    In the post seeing for the some QML Editing for here. In the QML code is very difficult for here. Some people use for here in the website QML code. I am appreciate in the work. keep it up.
    industrial shelving company in uk

    Like 0 Short URL:
  • Guest (Sawyer)

    A Developer can make changes in the coding of QML. This thing is easy for academic writing and not so much easier for the person who never know about coding. I need more to know about this thing.

    Like 0 Short URL:
  • This heading is in only couple of words however its importance is extremely solid and I'm extremely astounded to visit this article. This sound message explodes my psyche and tends me to thought all the more flawlessly. So I'd jump at the chance to express gratitude toward "Lydia Jaeger" for being such a pleasant speaker for this circumstance.

    Like 0 Short URL:
Subscribe to the official OSBB BBM Channel!



Back to top