exhibition of C++ to QML

Hey guys,.

I am a C++ class for my application QML.  I'm just some simple tests from now based on the examples here: https://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/index.html

I have a simple class defined using the QOBJECT and QPROPERTY (no Q_INVOKABLE methods).

I'm not clear on one thing.  In the example, the class is defined as:

#ifndef MYCPPCLASS_H_
#define MYCPPCLASS_H_

#include 
#include 

class MyCppClass : public QObject {
    Q_OBJECT
    Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)

public:
    MyCppClass();
    virtual ~MyCppClass();

    Q_INVOKABLE void reset();

    int value();
    void setValue(int i);

signals:
    void valueChanged(int);

private:
    int m_iValue;
};

#endif

in the Q_PROPERTY line, there is a variable, a method to 'read', a 'write' method and a signal to emit.

the variable is not used anywhere.

the class definition looks like this:

#include "MyCppClass.h"

MyCppClass::MyCppClass()
{
    m_iValue = 0;
}

MyCppClass::~MyCppClass()
{
}

int MyCppClass::value()
{
    return m_iValue;
}

void MyCppClass::setValue(int i)
{
    m_iValue = i;
    emit valueChanged(m_iValue);
}

void MyCppClass::reset()
{
    m_iValue = 0;
    emit valueChanged(m_iValue);
}

Here is my test class.

#ifndef SIMPLECLASS_HPP_
#define SIMPLECLASS_HPP_
#include 
#include 

class SimpleClass : public QObject{
    Q_OBJECT
    Q_PROPERTY(int iInt READ iGetInt WRITE iSetInt NOTIFY intChanged)

public:
    SimpleClass();
    virtual ~SimpleClass();
    int iGetInt();
    void iSetInt(int i);

signals:
    void intChanged(int);

private:
    // private variables
    int myInt;
};

#endif /* SIMPLECLASS_HPP_ */

I * think * (int) iSetInt works, but the iGetInt() is not.

I am doing in my QML:

 Button {
                id: myButton
                text: "action"
                onClicked: {
                                if (myLabel.text == "you pushed it!")
                                {
                                    myLabel.text = "you pushed it again!";
                                }
                                else {
                                    myLabel.text = "you pushed it!";
                                }
                                mySimpleClass.iSetInt(44);
                                myOtherLabel.text = "onClicked: " + mySimpleClass.iGetInt();
                            } // onClicked
            } // Button

any ideas what I am doing wrong?

In example there, the value is the parameter which must be accessible from QML.  setValue() and Value() are function QML call whenver a read or write occurs.  I'm not clear what of wrong with your cde, but try to access the value directly instead of using the functions - or in your case you iInt.

Tags: BlackBerry Developers

