findChild() does not

Hello

Plese mention the following code

QmlDocument *qml = QmlDocument::create("asset:///main.qml");
        qml->setContextProperty("cppObject", cppObject);

    NavigationPane pane = qml->createRootObject();
        app->setScene(pane);
        Button* btn = pane ->findChild"increaseButton");
btn = Application::instance()->findChild"increaseButton");

I am unable to get the button defined in the QML document.

Refer to the QML doc...

NavigationPane {
    id: navgationPane
    Page {
        Container {
            layout: DockLayout {
            }
            Button {
                id: increaseButton
                text: "Increase the value"
            }
       }
  }
}

Please suggest me possible solutions.

Thanks in advance.

Kind regards

SHA.

Hello
Add
obectName: "increaseButton".
button {}

Note the quotes, they should be present.

Button {
  id: increaseButton
  objectName: "increaseButton"
  text: "Increase the value"
}

Tags: BlackBerry Developers

Similar Questions

  • findChild() function does not work

    I have a code:

    QML

    ListView {
                        id: expenseList
                        objectName: expenseList
    
                    }
    

    and CPC:

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        ListView *expense = root->findChild("expenseList");
        if (expense) {
            ArrayDataModel *model = new ArrayDataModel;
            model->append("Apple");
            model->append("Google");
            model->append("Microsoft");
            expense->setDataModel(model);
            qDebug() << "listview finded";
        } else {
            qDebug() << "listview cannot find";
        }
    
        app->setScene(root);
    

    Why this code always returns "listview does not. I don't know where was my wrong code? someone help me

    Object name must be in quotes...

    import bb.cascades 1.0
    
    // creates one page with a label
    Page {
        Container {
            layout: DockLayout {}
            ListView {
                id: expenseList
                objectName: "expenseList"
            }
        }
    }
    
  • TextField, submitted using c ++ does not

    Hi all

    I am trying to connect to the TextInputProperties::submitted(bb::cascades::AbstractTextControl*) signal, but in fact it does not. This is my code:

    TextField *inputField = uiPage->findChild("damageInput");
        QObject::connect(inputField->input(),
                SIGNAL(submitted(bb::cascades::AbstractTextControl*)),
                this,
                SLOT(onSubmitted(bb::cascades::AbstractTextControl*)));
        inputField->input()->setKeyLayout(KeyLayout::Number);
    

    I see no error on the console. In any case my events onSubmitted method is never called, even if it is declared as a crack:

    public slots:
        void addClicked();
        void subtractClicked();
        void onDialogFinished(bb::system::SystemUiResult::Type );
        void onSubmit(bb::cascades::AbstractTextControl *);
    

    I did something wrong?

    The only mistake I found on the log of the device is that:

    Dec 09 11:10:54.807 com.example.MagicManager.testDev_agicManageref1201b1.237248764... 0 csuifw_error ERROR ClientObject::removeAttributeListener() 15555 - recorded none of these headphones attribute on object

    But I don't know if it is related to my problem. Any idea?

    In theory, it is not strictly necessary,

    I tried to add the name with the same result.

    In any case, I found the problem, whas my fault.

    in fact in the connection, I stated as a crack the onSubmitted method events:

    QObject::connect(inputField->input(),
                SIGNAL(submitted(bb::cascades::AbstractTextControl*)),
                this,
                SLOT(onSubmitted(bb::cascades::AbstractTextControl*)));
    

    But the crack in the class's onSubmit:

    void onSubmit(bb::cascades::AbstractTextControl *submitter);
    

    Then, to fix this problem, solved the problem. Unfortunately this kind of errors is not recognized by the compiler.

  • ListView does not not datamodel

    Hello all, been doing a page that once pushed display listview with data populated by a groupdatamodel to a SQL database. It seems to only work if the stage of the application is set on the page with the ListView, with Application::setScene (listPage);

    If I have rather another set here page and the page of the listView is pushed by the other page, it does not meet the list. I'll show an example:

    App::App()
    {
    
        QCoreApplication::setOrganizationName("testName");
        QCoreApplication::setApplicationName("testApp");
         qml = QmlDocument::create().load("main.qml");
           qml->setParent(this); 
    
              if (!qml->hasErrors()) {
                  TabbedPane *tabs = qml->createRootNodesetContextProperty("contextProperty", this);
                    createSongsPage();
                    if (tabs) {
                    Application::setScene(tabs);
                    }
                }
    }
    

    Then I can move the tabs to the songsPage that my list and been created like this:

    void App::createSongsPage() {
    QmlDocument *qml = QmlDocument::create().load("Songs.qml");
    if (!qml->hasErrors()) {
    songsPage= qml->createRootNode();
    if (songsPage) {
    QVariantList sqlData = dataAssist->loadDatabase("quotes.db", "quotes");
    myDataModel=songsPage->findChild("songsModel");
    myDataModel->insertList(sqlData);
    myListView = songsPage->findChild("songsList");
        }
         Application::instance()->setScene(songsPage); //settings scene to this page works, not when pushed                                                                                                                                                                     }
    

    This does not work, and I do not get a list populated unless I put the scene to this page, as shown in the last line of the top. It is pushed by thrust disapproved by the chain method, I am interested, why it does not work unless it is "first page" that the stage of the application is set to this page and it's the only saw the opening.

    I can explain what if something is not clear and do not have a deep knowledge of archiving in this way, so if it is an obvious problem I apologize for not to see it earlier. Thank you.

    * EDIT: Sorry about the poor formatting, he pasted terribly.

    Hello

    I was working on it and got it running on Simulator and the device.

    Well, don't know how it fits your current implementation, the key for my app should reuse the save view refrence list on two pages with Exchange of data model.

    And then as soon as the data model is defined, the content to load.

    Thank you!

  • ListView does not populate when entered second time

    Hi all

    It comes to my previous query:

    http://supportforums.BlackBerry.com/T5/Cascades-development/problem-with-findChild/m-p/2441175#M2524...

    Now when opening the app, I can see the listview in the note.qml and after click on return of the navigation pane and enter the same page (note.qml) still I am not able to see the ListView.

    The code is available in the link above.

    I guess that groupDataModel is exposed via C++ right? Is Qt.objectCrypt.fetchNotes () who is to fill the data model?

    I think your problem might be that the ListView takes possession of the "groupDataModel". Then he destroyed it once the page is destroyed. And the second time, it does not appear because the data model is already destroyed.

    See the documentation of the ListView, as soon as you assign it a dataModel is supported if the datamodel does not have a previous parent. So your solution is perhaps here give the groupDataModel a parent existing if ListView does not try to take ownership.

  • Adding images dynamically - tutorial for examples does not work

    I am using the SDK Gold and work through the tutorials. I want to add dynamically images of C++. The tutorial that I use is here:

    https://developer.BlackBerry.com/cascades/documentation/dev/integrating_cpp_qml/ (under the heading "Injecting C++ objects in QML").

    I have copy and paste the main.cpp, TestApp.hpp and TestApp.cpp into a new project. He compiled and ran on my device, but when I click on the button 'Add the container' seg application vulnerabilities and ends.

    I understand that this is caused by a NULL pointer, so I added:

    This-> mRootContainer = new bb::cascades::Container();

    for the Builder. Now it does not segfault when I press the button 'Add the container', but again, it does not actually add the container (it adds nothing visible).

    How can I use the concepts described in this tutorial to add an image at run time?

    I managed to understand. The example provided in the tutorial defnitely badly, which is very annoying and frustrating for those of us learning to code for BB10. Not only that, but the "barrier to entry" is hard enough, and if Blackberry to their ecosystem to flourish, documentation and tutorials must be accurate and easy to follow.

    The constructor should be something like:

    TestApp::TestApp(bb::cascades::Application *app) : QObject(app)
    {
      QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
      qml->setContextProperty("injection", this);
      Page *appPage = qml->createRootObject();
      mRootContainer = appPage->findChild("rootContainer");
      app->setScene(appPage);
    }
    
  • iPhone 7 more buttons outside does not

    I've had my iPhone 7 + for about 2 weeks now. Every once in awhile all buttons outside to stop, volume up/down, power, home. The home button will still record and push and give the sensation of taptic and touchID works. The phone itself still works and I can answer texts and which do not use notifications.

    The couple spent time he did, he came upon her in about 4-5 minutes, however it was about half an hour and still nothing. I want to restart my phone, but the switch does not work.

    Has anyone seen this issue or know how to fix?

    Thanks in advance.

    I just experienced the same problem on my iPhone 7, I think it's a bug in iOS, but I am using iOS 10.0.2. Power + button low Volume allowed me to turn it off then turn it back on... Apple please fix this bug!

  • App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    After upgrade 'OS X El Capitan' to "macOS Sierra" window only empty "App store" and page "Safari" made its appearance, no error message shows. store "iTunes" and "Dictionary" does not connect too.

    But Google chrome works well.

    So have you tried the next steps in your original post that Safari does not work after installing macOS Sierra:

    (1) x OS: "Unable to connect" or "unable to connect to the App Store. An internet connection is required"- Apple Support

    2) Advanced the steps to correct the problems with the iTunes Store - Apple Support connection

  • Safari does not work after installing macOS Sierra

    Safari and apple store does not work after installing macOS Sierra

    Alas, my crystal ball is in the shop for cleaning, so you will need to provide more details on what "doesn't work" and above all error messages. First of all, let's start the App Store. Provide as much information as possible for those of us who do not sit on your shoulder.

  • My iPad Apple 3rd generation wifi + his cell phone does not work

    MY 3rd generation Apple iPad, wifi + cell

    model number MD408LL/a

    Serial number DM * VGL

    THE SOUND DOES NOT WORK

    < personal information under the direction of the host >

    All sounds, or simply notification and sounds apps (for example do music and videos app still have sound)? If notifications and apps you have notifications on mute: on the iPad side switch - Apple Support ? If the sounds in all applications which have tried for example soft-reset/reboot of the iPad, insert/remove the headphones?

  • After recent, iPhone, 6, update, Windows, Explorer, does not work, see, iPhone

    I installed the latest update required for my iphone ios 6 a few days ago, and now when I try to download pictures from my iphone to my PC (via USB connection), the PC does not see the iphone.   iTunes sees it yet, but windows Explorer does not work.  It seems that some setting has been broken through the update of ios.  A way to solve this problem?

    Restart the computer and the iPhone. Unlock the iPhone before connecting it to the computer. Any change?

    TT2

  • iPhone 7 more telephoto camera does not

    Is anyone having problems with iPhone 7 more telephoto does not activate. I'll go to the camera application and press the 2 x zoom feature, but it appears to be not to activate the camera of 56mm at the front. I cover the lens with my finger, the camera on the right side and the iPhone always displays an image despite me concealing one of the cameras teo. I can't activate the second camera. It seems to only be zooming digitally. I'll do this outside and he'll only digitally zoom when I hide the second lens.

    Im having this same problem. I heard from someone that he could not work until the next software update... but I have no idea and have not found anything in the online help. If someone else gets to know how.

  • Contact ID battery fast draining iPhone 5s does not

    5s fast drainage and Touch ID sinice 10.0.2 iOS iPhone battery update does not

    Restarted the iPhone since the update yet?

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo.
  • Open the link behind Mail does not work

    Sierra using my link opened behind Mail does not work. The link opens on the top of the window.

    This option works for me in Sierra... is working for you with your previous version of the OS?

  • Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Hey there Scotchman2926,

    I understand that you are experiencing some problems with Apple music on Sierra. I have a few suggestions to help you solve this problem. First of all, if you are unable to access the iTunes Store as well as music from Apple, use the information in this article to help resolve this problem:

    If you cannot connect to the iTunes Store - Apple Support

    If this does not resolve the problem, you might try signing out of your Apple ID in iTunes and then connect again.

    Thanks to be come to the communities of Apple Support and let us know how it goes.

    See you soon.

Maybe you are looking for

  • still can not change home page

    I've repeatedly tried to change the homepage, it keeps going back to yahoo, I looked for alternatives, but none of them doesn't seem to actually work some of the mentioned files as *.js files do not even exist on my system

  • Recover deleted files / folders in my laptop

    I accidentally deleted a folder (containing the doc and ppt, JPEG files) on my desktop from HP running on Win7. How can I recover the files and folder? Thanks in advance for the advice. John

  • DAQ Assistant do not find channels of the cDAQ

    We recently bought the Compact DAQ and two thermocouple modules 16 channels.  I am trying to change a code to use a Pico USB logger for the cDAQ and I'm trying to follow the examples found on your Web site using the DAQ Assistant.  Initializes the DA

  • XP will not load some .exe files! and much more

    I accidentally deleting a file in the registry

  • Problems loading micro SD through player card?

    Page 10 of the manual it says that you can drag and drop file sto an insider of a microSD for your player's going to my computer > card uSd Sansa Clip + external. Today, I received my new Sandisk 16 GB microSD card. However, when I install in the pla