Add a control QML from C++
//MyListView.qmlimport bb.cascades 1.0 ListView { id: myListView horizontalAlignment: HorizontalAlignment.Fill verticalAlignment: VerticalAlignment.Fill listItemComponents: [ ListItemComponent { type: "item" CategoryItem { title: ListItemData.categoryIcon description: ListItemData.categoryName } } ] }
Hi all, the above code is MyListView.qml.
I would add to my container of C++, all code sample on this please?
Well, the first thing is that you could just create the ListView with C++ coding instead of having a QML file. In this case, you need to use ListItemProvider and not ListItemComponent...
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__listitemprovider.html
This says that you can try:
(1) you can try this code first, if this does not work you will have to perhaps add {Page} in your QML file and place the ListView inside...
(2) somewhere in your C++ code, it could be the class constructor function, but you may want only your ListView to a member variable private in this case, so that it will not reach etc etc...
QmlDocument *qml = QmlDocument::create("asset:///MyListView.qml").parent(app); // create root object for the UI ListView *myListView = qml->createRootObject(); ... ... myContainer->add(myListView);
And if this does not work with the createRootObject and ListView, try:
(1) give your ListView an objectName: "myListView.
(2) put your ListView in a {Page}
//MyListView.qml import bb.cascades 1.0 Page { ListView { id: myListView objectName: "myListView" horizontalAlignment: HorizontalAlignment.Fill verticalAlignment: VerticalAlignment.Fill listItemComponents: [ ListItemComponent { type: "item" CategoryItem { title: ListItemData.categoryIcon description: ListItemData.categoryName } } ] } }
3)
QmlDocument *qml = QmlDocument::create("asset:///MyListView.qml").parent(app); // create root object for the UI AbstractPane *root = qml->createRootObject(); ListView *myListView = root->findChild ("myListView");
Tags: BlackBerry Developers
Similar Questions
-
Dynamically add controls QML since a QML function
Hello!
I would like to add a control available, under certain conditions. To do this, I want to write a function in QML which it will manage. But I don't know how to instantiate a label and add it. Container has the method add() but syntax that new Sun doesn't.
Is it still possible?
Thank you
Hello!
This can be done using ComponentDefinition. This page is an example:
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__qmlcomponentdefinition.html -
How we can dynamically add or remove action from the popup menu in qml item
Hi all
I want to just dynamically add or remove action from the actionset item in the contextual menu especially in qml.
Thanks in advance.
Kind regards
Ankur
You can do so by joining the actionitem as attachedObjects. Once the page is complete (signal onCreationCompleted), you can add it to the page using addAction()
To remove, you simply delete the page using removeAction()
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__page.html
-
How can I add an existing application from my phone to my Apple Watch?
I would like to add an existing application from my phone to my Apple Watch. Is this possible?
Hello
Apple Watch can install applications that State "offers Apple Watch app for iPhone" in their descriptions in iTunes and the App Store.
See, for example, dark sky information:
- https://itunes.apple.com/gb/app/dark-sky-hyperlocal-weather/id517329357?mt=8
To see which applications already installed on your iPhone can also be installed on your watch:
-On your iPhone, in the application of Eve, go to: My Watch (tab) > scroll down to see the list of apps > for everything that you want to add to your watch, press the name of the application, and then enable the setting for "Show App on Apple Watch" > allow a few moments for the application to install.
-
Hello
How to add a control (digital button, boolean) dynamically in control instead of lines and columns selected. Please suggest the idea or no matter what example code you have please share with me...
Thank you
Vieu
Essentially, that's what you're looking for:
Please note that you have to account border sizes and the label of the control so that the code does not work right out of the box. You should also check for the height and width of column and if the position is valid at all before moving around the control.
Norbert
-
Hello, thank you for reading my question.
I've been wrestling with this for several hours. Just trying to change one of the examples provided in LV2014.
1 I add a control, in the command window, a tab as the original controls as you can see on Ref [1], I added the extra and the farm AND Boolean Y & Z, tested and it works very well. This seems to work on any tab, in other words, I click on the tab I want and select a control I want a TI works fine.
2nd I want to actually control the same appearance, see Ref [2]. I could not figure out how to copy and control the moose in the control panel user interface, but has been able to copy and paste the control into the block diagram. However, the control is not associated with the tab and is it should be a simple mater of shuffling to the active tab but not!
Also is there some explanation why two Boolean z, that I did slip on the tab seems different than Y Boolean in the block diagram window? Is this because the Y Boolean has been customized?
-
I fell for the "eventvwr" scam and gave the appellant to control remotely from my computer.
I fell for the "eventvwr" scam and gave the appellant to control remotely from my computer. When I insisted on getting a phone on their part number, I shut down the computer, waited a bit and restarted again. Everything seems normal, but I'm worried. I had to give them a "id" so that they could take control remotely. I have to worry about remote access to my computer now?
I fell for the "eventvwr" scam and gave the appellant to control remotely from my computer. When I insisted on getting a phone on their part number, I shut down the computer, waited a bit and restarted again. Everything seems normal, but I'm worried. I had to give them a "id" so that they could take control remotely. I have to worry about remote access to my computer now?
Remove all device has been installed to allow remote access.
You need to change passwords on accounts and examine your computer and all data within being compromised.
Your line of safer driving is to reformat/reinstall your operating system.
You can also check the following links for more information:
http://www.Microsoft.com/security/online-privacy/avoid-phone-scams.aspx
http://www.mypchealth.co.UK/GuideScam.php
Good luck...
-
Hi allI have the problem with my language of keyboard, the fact is I can't add or remove languages from keyboardWhen I press the keyboard button change that nothing happens, but in the event viewer I get the following messageThe failing application name: Rundll32.exe_shell32.dll, version: 6.1.7600.16385, time stamp: 0x4a5bc9e0Name of the failed module: input.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdf4fException code: 0xc0000005Offset: 0 x 0000000000003756ID of the process failed: 0xf5cStart time of application vulnerabilities: 0x01cd697d57b60837The failing application path: C:\Windows\system32\Rundll32.exePath of the failing module: C:\Windows\system32\input.dllReport ID: 95fbd586-d570-11e1-8bfb-c860006d193aCan someone help me with this? or maybe there's another way to change the keyboard languages? for example through registry?Thanks in advanceI HAVE Windows 7 x 64
Hello
I suggest to create a new user account and check.
Create a user account.
http://Windows.Microsoft.com/en-us/Windows7/create-a-user-account
If the problem does not occur in the new user account, I suggest you to fix a corrupted user profile.
Fix a corrupted user profile.
http://Windows.Microsoft.com/en-us/Windows7/fix-a-corrupted-user-profile
-
How can I get the ability to add additional controls for parental control
I have windows 7 starter I also Windows live installed. In parental controls, I don't have the ability to add additional controls. Why.
Hello
In order to add additional controls, you must first install the additional controls through a separate service provider.
For more information, see:
How to add additional parents controls?
http://Windows.Microsoft.com/en-us/Windows7/how-can-I-add-additional-parental-controls
Note: If you have installed additional controls that do not appear in the Parental controls, check with the manufacturer.
-
How to add images and text from a txt file in Adobe Muse?
How to add images and text from a txt file in muse
Hello Tony,.
At you can easily found in your text, copy and then paste in the new text box within the Muse, following a normal copy and paste.
but images can be copied and pasted, so you need to save the images first as normal JPEG or PNG formats, and then you can import them into your file of muse.
Best regards
_Ankush
-
Hello
I have to add two controls on the same page datagrid. When I try to drag an another DataGrid in the components window, it says "an element with that name already exists in the library."
How can I add multiple controls on the same page datagrid?
Kind regards.
_data2 = new XML (event.target.data2);
should be
_data2 = new XML (event.target.data);
(actually, it's better if it was
_data2 = XML (event.target.data);
-
volume control disappeared from the system tray and will not let me add in the Properties menu
The volume control has disappeared from the system tray, when I open the Properties menu, it won't allow me to check the box to display the volume control
Hello
As method 1 is not available, try Method 3 in the link:
"How to activate or disable the Notification area system icons in Vista"
http://www.Vistax64.com/tutorials/106787-notification-area-system-icons.html
You can also try a system restore to before that was the problem:
«How to make a Vista system restore»
http://bertk.MVPs.org/html/restoresysv.html
See you soon.
-
Dynamically add tabs QML from C++
Hello world
I have a simple TabbedPane defined in QML. I am trying to reference the TabbedPane via C++ to dynamically add tabs. Is this possible? With my current setup, the application starts and crashes then with:
Process 22253787 (MyTabsApplication) terminated SIGSEGV code=1 fltno=11 ip=79310524(/base/usr/lib/libbbcascades.so.1@_ZN2bb8cascades10TabbedPane6removeEPNS0_3TabE+0xf3) mapaddr=00110524. ref=00000010
Here is the code:
TabbedPane { id: mytabs objectName: "mytabs" Tab { title: "Tab 1" FirstPageView {} } showTabsOnActionBar: false }
C++ :
ApplicationUI::ApplicationUI(bb::cascades::Application *app) : QObject(app) { QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("app", this); AbstractPane *root = qml->createRootObject
(); TabbedPane *tabbedPane = root->findChild ("mytabs"); Page* page = Page::create(); Tab* tab = Tab::create() .title("tab2") .description("This is only shown in the side bar"); tab->setContent(page); tabbedPane->add(tab); app->setScene(root); } Thank you!
Try to declare your root as:
TabbedPane *tabbedPane = qml->createRootObject
(); As TabbedPane is a class of AbstractPane
-
Add and remove users from the table
Hi, guys. I do a system that allowed admin in the user control.
The ID is = admin
The neck is = 6649481
Can someone help me to check add it and remove the part.
Actually, it may work, but I would like to make he repeats no is allowed, but it works on the index of '0' and then index 1, it will not stop the user to add id repeated.
Delete if I had to remove the loop will be fine and work well, but it can only remove the top. It's like first first concept but I would like to do as a function of the ID given to remove from the table.
-
several instances of controls QML
Hello
Is it possible to have multiple instances of QML controls such as label, menu drop-down etc, because I have a drop down list and has about 30 + options. I don't want to make another copy, rather want to create another instance, so I don't have too much redundant code in my qml file.
is this possible or do I actually copy all code for 30 + combo options?
Thank you
If you have the code to create these 30 options, you can reuse it.
I don't think that you can copy a dropdown list with all options in one simple operation, but you can browse and copy them one by one.I have some where the choices are copied from other drop-down lists and make this way.
Maybe you are looking for
-
All new MacBookPro... built a year and half ago?
I just bought a MacBook Pro on the apple store in tyson's corner, GOING from the month of April 2016. The specifications indicate that he was a construction start of 2015. Seems I missed on new technology. I'm pretty angry on this subject. Similar ex
-
Also, I read the posts on the conversion of the SDD HARD disk, but it is unclear if this is possible with this model. Should I take it back to the shop of PCWorld and ask for my money back?
-
LaserJet 400 M451dn: laserjet 400
I have a printer LaserJet 400 M451dn . There was a severe storm, but the printer is on a surge protector APC, including a printer HP LaserJet P1501n and other devices. All other devices operate normally. The LaserJet 400 M451dn printer when turned on
-
Epson printer utility set up error 1131
Please can anyone advise me on what I would do I get the above error when you try to install the printer driver for Epson XP - 305? Thank you
-
Cisco Telepresence Server/Cisco Telepresence driver/Cisco VCS - C / Cisco TMS license
A big problem with the fact that I'm stuck is licensing. Really, I have tried many things to find the solution for it, but could not. I have actually made all of these servers (mentioned in the title) in my lab in preparation for the CCNP Collaborati