I've inherited a collection of mostly undocumented QML code. I'm new to QML, and I'm struggling to understand this code. In particular, the construct
expression: "connected == false"
occurs frequently in various items, but I can't find any documentation on what this property does. It does not seem to be defined anywhere in the existing code collection, so I'm assuming it's part of QML, but I'm having no luck turning it up anywhere.
It looks as though all items using this construct are backed by C++ classes. However, "expression" is not defined as a QPROPERTY anywhere in the C++ code.
Nope, there's no such property in QML. You'll have to look into the QML file for the type that it's used in, or the C++ if it's declared there.
Related
I'm studying the code of a custom Confluence plugin, which contains an atlassian-plugin.xml file that includes references to two variables $generalUtil and $helper, but I find no definitions of them whatsoever in the entire project. They simply work and it appears to me that they are magically instantiated out of thin air.
<web-item key="configtab" name="configtab" section="system.space.tools/addons">
<label key="myplugin.space.tools.addons.tab.label" />
<link>/spaces/myplugin-config.action?spaceKey=$generalUtil.urlEncode($helper.spaceKey)</link>
</web-item>
The $generalUtil must be an instance of com.atlassian.confluence.util.GeneralUtil, which also has a method urlEncode(). But where does this variable originate from?
What puzzles me even more is the $helper, which has a spaceKey field/method that I find in the code, but without any relationship to any kind of Helper class. The $helper also appears in a velocity template, but also without any definition of it. Any ideas where this stuff is documented?
generalUtil is documented here: https://docs.atlassian.com/ConfluenceServer/javadoc/7.11.6/
I think helper is https://docs.atlassian.com/ConfluenceServer/javadoc/7.11.6/com/atlassian/confluence/themes/GlobalHelper.html
They are injected into the Velocity context used to render that link.
What is the proper way to test if an item has been anchored? For example, take the left side, I have tried:
property bool isAnchored: parent.anchors.left != undefined
But that does not seem to work? I also tried:
property bool isAnchored: !!parent.anchors.left
which also does not seem to work, I also tried:
property bool isAnchored: parent.anchors.left ? true : false
Any other ideas? There has to be a way to check if an item is anchored but I can not find it?
Unfortunately I don't see any way to do it using the provided/exposed properties. The only thing that determines a valid anchor is the Anchors flag type which is defined in the QQuickAnchorLine::anchorLine member, but that's not exposed to QML anywhere (eg. anchors.left.anchorLine is always undefined). Or in the public C++ API for that matter. The actual QQuickAnchorLines attached to each object are always valid/non-null, as you've discovered.
I think you will need to implement your own flags in whatever routine(s) which set or remove the anchors in your code (I assume that has to be determined somewhere). That is, whenever an anchor changes, set a custom property value. There are also the anchor change signals (leftChanged() etc.) which could be connected to.
Alternatively, you could re-implement your own attached Anchors object in C++ and track whatever properties you want (basically same as the above suggestion but centralized in a C++ class). Here is a good example (I think, not my code) of defining your own anchors lines using a custom attached object. With something like this it would be pretty easy to track/query what is anchored to what.
I know how to make a propertyalias in the QML
property alias workisvis: blahblah.visible
and then set a property for it using
root->setProperty(workisvis,false)
from my C++ code. But how do I read a property of a QML object from my C++ code? Something like "getProperty" (I tried that but it didn't work.)
Almost getProperty:
root->property("workisvis").toBool();
I am trying to convert some existing JavaScript code by using TypeScript, One example I am using is to create Highcharts classes, the Highcharts definition is from https://github.com/borisyankov/DefinitelyTyped/blob/master/highcharts/highcharts.d.ts
We all know HighchartsOptions has a property title.
If I define the object in this way, I have intellisense
But if I define object this way
I don't have the intellisense.
Any specific reason why Visual Studio behaves differently?
It's just a bug. See this issue on CodePlex to track when it gets fixed.
When I'm typing up a Cocoa object and calling a selector on that object, I sometimes can see 'documentation' or 'help' information about that method. For instance, as I type [NSArray alloc], I see two help hints. One for NSArray, and one for alloc. Both of these appear in the popup autocomplete suggestions listbox as I type the code.
How do I produce similar method/class decorated help hints which will appear when I type? I want to see my comments as I type my custom class name and custom methods. How can I do this?
For instance, C# provides this feature through XML documentation which can be placed before any method, class, or interface/protocol declaration.
You have to create a “docset”. There are tools like appledoc for creating docsets from your comments. You could set up a build phase that runs appledoc on your code.
The problem is that there's no way to make Xcode 4 reload a docset except by restarting Xcode. So even if you run appledoc automatically as part of your build, you will have to restart Xcode to make it see the changes to your docset.