QML and C++ integration

I have a problem with QML and C++ integration.

I have second attached to hand qml (next to main.qml):

attachedObjects: [
             ComponentDefinition {
                    id: dataPage
                    source: "dataPage.qml"
                }
            ]

When the subject is raised in the listview, this page is pushed in navigationPane:

onTriggered: {
         var selectedItem = dataModel.data(indexPath);
             var page = dataPage.createObject();
              page.name = selectedItem.title;
              navigationPane.push(page);
                            }
ApplicatonUI::ApplicationUI(bb::cascades::Application *app):QObject(app)...dataPageqml = QmlDocument::create("asset:///dataPage.qml").parent(qml);
dataPageqml->setContextProperty("pageC", this);
...}

void ApplicationUI::processChoice(){
     Page *page = dataPageqml->createRootObject();
     page->setProperty("label", "New text");
}

DataPage.qml I call onCreationCompleted to call the processChoice() function:

Page {
    id: page
    onCreationCompleted: {
        pageC.processChoice();
    }
    property string name
    Container {
        WebView{
            horizontalAlignment: HorizontalAlignment.Fill
            minHeight: 700.0
            maxHeight: 700.0

        }
        Label{
            id: lb
            objectName: "label"
            text: page.name
        }
    }
}

In this case, I want to change the text in the label, but nothing happens.

What I am doing wrong?

Ty for answers.

Change

QML-> setContextProperty ("INAC", this);

TO

QmlDocument::defaultDeclarativeEngine()-> rootContext()-> setContextProperty ("INAC", this);

Tags: BlackBerry Developers