Similar Questions

  • Object of type complex C++ exposing to QML

    In a C++ file, I have an object of the typeQList *, which is supposed to be a two dimension an array of strings.

    How to expose this object to QML, I know how I'll be able to navigate / access its functions in QML?

    Currently, in C++, I am able to do this:

    // this will display the QString value in the Console
    qDebug() << "test: " << entries->at(0).at(0);
    

    I really have to do, is to send a two dimension array of strings of C++ to QML. I do this too complicated? Is there another way to solve this problem?

    Solution here: objects exhibition complex C++ Qt QML

  • I want to do an exhibition of 30 sec on my EOS600 Rebel T3i, using a remote control.

    The manual says to put it under the light bulb.  Last year, I just did an exhibition of 30 sec without the remote control.  I am trying to determine if the remote control supplied with the camera does not work (Zeikos ZE-WRC6, I changed the battery has not also available) or I'm doing something wrong.  The manual says to put the ios in the bulb setting.  That makes no sense to me.  The remote should not work on any setting?

    Should I buy a new remote control or am I not understanding something or something wrong?

    Any help would be appreciated.  Thank you in advance.  [In the 'old days', I just plugged the release cable on my 35mm.]

    I'm shooting Northern Lights, BTW.

    The remote control only works in the position of 10-second self-timer, but this isn't a problem because the answer is instantaneous, not 10 seconds, when you use the remote shutter release.

  • Connection signal of C++ with slot QML

    Before ask you, I searched for answers to this question, but I have not found a satisfactory example.

    I have set up a service network in C++ that performs queries to REST against a backend. An example query would be to download a given element, the id of the item.

    Once the item is extracted, I emit a signal such as:

    itemReceived(QString& itemId, QString& item);
    

    My question is how can I wire this signal to the slot in a QML page so that the status of the answer? I tried to connect the signal on the Qml in C++ slot, as follows:

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    QObject::connect(this->networkingService,
                         SIGNAL(itemReceived(QString&, QString&)),
                         qml, SLOT(onItemReceived(QString&, QString&));
    

    With a correspondent QML "slot" like this:

        function onItemReceived(x, y) {
            console.log("*********************");
            console.log("Item Received!");
            console.log("*********************");
        }
    

    But it does not work. I also tried using the element of connection of the QtQuick lib, but this also fails.

    Any help would be greatly appreciated. Even if he were to propose a better architecture for the "path of the cascades. Thank you!

    In C++:
    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);
    QML-> setContextProperty ("_app", this);

    In QML:
    {Page}
    onCreationCompleted: {}
    _APP.itemReceived.connect (onItemReceived)
    }

    function onItemReceived (x, y) {}
    Console.log("***");
    Console.log ("point received!");
    Console.log("***");
    }

    // ...
    }

  • Get the height a label in QML?

    Can I get the height of a label in QML?

    Or the coordinates of a container (up/down)?

    BR, René

        Container {
            attachedObjects: [
                LayoutUpdateHandler {
                    id: containerLuh
                    onLayoutFrameChanged: {
                        console.log(layoutFrame.x)
                        console.log(layoutFrame.y)
                        console.log(layoutFrame.height)
                        console.log(layoutFrame.width)
                    }
                }
            ]
    
            Label {
                text: "Label height: " + labelLuh.layoutFrame.height
                attachedObjects: [ LayoutUpdateHandler { id: labelLuh } ]
            }
    
            Label {
                text: "Container height: " + containerLuh.layoutFrame.height
            }
        }
    
  • HOWTO: Translation Live in C++ similar to re-translate in QML

    WARNING: To come long post!

    If you've built (or building) your apps BlackBerry 10 Aboriginal stunts with internationalization in mind, then you have probably dotted with QML qsTr() calls and macros tr() C++ code. When your application starts the text wrapped in qsTr() or tr() is replaced by the localized text for the local unit and the language (if defined, otherwise default text is used). This works fine unless you change the language setting on your device while your application is running. Unless you take measures to propagate the change to the language through your live webcam app, the text displayed in your application will not match the settting of language new device only when your application is restarted. QML provides this translation of 'direct' with the re-translation class, which can be used with qsTr() update of translations that soon the language setting of the device is changed:

    Page {   Container {      Label {         id: label01
    
             // ---This label's text will be live translated         text: qsTr("Label 1") + Retranslate.onLanguageChanged      }      Label {         id: label02
    
             // ---This label's text will be static translated         text: qsTr("Label 2")      }   }}
    

    In this example, label01 will be his attribute of translated text live as it is updated as soon as the device language is changed. However, label02 will have only his attribute of text translated when the software is first started and the language changes following while the application is running will not update to it.

    With the help of the re-translation with QML class makes direct translation as simple as the addition of a small amount of code just after each use of qsTr(), but C++ does provide no such convenience. To implement the translation directly in C++ code, it is necessary to call setXXX() for a string with the macro tr() attribute slot once to do the initial translation and then connect the setXXX() slot to an instance of LocaleHandler that emits a signal every time the language (or locale) changes. It's complicated by the fact that the LocaleHandler knows that the language has changed, but he doesn't know which key text to provide openings, it is attached to the then must fix the LocaleHandler signal to an intermediate location that knows what translation of key to use for this attribute, and then emits a different signal with the key as a parameter that must be connected to the slot machine control setXXX() . This means that, for every single control attribute you want live, translate you'll need a separate intermediate location set somewhere, a signal linked to this site and two calls QObject::connect(). For EACH attribute that we want to live translation. Of course, this becomes very ugly, very fast.

    I prefer to use C++ with QML little or not to expose my app pages so I was determined to find a solution that was easier to use than retranslating in QML (or almost) and after some trial and error I came up with a solution that I am very satisfied. The core of this technique is a C++ class called LiveTranslator. The syntax to use is a bit more complicated to use QML re-translation, but as re-translation you only need to add a line of code for each attribute that you want to translate live. Here is the header for LiveTranslator:

    #ifndef LIVETRANSLATOR_HPP_
    #define LIVETRANSLATOR_HPP_
    
    #include 
    
    using namespace bb::cascades;
    
    class LiveTranslator: public QObject {
        Q_OBJECT
    
        QString _key;
        QString _context;
    
        static LocaleHandler* _localeHandler;
    
    public:
        LiveTranslator( const QString& context, const QString& key, QObject* target, const char* slot );
        static void setLocaleHandler( LocaleHandler* localeHandler );
    
    private slots:
        void localeOrLanguageChangedHandler();
    
    signals:
        void translate( const QString& string );
    };
    
    #endif /* LIVETRANSLATOR_HPP_ */
    

    .. .and the body...

    #include "LiveTranslator.hpp"
    
    // ---Initialize the locale handler pointer on app startup so we can tell if it has been set properly later
    LocaleHandler* LiveTranslator::_localeHandler = 0;
    
    // ---Note that the target control is also used as the parent so the live translator dies when the control does
    LiveTranslator::LiveTranslator( const QString& context, const QString& key, QObject* target, const char* slot ) :
            QObject( target ) {
    
        bool success;
        Q_UNUSED( success );
    
        // ---Save the context and key string
        this->_key = key;
        this->_context = context;
    
        // ---Die (during debug) if the locale handler hasn't been set properly before use
        Q_ASSERT( LiveTranslator::_localeHandler );
    
        // ---Watch for locale or language changes
        success = QObject::connect( LiveTranslator::_localeHandler, SIGNAL( localeOrLanguageChanged() ), SLOT( localeOrLanguageChangedHandler() ) );
        Q_ASSERT( success );
    
        // ---Trigger specified slot when locale or language changes
        success = QObject::connect( this, SIGNAL( translate( const QString& ) ), target, slot );
        Q_ASSERT( success );
    }
    
    void LiveTranslator::localeOrLanguageChangedHandler() {
        // ---Use the specified slot on the target to update the appropriate string attribute with the translated key
        emit translate( QCoreApplication::translate( this->_context.toLocal8Bit().constData(), this->_key.toLocal8Bit().constData() ) );
    }
    
    // ---This function MUST be called once with a valid LocaleHandler before any LiveTranslator classes are instantiated
    void LiveTranslator::setLocaleHandler( LocaleHandler* localeHandler ) {
        LiveTranslator::_localeHandler = localeHandler;
    }
    

    LiveTranslator encapsulates all the ugly stuff, including remembering the key to the translation, the intermediate signal/slot, and all signal/slot connections necessary for direct translation. Use is as simple as creating an instance of LiveTranslator, passing the constructor the translation for the attribute key (and the context, but more on that later), the Visual control of the target and the location on the control that accepts the update of translation. Note that tr() only works with static keys chains...

    // ---This is valid
    QString str1 = tr("string one");
    
    // ---This is not!
    Qstring str1 = "string one";
    QString str2 = tr(str1);
    

    .. .so instead tr(), LiveTranslator must use QCoreApplication translate() internally.

    An example of use of LiveTranslator :

    MyClass::MyClass() {
        Label* label = Label::create().text( tr("Label one") );
        new LiveTranslator( "MyClass", "Label one", label, SLOT(setText(const QString&)));
    
        Option* option = Option::create().text( tr("Option one") ).description( tr("Option one description") );
        new LiveTranslator( "MyClass", "Option one", option, SLOT(setText(const QString&)));
        new LiveTranslator( "MyClass", "Option one description", option, SLOT(setDescription(const QString&)));
    
        ActionItem* actionItem = Option::create().title( tr("Action one") );
        new LiveTranslator( "MyClass", "Action one", actionItem, SLOT(setTitle(const QString&)));
    }
    

    Note that there is no need to save a reference to the new instance LiveTranslator since the constructor sets the 'target' as a parent control. When the control is destroyed by your app the LiveTranslator will go with him. The first parameter to the constructor LiveTranslator is the 'context' where the translation key. When you use the macro tr() (or function qsTr() QML) the code parser mentions of where he found the key and stores it in the translation file. This way you can use the same key for translation on different pages, and if the context is different, you could have them translated differently. The parser doesn't know anything about the LiveTranslator class but it must indicate the context explicitly. For C++, the context is always the name of the class containing the code that you are translating. In addition, in case it is not obvious, the "key" parameter must be the same value used with tr() on the input line.

    There is one thing that you must do before using LiveTranslator in your C++ code and that is to give it a LocaleHandler to work with. Rather than force you to spend a LocaleHandler for each instance of LiveTranslator, you tell LiveTranslator that one to use only once with a static function call. If you created your application from one of the Momentics models then you already have a Manager, you can use:

    ApplicationUI::ApplicationUI() : QObject() {
        // prepare the localization
        m_pTranslator = new QTranslator( this );
        m_pLocaleHandler = new LocaleHandler( this );
    
        // Use this locale handler for all the live translations too
        LiveTranslator::setLocaleHandler( m_pLocaleHandler );
    
        ...
        ...
        ...
    }
    

    I enclose the source for LiveTranslator so all you need to do to get the direct translation working in your BB10 native C++ code is extract the zip in your src directory, add a call to LiveTranslator::setLocaleHandler() in your main application class constructor, and then call new LiveTranslator (...) with the appropriate settings for each attribute of the control you want to be living translated. I hope that is useful to the native BlackBerry 10 development community wonderful (and long-suffering).

    IMPORTANT!

    The instructions posted above have been extended and improved to work with some additional user interface controls such as SystemDialog and SystemUiButton. It was published with a link to a sample application on GitHub as an guest article on the Blog of Dev of BlackBerry. Additional functionality has been added to the original code shown above, then the blog article and GitHub example now consider the definitive description of this technique.

    See you soon.

  • QML Cascades and to 'SCREEN_IDLE_MODE_KEEP_AWAKE' to work

    I have a QML driven application works very well, but after the usual delay, the display shuts off.  I need a way to keep it.

    I tried adding a "ForeignWindow" to my QML and then use FindChild to find the window, tie it to a ForeignWindow pointer and use it.  I have no errors, but the screen stays off.

    So, if someone got everything a QML Cascades driven UI app actually keep the screen on, please share your secret.

    Thank you

    Bryan

    Well, I'm this marking as closed in what I found a method to keep the screen awake (until it is actually completely supported in Cascades.

    The method was built with the participation of two people and a lot of research.  Here is the result

    (1) create a new thread

    (2) in the thread create a screen context

    (3) events ask for screen and navigator

    (4) when you get a message from idle screen, inject a key event in the queue of the screen

    Works very well.  Thank you all for your help

  • The Devs creating their active Frame for a separate QML file covers? I'm stuck

    Bit in trouble, I do my best to bring my Apps support 10.2.1 10.2.2 I practically everything by working the * beep * covers Active, I did do a check and create the file QML according to less than 10.3 or greater

     ComponentDefinition {
                id: creator;
                source: ""
                function createQMLObject(sourceUrl){source=sourceUrl; creator.createObject()}
            }
    

    Feel free to use that btw ^.

    if(olderFirmware===true)  Application.setCover(creator.createQMLObject("CoverOlderFirmware.qml"))
            else{Application.setCover(creator.createQMLObject("Cover.qml"))}
    

    Now for some reason, they do not work, they seem to be created, but do not want to show, normally I would create it from my main.qml but the passport and its lid Multi forced me to separate the covers in their own QML files

    Begins like (not included UI code)

    import bb.cascades 1.2
    
        SceneCover {
            id: large
    
            content: Container {
                background: Color.create("#000000")
                layout: DockLayout {}
    }
    }
    

    Place in a container gives me a weird error on not able to create a list in an object, probably referring to MultiCover and SceneCover as a child of the container.

    Any suggestions?

    I use active selector to do this, find in this application example:
    https://github.com/RodgerLeblanc/AssetSelector

    This method can support 10.2.1 users and below, don't forget to add the lines of c ++ this blog:
    https://bb10code.WordPress.com/2014/12/10/active-frame-made-easy/

    Check your email, I also sent you something on your last post on the forum.

  • How to create timer thread and update the data in qml

    See once again that the user selects the time then I have to open a plus qml, them what that time that the user has selected he will start him it and display in the texview of this point of time until compled times what the user has selected.

    the textview should show how the change of second... That is to say all like look.

    Please guide me what the correct feature I have to used?

    I won't go to timer or wire?

    Please guide me

    Now please tell me that you are able to see the image or not?

    Plese now answer the solution?

  • ListView cannot see C++ object passed to QML via QmlDocument-&gt; setContextProperty()

    I can access a C++ object using the QmlDocument function-> setContextProperty() in JavaScript inside most of the QML elements (such as containers, ImageButton, control etc.) happened, but can't access it from the JavaScript inside ListView. I get "ReferenceError: can't find variable: app. Why is this?

    Why is it a "problem"? It's probably just the way things work and should work. ListItemComponents are not really part of the scene graph/context since they exist only to be used during execution. Wait so the scope of the listItemcomponent unlike the rest of the document.

    The way around it, as described in the thread linked above is to create a function inside your listview that refers to the context property that you want to use. Then, your listitemcomponent has access to this feature of the listview.

  • Does everything with JSON of QML

    Hello

    Just trying to decide what type of template to use for the list, I wanted to do.

    It's true that I can't fully implement JSON in its entirety in QML? that is sort of the key (and everything else 100%) in QML, no C++ at all. (I have a JSON file I created)

    In the examples I see, to do a minimum implementation in C++ and more QML.

    Otherwise, I can use XML purely in QML but will not get the features of sort etc..

    Is everything is OK?

    I just noticed tonight that the 'global' Javascript object, in the environment of waterfalls QML, has a JSON object in it.

    This seems to be the JSON object standard ECMAscript 5 which is documented here: https://developer.mozilla.org/en-US/docs/Using_native_JSON

    By using it, you could make JSON.parse (somestring) and retrieve the result of the analysis of the JSON.  Similar to eval(), but probably better...

    Also a JSON.stringify () has to go the other way.

    These things were probably obvious to many who read this... was good news for me.

  • QML QVariantList QString Converter?

    Hey all

    I'm relatively new to programming of BB. I have some experience in Android and Windows Phone, but I think that BB10 will kick a lof of * beep *!

    I did a bit of programming for my application and I use a Web service to download the json from the server data. Now, I have programmed a view master / detail with qml, when clicking on an item in the list, I get the details of this item.

    But the article also has QVariantLists because it is a data table. For example, in my json file, I have the language of property: ['Dutch', 'English', 'French'].

    Now, I want to show these multiple languages in my detailpage. Is it possible to write a converter or something like that? Or should I do the treatment before you add data to my datamodel?

    Thanks in advance!

    QVariant-s work just like the javascript in QML tables.
    If you know how to access this QML QVariantList, you can also iterate through it the addition of all the members of a chain.

    var s = "";
    for (var i = 0; i < myList.length; i++) {
     console.log(myList[i]);
    
     if (i != 0)
       s += ", ";
     s += myList[i];
    }
    
  • Using C++ in QML classes: need for Clarification

    I have read the document using classes in QML C++ and understood that we must call qmlRegisterType before using C++ in QML classes.

    But I found that some (or all?) of the classes can be used in QML without call qmlRegisterType in advance.

    Example of

    import bb.device 1.0
    
    Page {
      attachedObjects: [VibrationController {id: qmlvib}]
      Container{
           Button {
                        text: "Test vibrate"
                        horizontalAlignment: HorizontalAlignment.Center
                        onClicked: qmlvib.start(100,100)
                       }
        }
    }
    

    I also found the SensorDemo project using many classes of QML sensor final qmlRegisterType<>(). But it does not call qmlRegisterType<>for VibrationController (?).

    I wish I had a few questions:

    1. How will I know which classes can be used in QML without qmlRegisterType<>()? Is there a list or the rule to help me know?

    2. what should I look at to decide using C++ class in QML directly (without qmlRegisterType<>(()) or with qmlRegisterType<>(): as the performance, memory management,...?

    3. If you can choose to use the C++ in QML class directly (without qmlRegisterType<>(()), BB shoud put it in the paper?

    Sorry for the many questions. I'm just a beginner on BB.

    Thank you very much!

    (1) I think that some classes are pre-registered. If it works without adding it yourself: looks like it was a.
    (2) I don't think that there is a performance issue with the help of registerType
    (3) No, there is not, just of the classes that are recorded automatically by the system.

  • Using C++ in QML classes in app without head: refers to 'bb::device:VibrationController:staticMetaObject' the undefined

    Hi, I've been weeks of work on the BB and had a lot of problems. Some of them have been resolved, some were not without the support of the forum.

    Now I have a great difficulty that I can't find answer by Googling.

    I am grateful to some body can help.

    Here's a simple case that make the big problem for me:

    1. create an app without head with Momentics. 2 project will be generated HeadlessApp and HeadlessAppService.

    Without modification, this code works well.

    2. I'm link below to use VibrationController in HeadlessAppService: https://developer.blackberry.com/native/documentation/dev/integrating_cpp_qml/index.html#usingcclass...

    below the code has been added:

    -Add codes below to main.cpp HeadlessAppService

    #include 
    using namespace bb::device;
    

    then add qmlRegisterType as below

    Q_DECL_EXPORT int main(int argc, char **argv)
    {
    
       Application app(argc, argv);
    
       qmlRegisterType("bb.vibrationController", 1, 0, "VibrationController");
       ApplicationUI appui;
       return Application::exec();
    }
    

    3. to confirm the new code, I just right click on the project and select build project.

    Bang! I got several error I don't understand. (red lines are errors)

    08:44:30 **** Incremental Build of configuration Device-Debug for project headlessTest ****
    make -j4 Device-Debug
    make -C .//translations -f Makefile update
    make[1]: Entering directory 'D:/BB-dev/momentics-workspace/headlessTest/translations'
    C:/bbndk/host_10_3_1_12/win32/x86/usr/bin/lupdate headlessTest.pro
    Updating 'headlessTest.ts'...
        Found 2 source text(s) (0 new and 2 already existing)
    make[1]: Leaving directory 'D:/BB-dev/momentics-workspace/headlessTest/translations'
    make -C .//translations -f Makefile release
    make[1]: Entering directory 'D:/BB-dev/momentics-workspace/headlessTest/translations'
    C:/bbndk/host_10_3_1_12/win32/x86/usr/bin/lrelease headlessTest.pro
    Updating 'D:/BB-dev/momentics-workspace/headlessTest/translations/headlessTest.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
        Ignored 2 untranslated source text(s)
    make[1]: Leaving directory 'D:/BB-dev/momentics-workspace/headlessTest/translations'
    make -C ./arm -f Makefile debug
    make[1]: Entering directory 'D:/BB-dev/momentics-workspace/headlessTest/arm'
    make -f Makefile.Debug
    make[2]: Entering directory 'D:/BB-dev/momentics-workspace/headlessTest/arm'
    qcc -Vgcc_ntoarmv7le -lang-c++ -Wl,-rpath-link,C:/bbndk/target_10_3_1_995/qnx6/armle-v7/lib -Wl,-rpath-link,C:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib -Wl,-rpath-link,C:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib/qt4/lib -Wl,-rpath-link,C:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib/qt4/lib -o o.le-v7-g/headlessTest o.le-v7-g/.obj/applicationui.o o.le-v7-g/.obj/main.o o.le-v7-g/.obj/moc_applicationui.o    -LC:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib/bb1 -LC:/bbndk/target_10_3_1_995/qnx6/armle-v7/lib -LC:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib -LC:/bbndk/target_10_3_1_995/qnx6/armle-v7/usr/lib/qt4/lib -LC:/bbndk/target_10_3_1_995/qnx6//usr/lib/qt4/lib -lbb -lbbsystem -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lsqlite3 -lz -lQtXmlPatterns -lQtGui -lQtNetwork -lsocket -lQtCore -lm -lbps
    o.le-v7-g/.obj/main.o: In function `int qmlRegisterType(char const*, int, int, char const*)':
    c:/bbndk/target_10_3_1_995/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:191: undefined reference to `bb::device::VibrationController::staticMetaObject'
    o.le-v7-g/.obj/main.o: In function `QDeclarativeElement':
    c:/bbndk/target_10_3_1_995/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:87: undefined reference to `bb::device::VibrationController::VibrationController(QObject*)'
    o.le-v7-g/.obj/main.o:(.data.rel.ro._ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE]+0x8): undefined reference to `bb::device::VibrationController::metaObject() const'
    o.le-v7-g/.obj/main.o:(.data.rel.ro._ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE]+0xc): undefined reference to `bb::device::VibrationController::qt_metacast(char const*)'
    o.le-v7-g/.obj/main.o:(.data.rel.ro._ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE]+0x10): undefined reference to `bb::device::VibrationController::qt_metacall(QMetaObject::Call, int, void**)'
    o.le-v7-g/.obj/main.o:(.data.rel.ro._ZTIN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE[_ZTIN19QDeclarativePrivate19QDeclarativeElementIN2bb6device19VibrationControllerEEE]+0x8): undefined reference to `typeinfo for bb::device::VibrationController'
    o.le-v7-g/.obj/main.o: In function `~QDeclarativeElement':
    c:/bbndk/target_10_3_1_995/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:91: undefined reference to `bb::device::VibrationController::~VibrationController()'
    c:/bbndk/target_10_3_1_995/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:91: undefined reference to `bb::device::VibrationController::~VibrationController()'cc: C:/bbndk/host_10_3_1_12/win32/x86/usr/bin/ntoarm-ld caught signal 1
    Makefile.Debug:103: recipe for target 'o.le-v7-g/headlessTest' failed
    make[2]: *** [o.le-v7-g/headlessTest] Error 1make[2]: Leaving directory 'D:/BB-dev/momentics-workspace/headlessTest/arm'
    make[1]: *** [debug] Error 2
    Makefile:50: recipe for target 'debug' failed
    make: *** [Device-Debug] Error 2make[1]: Leaving directory 'D:/BB-dev/momentics-workspace/headlessTest/arm'
    mk/cs-base.mk:31: recipe for target 'Device-Debug' failed
    08:44:31 Build Finished (took 1s.47ms)
    

    I give up!

    Why adding simple code can be a problem? Please help me!

    Thank you very much!

    You must add this code into main.cpp to your HeadlessApp, not HeadlessAppService. Your spare part cannot run any UI stuff, trying to save an object any for QML is part of the things in the user interface.

    But anyway, reading your newspaper from the console, you seem to put in the right place anyway. Did you add this to your headlessTest.pro file:
    LIBS +=-lbbdevice

  • QML labels can be animated on TextChanged?

    Been looking around, but not not seen anything really useful, is there a way to animation a label when the text string changes, like a fade or something?

    Thank you

    The animations are pretty easy! I wish that I had to use more

    Use this instead of label

    AnimatedLabel {
          id: myLabel
          text: "original"
      }
    

    And AnimatedLabel.qml

    import bb.cascades 1.4
    
    Label {
    
        property string newText
    
        animations: [
            FadeTransition {
                id: fadeOut
                fromOpacity: 1
                toOpacity: 0
                duration: 200
                onEnded: {
                    fadeIn.play();
                    parent.text = parent.newText;
                }
            },
            FadeTransition {
                id: fadeIn
                fromOpacity: 0
                toOpacity: 1
                duration: 200
    
            }
        ]
        function changeText(text)
        {
            newText = text;
            fadeOut.play();
        }
    }
    

Maybe you are looking for

  • IMEI on my new iPad?

    How do I get the IMEI for my new IPad, so can I subscribe to the wireless service?

  • r8500 Power adapter needs to be replaced

    Hi guys,. Unfortunately, my puppy has decided to go into my computer room and causing havoc with power cords (didn't hurt fortunately but it has decided to start chewing on large parts of the adapters, only good side of things, it's that he didn't ha

  • Debugger does not work with version 2012SP1b of Diadem 64 bit Win7

    I downloaded the latest version of the MS Script Debugger. (http://www.microsoft.com/en-us/download/details.aspx?id=22185) When I try to boot in the tiara, a message: "the software is not able to work with recent version of Microsoft-Debugger 1,0,0,7

  • Win XP USB Ports not working does not HELP!

    I use a laptop of Toshiba A105-S1712, under Win XP SP3.  I recently had to do a repair installation, thereafter, I couldn't use one of my flash drives.  Whenever I plugged it in, it asks to install the drivers?  To try to solve the problem, I tried t

  • User RDS CAL

    Hello How 'user Cal RDS' do I need if want to connect to the same user from multiple devices at the same time? Thank you.