Reference ID of qml files
I have 2 files qml. One containing a pane with tabs (tabbedMenu.qml) and the other (ContentContainer.qml) with a container with a label.
I use ContentContainer.qml as a template for the pages of tabbedPane as follows:
(ContentContainer.qml)
Contains a label with the id headerLabel
(tabbedMenu.qml)
TabbedPane {}
{Page}
ID: connectTab
paneProperties: {TabbedPaneProperties}
Title: 'Tab '.
}
content: {ContentContainer}
ID: connectContent
{Label
ID: testLabelID
text: "text".
}
}
}
...
Is it possible to update the value of headerLabel to tabbedMenu.qml when a tab is changed?
I thought about it. I just used a C++ class, it entered as property and class variables to the variables on the side QML.
See https://bdsc.webapps.blackberry.com/cascades/documentation/ui/integrating_cpp_qml/index.html for an example
Tags: BlackBerry Developers
Similar Questions
-
Manipulate the object in another QML file
I have a drop down menu with some functions that modify sldiers Beach
onTriggered: {}
Slide1.toValue = 10
}
It works fine, but when I move the piece that has the cursor in another qml file and include it like that...
{MyInclude}
}
It stops working. Someone knows why, or how to fix it?
One option is to give an id to MyInclude:
MyInclude { id: myInclude }
And reference it like this:
myInclude.slide1.toValue = 10
But it is better to create an alias of the upper level in MyInclude.qml property to define a public interface. Pseudo-code for MyInclude.qml:
Page { property alias toValue: slide1.toValue ... Slider { id: slide1 } }
These alias properties can be referenced like this:
myInclude.toValue = 10
This is not limited to the alias properties, they can be of any type (int, var, etc.).
-
Why Windows XP Professional give me error messages 'Bad Image'?
With reference to dll32.exe files.\Windows\system32\MSACM32.dll is not a valid system image. Please check this against your installation diskette.Other messages relate to the specific 32dll.exe of the applicationIt seems to me that the msacm32.dll talk of restore point for system restore.Thank youGregHello
1. What is the number of brand and model of the computer?
2. you remember recent changes made on the computer before the sissue?
3. What is the service pack installed?
4. do you have the Windows XP disc?
Run the checker system files on the computer. Link, we can see: Description of Windows XP and Windows Server 2003 System File Checker (Sfc.exe): http://support.microsoft.com/kb/310747
-
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/AssetSelectorThis 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.
-
Is it possible to include a qml file in another file?
Hello
I am creating a list as an example of stamp,
However, all these QML files fall within a records
what I'm trying to do is to create various QML files, and some of these files are shared within other files.
for example: I break the code of stampcollectorapp qml,.
// Second level item see the component in StampItem.qml. ListItemComponent { type: "item" StampItem { } }
The line to [StampItem] looking for another QML file,
If I define StampItem in other current folder, how to write and thank you?
// Second level item see the component in StampItem.qml. ListItemComponent { type: "item" myqmlpath???/StampItem { } }
I think that you must import them into the upper part of your qml, cites the example of application a qml files in subfolders
See here:
https://github.com/BlackBerry/Cascades-samples/BLOB/master/quotes/assets/main.QML
EditScreen is imported in main.qml, and EditScreen is in assets/EditScreen/EditScreen.qml
I don't know if the name of the folder is the same as the qml file name is a convention, then I would try to mess around and see what works.
-
Waterfalls of Beta 4 - cannot change the QML file
Anyone else unable to edit QML files with the new Cascades Beta 4?
I can edit in text mode, but the default editor is suspended the IDE when an existing QML file is changed.
Yes I can. I don't have the QML preview because I use Win 8 64 bit, but the QML perspective opens.
Have you tried a new clean rather than installing on Beta 3 installation?
-
Hi, now I have a sheet of attachedObjects and I open it with mySheet.open ();
I want to move it to an external QML file to make my code more readable, but it does not work. What should I do?
Hello
If you have something like this:
hand. QML
attachedObjects: [ Sheet { id: loginSheet content: ... },
Just move it to an another qml:
MySheet.qml
Sheet { content: ...
hand. QML:
attachedObjects: [ MySheet { id: loginSheet },
-
Animated images in place when loading new QML file
I noticed that when I insert new QML files, the images Animate into place.
For example, if the screen contains an image at the position X, Y, and width W and height H, then the image becomes visible at the point of coordinates 0,0-0 width and height 0 and anime then in place by flying over to the X, Y coordinates and more in addition to being finally width W and height H.
If I then click on the 'Back' button and enter this QML screen a second time, it does not animate.
This implicit animation is intended? While the implicit animations are pretty amazing and a great tool to have, it seems intuitive to the use of screens animations implicit when they are first loaded. It creates a rather unpleasant company and Visual distraction when loading screen.
I thought that I could disable it by adding the following to the ImageView controls:
attachedObjects: [ ImplicitAnimationController { enabled: false } ]
... but they are always animate.
Thank you
Daniel
Did you notice the sample code above? (yes)
This seems to be fixed with the latest SDK.
-
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
-
How to use cppObject in several QML files?
I have a variable cppObject of context set as usual:
QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);
QML-> setContextProperty ("cppObject", this);
And it works very well in the main.qml.
Problem is that it doesn't work in the second pagetwo.qml of QML files that is created on the fly in main.qml when the button is clicked.
No idea how access C++ pagetwo.qml?
Thank you.
I did an application of simple test to replicate this, but I see "HELLO FROM C++" on two pages:
hand. QML
// Navigation pane project template import bb.cascades 1.0 NavigationPane { id: navigationPane Page { Container { Label { text: injection.testFunc() } Button { text: "Other page" onClicked: { // show detail page when the button is clicked var page = getSecondPage(); navigationPane.push(page); } property Page secondPage function getSecondPage() { if (! secondPage) { secondPage = secondPageDefinition.createObject(); } return secondPage; } attachedObjects: [ ComponentDefinition { id: secondPageDefinition source: "DetailsPage.qml" } ] } } } }
DetailsPage.qml:
// Navigation pane project template import bb.cascades 1.0 Page { Container { Label { text: injection.testFunc() } } }
TestEmpty3.cpp:
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("injection", this);
...
QString TestEmpty3::testFunc() { return "HELLO FROM C++"; }
TestEmpty3.h:
Q_INVOKABLE QString testFunc();
-
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 '.
...
}
-
Hello guys,.
Can we push a CPC of QML file? Something like
ActionItem { title: "Show Next Page" onTriggered: { var page = pageDefinition.createObject(); navgationPane.push(page); } attachedObjects: ComponentDefinition { id: pageDefinition source:"sample.qml" } }
Above code pushes QML file on the user interface. Like, I want to push a PPC on the user interface file.
Possible solutions please?
Thank you
SHA.
There is no way to give parameters to builders in QML, AFAIK. One option is to assign the default values, such as:
Constructor (Application * app = NULL,...) so that the item can be built in QML and export these settings as properties too. So I think that the properties can be defined this way:content: MyComponentExportedFromCPP { property: value }
You need to export objects that are used during initialization of QML so. It may be easier to inject the component from C++ code. In this way, you can call a single function in C++ code and create & initialize the object here.
BTW, the way the Application object between instances of the object is not really necessary. It is a singleton and is accessible from anywhere:
Application * app = Application::instance();
-
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." -
Waterfalls in charge of javascript in the qml file
Cascades does support javascript in the qml file? If Yes please let me know how to use js in qml file.
Something tells me that you could not start by checking all the introductory documents. :-)
https://developer.BlackBerry.com/Cascades/documentation/dev/index.html should help you get started, especially the section he titled "JavaScript in QML.
Maybe you are looking for
-
How can I fix it?
-
ATV4 began to display an error message about 50% of the time, when I go to ATV4 of ATV3... 'Content require HDCP for playback. Either your HDMI cable is connected correctly, or your HDMI cable does not support HDCP. Please reconnect the HDMI cable fr
-
Satellite A100-847 - Virtual sound driver for Windows 7?
Hi guys,. Is there an available virtual driver sound for win7? I use Satellite A100-847 and impossible to find some drivers. Thanks for your help.
-
How to acquire data from both channels on a PCI-5922 (OR scope)?
I'm fairly new to LabView (version 8.5.1) and I'm working on my first vi non-teaching. I need to acquire analog of the two channels of a PCI-5922 data. I made a single channel using NEITHER brought Express, but you can use NOR carried Express to bo
-
I can't remove two pop ups a Chetney. E.