Similar Questions

  • On the QML and C++ integration (getting "undefined")

    This subject has been discussed often and I went through a lot of discussions, but I have not found a solution for my problem so far.

    What I want to do in my application:

    I have a container that displays an html page. No, I want a part of the html page dynamically filled a C++ function. Here is my Code:

    // HTMLCreator.hpp
    
    #ifndef HTMLCREATOR_HPP_
    #define HTMLCREATOR_HPP_
    
    #include 
    
    class HtmlCreator : public QObject{
    Q_OBJECT
    Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
    public:
        HtmlCreator(QObject *parent = 0);
        ~HtmlCreator();
    
        Q_INVOKABLE QString html();
    
        Q_INVOKABLE void setHtml(QString html);
    
    signals:
        void htmlChanged(QString);
    
    private:
        QString m_html;
    };
    
    #endif /* HTMLCREATOR_HPP_ */
    
    // HtmlCreator.cpp#include "HtmlCreator.hpp"
    #include 
    
    QString HtmlCreator::html(){
        return m_html;
    }
    
    void HtmlCreator::setHtml(QString html){
        if(html != m_html) {
            m_html = html;
            emit htmlChanged(m_html);
        }
    }
    
    // applicationui.cppPage* ApplicationUI::doLoadPageDetails(){
    
        qmlRegisterType("myHtmlCreator", 1, 0, "HtmlCreator");
    
        QmlDocument *qml = QmlDocument::create("asset:///PageDetails/PageDetails.qml").parent(this);
        qml->setContextProperty("app", this);
    
        HtmlCreator *HtmlCreator = new HtmlCreator();
        qml->setContextProperty("HtmlCreator", HtmlCreator);
    
        Q_INVOKABLE QString HTMLString = "";
    
        HTMLString.append("
    A
    a
    "); HTMLString.append("
    B
    b
    "); MinutesData->setHtml(HTMLString); Page* newPage = qml->createRootObject(); AbstractPane *root = qml->createRootObject(); return newPage; }
    // PageDetails.qml
    
    import myHtmlCreator 1.0
    
    Page{[...]Container {
            layout: DockLayout {
            }
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Top
    
            ScrollView {
                id: scrollView1
                scrollViewProperties {
                    scrollMode: ScrollMode.Vertical
                }
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 1.0
                }
    
                scrollViewProperties.pinchToZoomEnabled: false
                scrollViewProperties.overScrollEffectMode: OverScrollEffectMode.None
    
                visible: true
                WebView {
                    id: webViewScrollable1
    //                url: "local:///assets/examples/test4.html"
    
                    settings.viewport: {
                        "initial-scale": 1.0
                    }
                    settings.zoomToFitEnabled: false
                    settings.textAutosizingEnabled: false
                    settings.defaultFontSizeFollowsSystemFontSize: true
                    settings.imageDownloadingEnabled: false
                    settings.binaryFontDownloadingEnabled: false
                    settings.cookiesEnabled: false
                    settings.javaScriptEnabled: false
                    settings.activeTextEnabled: false
    
                    html: " ...  lots of html code displayed correctly" +
                    HtmlCreator.html +
                    "" +
                    ""
                }
            }
    

    Now to the point where with HtmlCreator.html do I put her thong in the app I see "undefined" text

    What I'm doing wrong here?

    I found the solution!

    I missed to add my class as an attached object. So the container, the label or in my case WebView where I want to use the Q_Properties defined in my class, I have to add:

    attachedObjects: [
      HtmlCreator {
        id: htmlCreator
      }
    ]
    

    and then I can get the property

    htmlCreator.html
    

    But unfortunately
    the string I get is empty, so I'm still something missing here.

  • Create a ListView in QML and then use it in C++

    Hi all, I've been struggling with QML and C++ integration for some time now.

    I'm at a point where I need a ListView in my application.

    Is it possible for me to create a ListView with its ListItemComponent and DataModel in QML and then use it in my code c ++?

    If so, a kind enough to provide a code sample on creating a QML object and then use it in c ++?

    Thank you very much

    Hey jayvd, there is a "CallaPizza" example call, the documentation links to the example is in the following link

    http://BlackBerry.github.IO/Cascades-samples/callapizza.html

    and you can download the example from github.

    In this example, they use a list written on QML the datamodel is managed on a C++ class, so you can use these same aproach to solve your problem. On the other hand, the propouse of Kanaksony solution might also work, you must have a reference to the object (qml) that contains the ListView, and then find the listView object, using the findChild method, once you have the reference to the list, you get access to all methods of properties.

    Cordially, Cristian.

  • Oracle fusion tax and its integration with the application third-party to the functional aspect only.

    Hello

    I'm looking for some details / documents in which Oracle merger tax and its integration with third party requested to the functional aspect only. Could someone please help to fix the required details.

    Thank you... Sandeep

    Hi Sandeep,

    have you looked at these docs for Fusion Apps Financials / ERP Cloud?

    -Implementation of the tax- http://docs.oracle.com/cloud/latest/financialscs_gs/FAITX/toc.htm

    -To tax assistance - http://docs.oracle.com/cloud/latest/financialscs_gs/FAUTX/toc.htm

    "Implementation tax" contains a chapter on 3 third-party integrations. Is that what you are looking for?  If not, can you clarify what you mean by 'integration with 3rd party applications'?

    Thank you

    Oliver

    Fusion applications Developer Relations

    https://blogs.Oracle.com/fadevrel

  • [JDev12.1.2] how to speed up JDeveloper and its integrated WLS?

    Hallo,

    which is the recommended setting for to really speed up JDeveloper and its integrated WLS?

    Main time I would like to reduce:

    1. load application startup time;
    2. design of rendering time;
    3. WLS-start;
    4. time of (de-) deploy an application.

    Thank you

    Federico

    Refer

    https://blogs.Oracle.com/Shay/entry/is_your_jdeveloper_slow_it_sho

    TechieWorld...: JDeveloper optimization performance and tricks.

    See also similar position.

    Re: Very slow performance in Jdeveloper

  • Problem with DRM and the integration of the EBS

    Hello

    We are experiencing a problem and EBS integration are finished but the results do not appear.

    Please can someone help.

    Thank you.

    Please check the below id doc from Oracle.

    Concurrent workload with DRM to the EBS GL integration completed with errors (Doc ID 1643092.1).

    Thank you

    ~ KKT ~.

  • Indexing and the integrity constraint functionality difference

    Hello

    Sometimes I confuse me, how we can distinguish between indexing and the integrity of the features of constraint. Please let me know or if any available doc.


    Kind regards
    REDA

    I assume you mean unique vs unique index constraints?

    The sole (or Primary Key) constraints provide additional metadata that can be used by the optimizer.
    An index will be used to help the database to apply the constraint (it is created, or if there is it will be "captured" by coercion)

    Insofar as a document [url http://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htm] that's something, you should read

  • Difference between Standalone Converter and converter integrated with VMware vCenter Server?

    What is the difference between Standalone Converter and converter integrated with VMware vCenter Server, except that it comes integrated with Vcenter and another does not?
    Please confirm is there the technical differences between them?

    Also take a look at the Release Notes for vCenter Server 4.1.

    of http://www.vmware.com/support/vsphere4/doc/vsp_esx41_vc41_rel_notes.html

    VMware vCenter Converter plugin. VMware vSphere 4.1 and later versions of the update and patch are the latest editions of the VMware vCenter Converter plugin for vSphere Client. VMware will continue to update and support the free Converter Standalone product, which allows conversions from sources such as physical machines, machine formats virtual VMware and Microsoft and some third-party disk image formats.

    André

  • Confused about autonomous OBIEE and OBIEE integrated this two Architecture

    Hello

    I'm confuse about autonomous OBIEE and OBIEE integrated this model two...

    Are these two situation based on the same application (and then after that install US based on the standalone OBIEE, BI applications it become integrated model)

    or are they two separate applications but integrated OBIEE this model can support BI applications?

    Kind regards

    Anne

    Hi Anne,.

    It's the difference,

    Autonomous OBIEE - has no any solution of BI preconstruitse, we build the solution based on our requirement with the suite of products.

    Integrated OBIEE or OBI Apps - are built on standalone. It provides this stand-alone version features all, moreover, it has predefined solutions.

    Rgds,
    DpKa

  • JavaScript JSON and ApEx integration

    In the community of ApEx, I see a lot of developers to extend their applications with JavaScript and JSON libraries. I would do the same thing to enjoy all the beautiful widgets, gadgets and gizmos that have been developed in the world of script.


    What is advice to better introduce the use of a script library?

    Team ApEx Oracle has an official thought on the extension of the ApEx in a script library?

    Y at - it a library which is recommended?

    Team ApEx does intend to extend their own library users don't need to use 3 parties?

    Have others using these issues experienced the 3rd-party libraries related to upgrades of the ApEx?


    I need a solution that is solid as a rock (no bugs) and bearable. The apps I support now have over a thousand users. Applications run on our company intranet. It would be undesirable to make calls outside our network http.

    Kind regards
    Todd

    Todd,

    We have certainly will continue work on the library, with the main objective on the realization of full namespace (to reduce the risk of collisions with different libraries functions) and the integration of jquery (making use of the features of the great library of basic such as chaining DOM selectors, improved, etc., but not of jquery UI).

    While it is currently possible to integrate with other libraries and many people have had great results with it, there are other plans for the future which should make life easier. To know custom item types, which allows developers to more easily code and reuse 3rd widgets to party in their applications.

    Another plan is what we call "Dynamic action", which will allow developers to set declaratively in the APEX for example activation, deactivation, display client side logic and hiding items. It is about making life easier for developers who do not want to dirty their hands with JavaScript, but still want to achieve such functionality in their applications.

    But I do not think that we could reach a point where "users have no need to use 3 parties. We are not all things to all people, different people have different requirements and tastes. For this reason, providing the best scalability (through custom item types) is the goal.

    We will also improve the documentation on the library, since 3.1, we had a few docs in chapter API user guide, but we will look to improve it with more detailed in future examples.

    Hope this helps,
    Anthony.

  • Replacing the fan for w/15.4 "screen and GPU integrated T60

    Greetings,

    The combo fan/heater several months ago, I bought for my T60 was apparently the 41W6409 for a T60 with discreet gpu and cpu, but mine is an integrated model that uses the 41W6408.

    As I can't return it, I was just thinking to replace the old fan with that on the new heatsink. But I'm not sure that it will fit, being the only FRU I could find for the Fan/Heatsink combo.

    So, I was wondering if someone here who happened to know if these fans are the same.

    Thank you very much in advance.

    Steve

    Skater wrote:

    Greetings,

    The combo fan/heater several months ago, I bought for my T60 was apparently the 41W6409 for a T60 with discreet gpu and cpu, but mine is an integrated model that uses the 41W6408.

    As I can't return it, I was just thinking to replace the old fan with that on the new heatsink. But I'm not sure that it will fit, being the only FRU I could find for the Fan/Heatsink combo.

    So, I was wondering if someone here who happened to know if these fans are the same.

    Thank you very much in advance.

    Steve

    Steve, you can use the unobtrusive radiator on your integrated motherboard. In fact, the best option in my opinion is to go with a T61 heatsink that is designed to cool the much more powerful X 3100 graphics and uses the thermal paste rather than pads type blade of silicone used to cool graphic systems T60. Alternatively, you can replace these pads with thermal paste on the heatsink T60 but unity T61 is better in my opinion. I can't tell you if the fans are interchangeable, because there was more than one fan used on the T60 models intel, some were, and some were not. There was also a discreet couple different sinks of heat, but will be more than enough for the cooling of your integrated graphics. Platform which cools the discrete gpu will not be used so it isn't a problem and cooling chipset platform will suffice for the cooling of your integrated graphics.

  • I have a new laptop and my integrated webcam does not work

    I need to get help fixing it. It's a brand new computer and the webcam does not work. When I try to access the program, it said that I need to plug a camera

    Hey amaury Muñoz.

    Welcome to Microsoft Answers Forum.

    1. can you please tell us the model number of your computer?

    2. is there a built in webcam or what is the model of your webcam?

    Can you please give us a little more detail on what is the specific error you get when you try to use the webcam?

    Check if you have the drivers installed for your webcam.

    As you say that it is a Dell computer, you will need to go on the http://support.dell.com website to download the driver of your webcam installed.

    Click on support and drivers.

    On the next page, it asks your name and your number.

    Select the exact model of your laptop.

    This will bring up the option to select your operating system. Choose Windows Vista or Windows Vista 64-bit.

    A webcam installed usually appears under the software - multimedia, but it may be different for your model.

    You can choose to install now or download. Once it is downloaded and installed, then test again to see if your integrated webcam works.

    You can also contact Dell for support, since this is a brand new computer. Here is a link to Dell's Support page options:

    http://support.Dell.com/

    Thank you.

    Irfan H, Engineer Support Microsoft Answers. Visit our Microsoft answers feedback Forum and let us know what you think.

  • vWorkspace and Foglight integration not working

    Hello

    When I click on the diagnosis and the monitoring tab for any element (datacenter, virtual computer users) in vWorkspace I get the following error.

    See not found: system:vdidiagnostics_vmware_consoleintegration.viewCIVMWQuickView

    The Diagnostics tab and real monitoring itself works fine and opens my Foglight homepage without problem (I have installed on a separate virtual computer foglight)

    vWorkspace version is 8.0.306 and Foglight Foglight virtualization 7.1 trail verison.

    Any help would be appreciated.

    Thank you

    Andrew

    Hi André,.

    Foglight for. Virtual desktop (v5.6), which is now supplied with and integrated with vWorkspace and Foglight for v7.x virtualization (VMware) are similar but different products.

    If functionality (and URLs) supported in a single product do not work in the other. vWorkspace is hardcoded to work with Foglight for virtual desktops.

    If you have ITS current for vWorkspace, you are entitled to a copy free from Foglight for the virtual desktop, which takes in charge the two Hyper-V and VMware hypervisor infrastructure + followed by the components of farm vWorkspace.

    Kind regards

    Rick

  • Complete ArrayDataModel QML and filling data in ListView

    Hello

    the filepicker, I get the file + the path to a file. Now I extracted the path and the name of the file to the string «selectedFile»

    Now, I want to add these two channels to an ArrayDataModel, which displays the data in a listview, the file name as the title and filepath as description.

    Here is my code:

    // Main.qml
    
    ListView {
      id: listview
    
      dataModel: ArrayDataModel {
        id: theDataModel
      }
    
      listItemComponents: [
        ListItemComponent {
    
          StandardListItem {
    
             title: ListItemData   <------------------ here I want to display the filename
             description: "filepath"   <-------------- and here I want to display the filepath
             imageSource: "asset:///images/icon.png"
    
    [...]
    
    onFileSelected: {  selectedFile = selectedFiles[0];  [...]    var filepath = *a string*    var filename = *a string*    theDataModel.append([filename, filepath]); <-------------- how can I add the two strings correctly to the datamodel?}
    

    What my code for the time when I take a file is that it adds two items to the list the first file name as title the second filepath as a title.

    How to manage to give the file name-path to the datamodel so that I can read both of them and put them in the view list?

    // Main.qml
    
    ListView {
      id: listview
    
      dataModel: ArrayDataModel {
        id: theDataModel
      }
    
      listItemComponents: [
        ListItemComponent {
    
          StandardListItem {
    
             title: ListItemData.name       <---------------------------------------------------|
             description: ListItemData.path  <-----------------------------------------------|
             imageSource: "asset:///images/icon.png"                                              |
                                                                                                                            |
    [...]                                                                                                                  |
                                                                                                                            |
    onFileSelected: {                                                                                             |
      selectedFile = selectedFiles[0];                                                                     |
      [...]                                                                                                                |
        var filepath = *a string*                                                                              |
        var filename = *a string*                                                                            |
        theDataModel.append([filename, filepath]); <----------- how do I add the strings correctly so that I can us them in the list
    }
    

    Hello!

    For the arrayDataModel, I suggest you use this

    data var = {}
    'name': name of file,.
    'path': filepath
    }

    theDataModel.append (data);

    If you still have a problem, let me know!

    Simon

  • create component qml and then modify it

    I can create a component dynamically qml of my js, but I have to then check the values of the components.  I can't understand how to do this?  Can I give the created part somehow an id?

    You can give it rather objectName. This thread has some samples of use objectName:

    http://supportforums.BlackBerry.com/T5/Cascades-development/getElementById-in-QML/TD-p/2377935

    Or simply store the instance is created in a property and reference it through this property:

    property myVar variant

    ...

    myVar = xxx.createObject (parent)

    or

    myVar = JSFile.jsFuncCreatingAnObject)

Maybe you are looking for

  • Dv7 - 7398ca Notebook PC ENVY: can the DESIRE for laptop HP dv7 - 7398ca Notebook PC

    This can model of ENVY for laptop HP dv7 - 7398ca Notebook PC use bands 5 GHz for a wi - fi connection?

  • How to rebuild a Windows profile

    Hi, in collaboration with Acad 2012 on Windows 7 running on 64 bit, the application crashes when workin with 3D files, support Autodesk says that in order to solve this problem is to re-create my user profile on Windows. It could be that AutoCAD has

  • The upgrade screen

    Hi guys,. I have a small question, which I don't really know if it of possible or not. The situation is the following: I have a HP ProBook 6570 b with a 15.6 "1366 x 786 screen, which does not seem to cover. Someone I know has a ProBook 6470 b with a

  • WRVS4400N hosting Exchange Server

    I have a WRVS4400n. I have mail.mondomaine.fr that connects to my external IP address where my server is located. Whenever you goto which is the domain or ip address tries to connect to the router. I have remote mgmt disabled as well. Help? Thank you

  • High contrast is stuck on

    Please help me high contrast is stuck on my laptop windows 8 and I can't turn it off, and I tried all the solutions on this site, so I need help ASAP otherwise my laptop will be recycled and I cannot afford a new Thank you FaithCanning