Adding textfeild dynamically in the second qml file

Hello

I have two files qml, main.qml & second.qml, and there is navigation between main.qml & second.qml.

Now, I want to dynamically add a textfield to second.qml...

Any help would be appreciated

Thank you

C++ its as simple as using containers add and remove features.

http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__container.html#function-Add-...

Here is an example for adding two labels...

    mRootContainer = Container::create()
            .layout(DockLayout::create())
            .margins(0.0, 0.0, 0.0, 0.0);

    mTitle = Label::create()
            .translate(0.0, -5)
            .multiline(false)
            .textStyle(ControlStyles::cardLabelTitle())
            .text("");

    mValue = Label::create()
            .multiline(true)
            .textStyle(*mTextStyle)
            .text("");

    mRootContainer->add(mTitle);
    mRootContainer->add(mValue);

    setRoot(mRootContainer);            // Set the root of the custom control.

To put them in a file QML directly instead of doing everything in C++ you would just need to identify the place in the scene graph that you want to add the textfields somehow.  There are several options to achieve this, such as;

-using the function findChild()

-fixing of the class, and then call the function call to add components

-creation of a customcontrol

Tags: BlackBerry Developers

Similar Questions

  • How cut the length of the string IE channel name here, if it exceeds 20 characters or letters. The channel name is dynamically analyzed the spreadsheet/xml file.

    How cut the length of the string IE channel name here, if it exceeds 20 characters or letters. The channel name is dynamically analyzed the spreadsheet/xml file.

    My Council of Europe in the .js file is

    function generateHTMLMarkup (i, channel) {}
    Alert ("this is lang" + str);
    var str ="";
    "Str += '.

    ";
    "Str += '.
    "+ ""+""+"
    ";
    Alert ("this is lang" + str);
    return str;

    }

    nerateHTMLMarkup: function (i, channel) {}
    Alert ("this is lang" + str);
    var str ="";
    "Str += '.

    ";
    str += "" +
    "" +
    "" + channel ['name'] + "" +.
    "" + "
    ";
    "Str += '.
    "+ "" + "
    ";
    Alert ("this is lang" + str);
    return str;

    etc.

    Give mthe rhythm and the exact code where Ihave tio get implemented.

    in the code, replace change

    channelName var = channel ['name'];

    TO

    channelName var = channel ['name'];

  • Declaring new file c ++ for the new qml file

    I have a qml file, the button I click on function Boutonclique clal

    #include "applicationui.hpp"
    #include "homepage.hpp"
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    using namespace bb::cascades;
    
    AbstractPane *root;
    ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
            QObject(app)
    {
    
        m_pTranslator = new QTranslator(this);
        m_pLocaleHandler = new LocaleHandler(this);
    
        bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    
        Q_ASSERT(res);
        Q_UNUSED(res);
        onSystemLanguageChanged();
    
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // Create root object for the UI
        root = qml->createRootObject();
        if (!qml->hasErrors()) {
    
                qml->setContextProperty("quoteApp", this);
            }
        // Set created root object as the application scene
        app->setScene(root);
    }
    
    void ApplicationUI::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("Test1_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    void ApplicationUI::clickedButton()
    {
    HomePage home = new HomePage(this);
    
    }
    

    Homepage.cpp

    #include "homepage.hpp"
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    using namespace bb::cascades;
    
    HomePage::HomePage(bb::cascades::Application *app):
                    QObject(app) {
    
            m_pTranslator = new QTranslator(this);
            m_pLocaleHandler = new LocaleHandler(this);
    
            bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    
            Q_ASSERT(res);
            Q_UNUSED(res);
            onSystemLanguageChanged();
                QmlDocument *qml = QmlDocument::create("asset:///homepage.qml").parent(this);
                NavigationPane *myNavi = root->findChild("myNavi");
                if (myNavi == NULL){
                    qDebug() << "Unable find NavigationPane";
                    return;
                }
                Page *new_page = qml->createRootObject();
                if (new_page){
                    myNavi->push(new_page);
                }else{
                    return;
                }
                Application::instance()->setScene(myNavi);
    }
    
    void HomePage::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("Test1_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    

    Homepage. HPP

    #ifndef HOMEPAGE_H_
    #define HOMEPAGE_H_
    
    #include 
    
    namespace bb
    {
        namespace cascades
        {
            class Application;
            class LocaleHandler;
        }
    }
    
    class QTranslator;
    
    /*!
     * @brief Application object
     *
     *
     */
    
    class HomePage : public QObject
    {
        Q_OBJECT
    public:
        HomePage(bb::cascades::Application *app);
        virtual ~HomePage() { }
        Q_INVOKABLE void clickedButton();
    private slots:
        void onSystemLanguageChanged();
    private:
        QTranslator* m_pTranslator;
        bb::cascades::LocaleHandler* m_pLocaleHandler;
    };
    
    #endif /* ApplicationUI_HPP_ */
    

    I get in homepage.cpp root is not declared in this scope. I want to click on the main.qml button, I go to new file c ++ and call homepage.qml

    Hello
    I highly recommend investing a few weeks in learning C++ before learning the stunts. Specifically, these topics:
    -Advance declaring types
    -Memory management
    -Classes & inheritance (different from Java, a lot)
    -Life management object qt (parent/child, order of destruction of object relationship)

    These are essential, but we can't really help with them in the form of forum.

    On the compile error, this should probably fix:

    Homepage * home = new HomePage (NULL);

    But there are other problems in the statement of homepage. It's the manufacturer probably shouldn't take an instance of class ApplicationUI as the parameter.

  • ASM disk added without scan on the second node

    Hi all

    Oracle Version: 11.2.0.3

    I need a help for a problem with the addition of ASM disks.

    It is a node two CARS and a disk group was filled.

    A drive was available as UNUSED001 and so we renamed it ran scan disk and disk added to the diskgroup on node1.

    But, as we have not run scan disk on the second node, the name is still the poster as UNUSED001 and assigned to diskgroup showing as a MEMBER.

    In addition, the renamed disk shows as a MEMBER but not attributed with any diskgroup.

    Usually, when this heppens we have to restart the node to solve the problem, but would like to get idea if this can be fixed without bouncing nodes.

    I restarted node and that fixed the issue.

    Closing this thread.

    Thank you guys.

  • Best practices with regard to adding list SkinnablePopUp from the main application file from A Mobile

    Hello

    I want to display a SkinnablePopUp when the user presses the back key when the current view is the first view to ask if he wants to quit.

    Logic (check if the key pressed is the previous key & & the current view is the first) is in the main file of the application and if these two conditions are true, then the exit() method is called.

    I want to show the confirmation popup. Can I move everything in the first pane view mxml or is - it OK to instantiate the SkinnablePopUp in the main application file?

    Thank you.

    its probably best to do principal in the view

    using mvc or mvp you would hold a script to a minimum in sight, just inject the presenter

  • The work on the second computer file transfer

    Hello

    I developed a site of modest family on my computer at home using DW CS4. When I open a page and select F12 to view it in a browser, all my links etc work, and from this initial point of view, I can see the whole site via the menus or links.

    So... I'm going on a trip where Internet access is severely limited I copied all the content of my site on my laptop. The goal is to show what my site looks like members of the family who do not have Internet.

    But... it doesn't seem to work... same copy of DW on my laptop, I can open (and probably edit) any page but when I click F12 to view the page in my browser, this page opens but no links work or menu items.

    Why should it not working on my laptop as it does on my desk? Can anyone tell / show me how to solve this problem?

    Thank you for your time

    How do you transfer files on?  By copying the folder root of Computer1 to computer2?  And then by importing the exported site definition?

  • Executives by the second largest file size?

    Is more FPS translated into a larger file?

    Laughing out loud

  • Restart the numbering of the pages for the exported PDF files

    So I have a book with multiple indd file. I am wanting to export each of these co-operate towards their own PDF, but the numbering reflects the section of the book that is. Is there something I'm missing? Can I set each PDF export as page 1? We do not want to confuse our customers when they open a page 3 PDF that says they are on page 22.

    When you synchronize the numbering in a book he changes number assignments in the component files. in your situation, I probably put the pages of the original of the files in new .indd docs and crops off the original page numbers, adding new numbers on the new master file pages. This allows you to make all your changes in the original file and just update the second link of file when something is changed.

    "" You will find a useful script to InDesignSecrets "Blog Archive" Zanelli releases MultiPageImporter for importing PDF and INDD files

  • QSettings, components in other qml files

    As is often the case with parameters, they are on another page in an application of everything. I use QSettings to similarly as the sample application starshipSettings and met the common problem that is the component, a button, etc., is in a file different qml and page in the application, its id and its properties are not recognized. How could this be overcome? I don't know that there is a simple solution that I could see it often to come.

    If there are the superior means of persistent data, I'd be welcome to their learning.

    Yes, if you take a look at the example parameters Starship ( https://github.com/blackberry/Cascades-Samples/tree/master/starshipsettings ) application, you will find the WarpDrive.qml been 'called' inside the main.qml, such as:

            // Component with warp core image and slider with title and tooltip.
            WarpDrive {
                layout: StackLayout {
                    leftPadding: 110
                    rightPadding: leftPadding
                }
            }
    

    After that, you will find the box set also, such as:

    CheckBox {
                    id: uranuscanner
                    text: "URANUS SCANNER"
                    objectName: "uranuscanner"
                    checked: _starshipApp.getValueFor(objectName, "yes")
                    onCheckedChanged: {
                        _starshipApp.saveValueFor(uranuscanner.objectName, checked)
                    }
                }
    

    So if you do a test on the WarpDrive.qml file, change the bellows of the label:

            Label {
                text: "WARP DRIVE SPEED"
                textStyle {
                    base: SystemDefaults.TextStyles.SmallText
                    fontWeight: FontWeight.Bold
                    color: Color.create ("#ff262626")
                }
            }
    

    to something like:

            Label {
                text: _starshipApp.getValueFor("uranuscanner", "")
                textStyle {
                    base: SystemDefaults.TextStyles.SmallText
                    fontWeight: FontWeight.Bold
                    color: Color.create ("#ff262626")
                }
            }
    

    just to read the value of the parameter in the text of the label.

  • qsTr works does not in all qml files

    any idea?

    in one of my translation of applications inside QML using qsTr ("my text") works only in main.qml.

    all the other qsTr (...) is ignored.

    but this does not happen always - in other applications it works

    thx for the advice

    Make sure that you update the .pro file to include directories from the other qml files. By default, it includes only the root directory of liabilities

  • Several QML files

    Hello

    I'm a developer of Java, Blackberry, and I am trying to learn C++ and QML things, so I have no idea if this is stupid or not.

    I have the assets/qml file, which I configured on my .pro file:

    {lupdate_inclusion}
    SOURCES +=... / Assets/QML / *. QML
    }

    Now I have discovered that I can create custom components, to integrate it on some pages.

    What I want to do now and I tried withou success is:

    How can I use two separate files QML?

    / Assets/QML/pages / *. QML

    / Assets/QML/Components / *. QML

    You can use them just like that, at least, I do not change my project folder.
    qml, you use import "folder_name."
    for example:
    import "preferences."

  • Mapping of the 2 text files with conditions

    Hello

    Just trying to get my head around what would be the best solution that could be implemented in ODI with the next task I.

    I have 2 text files, that the first file is in the format

    AccCode | ChildCodeStart | ChildCodeFinish
    1000-1099 B1000
    1100-1199 B1001

    The second text file
    ChildCode | Alias
    1000 depenses1
    1001 depenses2
    1100 available1
    1101 disponibles2

    The logic is now that I want to AccCode the first map file and match all the codes in the file two which are between ChildCodeStart and ChildCodeFinish

    So my output

    AccCode | ChildCode | Alias
    B1000 1000 depenses1
    B1000 1001 depenses2
    B1001 1100 available1
    B1001 1101 disponibles2

    I don't know what would be the best route for this in ODI, I should load the files in the tables first or can make directly via an interface?

    Thanks for any help

    John

    Hello

    Yes, it is necessary to use a package... Sorry I forgot to mention. The package defines the 'stream of action '.

    Good to hear it works...

    Cezar Santos

  • To access the properties of QML context through several QML files

    It seems so basic, but I don't see how well...

    I put a 'WebAPI' context property to access my class that makes HTTP requests etc. WebAPI works very well main.qml, but when I try and use it in the included LargeThumbItem.qml I get:

    "LargeThumbItem.qml:37: ReferenceError: can't find variable: WebAPI.

    How to set a context property that is available for * all * my QML files? What is the best practice for this?

    hand. QML

    {

    ...

    {ListItemComponent}

    type: 'point '.

    LargeThumbItem {

    }

    }

    ....

    }

    LargeThumbItem.qml

    {

    ....

    WebAPI.getImagePath (...)

    ...

    }

    I do the usual configuration...

    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);

    QML-> setContextProperty ("WebAPI", m_pWebAPI);

    I tried calling qml-> documentContext()-> setContextProperty(), but it did not work. Is there a global context that I can put all documents will inherit? (the API documentation seems to suggest there is).

    This problem is related to what is described here and the solution is the same. The problem is that the ListItemComponents have a different context and lifecylce due to the fact that they are cached in and out as the scrolls of the ListView (see here for details).

    I solved it by adding a dynamic property on the global object of 'Qt' for example in onCreationCompleted() or anywhere where the senses in main.qml. In my case, I chose to pass a string, because I don't know if the global property to the instance around WebAPI is a good idea.

    Qt.homeListBaseURL = WebAPI.getImagePath ("TitleImagePathPrefix", "170 x 240")

    Then in LargeThumbItem.qml for example

    {WebImageView}

    ...

    URL: Qt.homeListBaseURL + ListItemData.ContentId + '.jpg '.

    ...

    }

  • dynamically create the file name

    Hello

    I tried to save the file dynamically according to the following code:

    QUrl(QString::fromLatin1("%1/songs%2.mp4")
    

    This saves the file with something like songs001.mp4, songs002.mp4, etc.

    no idea how to better customize the name of the file to save with something more convenient, say the name being april5.mp4, april6.mp4 and so on... (based on the date or time or both)

    LOL, not really, in any case you can use the QDateTime class to get the current time with functions that return a QString that you can add the name...

    http://developer.BlackBerry.com/native/reference/Cascades/QDateTime.html

    You can also consider adding metadata to help the other players and differentiate data more...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__multimedia__metadata.html
    http://developer.BlackBerry.com/native/documentation/Cascades/graphics_multimedia/audio_video/access...

  • View on the part of the seconds to the time stamp of the file "Update" in Windows Explorer.

    I wish I could see the part seconds the timestamp of the file "Date Modified" when I'm in Windows Explorer and using the details view.  I have Windows XP SP5 and have set up my file options to use Windows Classic view and my view is set to show the details.

    Hello PM_01,

    Unfortunately, when you view the date and time, in the Details view, you won't see the seconds remaining.  However, you can use third party software that will give you this option as well as many other options.  I hope this helps!

    Thank you

Maybe you are looking for

  • HP Envy 4500

    How can I remove COMPLETED the Google print reader queue print jobs. Have deleted Google jobs, but always display in the application of HPePrint. Because the print request are not added in a particular order, it's very confusing know what job you wan

  • Can I connect 220V AC voltage directly at HP Pavilion 8766C?

    Hello! I live in Greece and I would like to know if I can connect directly to a Pavilion 8766C 220V AC. Thanks in advance!

  • Bootcamp on my mac with win 10, after reboot, nothing happened?

    Help me please, I have following the statement as it appears on several tutorial on youtube, apple support forum, etc. I download windows 10 x 64 ISO on windows web then I plug the sdhc with my card reader into the usb drive Open the bootcamp assista

  • Buy a PC

    If you want to buy a PC, do not appear to choose the operating system, only of the solutions of spare "Windows 10 home unilingual, 64-bit, Spanish" but not Windows 10 Pro. Why?

  • Bluetooth in blackBerry Smartphones: Blackberry - GOLD-"Bluetooth devices" in the control panel Device Manager?

    I am a beginner BB but computer user who slowly found pieces of the overall concepts of how my Blackberry is part of mail etc., servers local applications, Bluetooth, USB.  (Links to concepts of BB rather than appreciated step-by-step instructions!)