Expose the QGeoAddress with Q_PROPERTY object to QML

Hello

I have a class that I wrote which gets the location of the device and does a reverse search for Geolocation. In my C++, I have an QGeoAddress object, but when I try and access its attributes of QML, I get a "property: unknown type: address QGeoAddress ' error."

I'm loading my class, called LocationInformation in QML by using attachedObects:

attachedObjects: [
        LocationInformation {
            id: locationInformation
        }
    ]

In my head of class LocationInformation, I set the latitude and longitude as attributes such as address:

class LocationInformation : public QObject
{
    Q_OBJECT

    Q_PROPERTY(double latitude READ latitude)
    Q_PROPERTY(double longitude READ longitude)
    Q_PROPERTY(QGeoAddress address READ getAddress)

    ...
}

I am able to call locationInformation.latitude and get a value, but this isn't the case for the address. I have to perform an extra step in order to obtain an QGeoAddress object to be recognized by QML?

Thank you

javabb

QGeoAddress inherit from QObject, my code snippet above will not work (and is what this error means ).  To expose to QML, you would have to wrap up in your own C++ class that extends from QObject.  Or just use c++ instead of QML.

Tags: BlackBerry Developers

Similar Questions

  • How can I export the schema with all objects and a few tables without data

    Hi all

    Verion 10g EA.
    I export the schema with all objects but I need ignored some of the data in the table.

    There is a table 4 people gave huge, we need not to export data from tables but structure must export.


    Thank you
    Nr

    You can do this with a single command.  Run your export as usual and add the query parameters for 4 tables you want all the lines:

    expdp... query = schema1.table1: "where rownum = 0" query = schema2.table2: 'where rownum = 0'...

    It is best to place the query parameters in a parameter file if you don't have to worry about escaping special characters of the OS.

    Dean

  • Expose the abstract as Q_PROPERTY to QML type

    Hello

    I defined a base class to implement interface:

    class AbstractImageProcessor : public QObject
    {
    public:
        AbstractImageProcessor(QObject * parent) : QObject(parent) {}
        virtual QImage process(const QByteArray &data) = 0;
        virtual ~AbstractImageProcessor(){ }
    };
    

    Such implementation that I want from QML looks like this:

    class WebImageProcessor : public AbstractImageProcessor
    {
        Q_OBJECT
        Q_PROPERTY(int maxHeight READ getMaxHeight WRITE setMaxHeight NOTIFY maxHeightChanged)
        Q_PROPERTY(int maxWidth READ getMaxWidth WRITE setMaxWidth NOTIFY maxWidthChanged)
        Q_PROPERTY(bool fit READ isFit NOTIFY fitChanged)
        public WebImageProcessor(QObject * parent = 0) : AbstractImageProcessor(parent) {}
        virtual ~WebImageProcessor() {}
        /* rest of code omitted */
    };
    

    I want to expose this AbstractImageProcessor as one property on another type QML:

    class WebImageView : public bb::cascades::ImageView {
        Q_OBJECT
        Q_PROPERTY(AbstractImageProcessor* processor READ getProcessor WRITE setProcessor NOTIFY processorChanged)
        WebImageView(bb::cascades::Container * parent) : bb::cascades::ImageView(parent)  {}
        virtual WebImageView() {}
        /* rest of code omitted */
    };
    

    So I save my custom with QML types

    //application.cpp
    qmlRegisterUncreatableType("foo.controls", 1, 0, "AbstractImageProcessor", ""); qmlRegisterType("foo.controls", 1, 0, "WebImageProcessor");
    qmlRegisterType("foo.controls", 1, 0, "WebImageView");
    

    How I want to use it in QML

    //main.qml
    import foo.controls 1.0
    /* omitted containers */
    
    WebImageView {
      processor: WebImageProcessor {
         maxHeight: 500
         maxWidth: 300
      }
      /* rest of properties omitted */
    }
    

    But once I launch my request, that he fails to analyze the document qml.

    BB::Cascades:QmlDocument: error loading QML of: QUrl ("asset:///main.qml")
    -errors: (asset:///main.qml:138:57: impossible to assign to the property object) bb::cascades:QmlDocument:createRootObject document is not loaded or has errors, cannot create the root

    In fact, if I hover over the WebImageProcessor class in the editor, he says:

    The super type of the WebImageProcessor component is unknown, some of its properties are not validated.

    Now, the thing is that the example cascades built in ListView exposes a type abstract as a Q_PROPERTY:

    http://developer.BlackBerry.com/native/reference/Cascades/bb_cascades_listview.html#property-datamod...

    Event inspect bb::cascades and bb::cascades:ListView header files:ataModel gives me no other indices because he did essentially the same way.

    I save the types in a different way? If so, how?

    If I use WebImageProcessor in the Q_PROPERTY instead of the AbstractImageProcessor then it works as expected, but I want to expose the abstract type, and as waterfalls is a then it is certainly possible somehow

    Turns out that I've been away an inside AbstractImageProcessor Q_OBJECT macro.

    I swear that I got before with no luck. Perhaps the project today solved the problem of cleaning.

    In any case, it works the way I wanted, with the only exception that Momentics complains about the assignment in qml, but this is just a minor inconvenience.

  • [CS3/4, JS] Apply the pen with an object style

    I was hoping to apply transparency via an object style effects using this:

    myObjectStyle.objectStyleContentEffectsCategorySettings.enableFeather = true;

    But "object does not support the property or method...". "etc.

    I would be very grateful if someone could point me in the right direction.

    Thanks in advance - Jeremy

    I had this same problem with the bevel and emboss effect and I just thought about it!

    Here is the code for my style of object and bevel/stamping out perfectly.  The key is the last line.  You must set the parameter applied to true so he could check the box and actually apply the effect.

    var myObjectStyle = myDocument.objectStyles.item ("FamilyOfFrame");
    try {}
    var myObjectStyle.name = MyName;
    }
    {} catch (MonErreur)
    myObjectStyle = myDocument.objectStyles.add({name:"FamilyOfFrame"});)
    }
    myObjectStyle.strokeWeight = 0;
    myObjectStyle.transparencySettings.bevelAndEmbossSettings.size =. 09;
    myObjectStyle.transparencySettings.bevelAndEmbossSettings.style = 2020618852;
    myObjectStyle.transparencySettings.bevelAndEmbossSettings.applied = true;

    But as I learn... not all effects include the "applied"... property

    Alex

  • Unable to expose the ERP objects like services

    Hello

    In fact, we have created an object in ERP and could not able to expose the object created as a service of s.

    Can someone please help with that?

    Thanks in advance,

    Nitesh Kumar

    What ERP application you're talking about? which adapter is used?

    We will not be able to respond with very little information

    Ravi

  • How to fix the error with the code: 0xe7210001 failed to load powrprof, object: cls

    Hello

    Dose anyone know how to fix the error with the code: 0xe7210001, message: unable to load powrprof, object: CLSD-no-it is found;
    OR: Fingerprintsoftware OR error: replicas THotkey.exe message window and the computer freezes

    Maleware scanned and virus, also in safe mode, found no infection, reinstalled driver fingerprint, but nothing has changed.

    grateful for the help!

    Hello

    > message: unable to load powrprof, object: CLSD-no-it is found;
    In my view, this would mean that there is a problem with Toshiba Power Saver
    What laptop Toshiba, you have exactly?

    Maybe reinstall Power Saver could help. You can find it on the official website of Toshiba.

  • How to display an object mesh continually update with the Labview 3D photo object

    I have a stream of update permanently of 3D images that can be represented in a mesh (a film in 3D if you want). I want to display in the 3D image object so that whenever I acquire a new 3D image that it is displayed. Examples are rare, and I couldn't find anything that dealt with this particular issue.

    Currently (in a FOR/loop WHILE) for each iteration I create an object of the scene, set the geometry as an object mesh newly created, set the texture and it wire eventually to the 3D image. This implementation seems a memory leak (Task Manager shows permanently increases the used memory and processing speed will eventually drop). I guess that's because I recreate the object for each iteration. Problem is, I can't find something that would let me release/delete the object once I'm done with the framework. All the examples I found only deal with the creation of the 3D object once and manipulating.

    What is the appropriate way to code this?

    You just need to use the "narrow" VI on reference photo 3D like this code below. It runs inside the loop.

    Now, if you're dealing with the mesh, then you should use the set the mesh to change the points inside the loop and then just close the reference after the code is done. Look at this code below. The trick is to recover the object using Typecast (to more specific reference VI) reference.

    Also, look at examples of shipping to:

    C:\nivs_dev\2013\InstallTo\ProgramFiles\National Instruments\LabVIEW\examples\picture\3D Picture Control

    and especially the with Meshes.vi.

  • How to detect an interaction of the user with a VerticalFieldManager object?

    Hello

    It is a question for those who have more experience with gui on BB things.  I use the eclipse with Simulator pack 6 and 9800 component plugin.

    I have a VerticalFieldManager (VFM) object that contains a few fields menu. I would like to detect when the user attempts to modify one of these fields, to load a file and update the menus. The thing is that these menus are usually not changed by a user, perhaps only once for the time up-front, something like the choice of your country and city and other, then you will not change that the next time around. So I want to avoid loading the file and simply use the settings saved in the place. Here is what I tried and the solutions I've had but NOT as aestatically

    (1) I can not load the file as a response to one of the modification of fields (using setChangeListener) because it is already too late and the present menu is outdated.

    (2) I can add a checkbox to the optimization of resources and take care to load the file and update the menus there. It works, but I DON'T want. It's ugly and not easy to flow!

    (3) I tried to setChangeListener for the optimization of resources, but it receives no change! Here is the code for my VFM:

    the final private class OkVerticalFieldManager extends VerticalFieldManager implements FieldChangeListener
    {
    ----------------------------

    ----------------------------

    ' Public Sub fieldChanged (field field, int context)
    {
    If ((contexte & FieldChangeListener.PROGRAMMATIC) == 0)
    {

    ----------------------------------------------

    -------------------------------------------

    }

    }

    }

    (4) I tried to listen to reminder to focus on the optimization of resources, but it is called by display from the beginning and it seems that I can't control it. I mean I don't want to be called until the user actually click on the object.

    So I hope that there is a better way to detect a user of ANY click or an interaction with the optimization of resources and I catch and do my thing, before the opening of the menus in there.

    Hope that this clear enough.

    Thank you.

    A few possibilities:

    1. you can check the field with emphasis (to use VOR getLeafFieldWithFocus()) in your makeMenu() and branch accordingly.

    2. you can define listener focus on each field change and bake menu items when its focusChanged() method is called with equal to FOCUS_GAINED eventType. There you can check the setting of field and prepare the relevant menu items.

    You can use the same setCookie/getCookie approach I have proposed before in both scenarios if you wish.

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • change the angle of view of grid 3D with existing objects

    Hello

    I'm new to the perspective grid in Adobe Illustrator and would really appreciate some help. I created a simple room with a 2-point perspective Interior and an angle of 45 degrees. I will now show the same room with an angle of 60 degrees. Is it possible to change the angle of view of 3D with existing objects in it or what I need to re-create the room with a different view angle each time? Can I change the numbers in perspective to define and changes to the grid, but the House does not seem to change with it.

    Thanks, Conny

    the perspective grid is just a load of directives fantasies. It does not affect what you draw after one more as a similar grid drawn on paper could.

  • What is the problem with the conversion of objects with gradients to the gradient mesh?

    What is the problem with the conversion of objects with gradients to the gradient mesh?

    Radial gradients are special, and it could become difficult edit the gradient mesh resulting.

    Take the layer apnel and inspect your objects. You will find a clipping mask the cracks inside.

  • Is it possible to change the scale of an object with parallax scrolling in Muse?

    Is it possible to change the scale of an object with parallax scrolling in Muse?

    Hi Cashmoneydonuts,

    You can create an animation for it using edge animate and add it to the Muse.

    The following link might be useful:

    Brighten up the Adobe Muse CC sites with animation effects. Inspired by Adobe Magazine

    Concerning

    Sonam

  • Can I put an object on the side of the browser with the response?

    Hey everybody,

    I'm trying to do something like these circles here:

    Juice bars | Acai Bowl | Juice cleanse | Juice Nekter bar

    So my problem is that if I just put the circles on the page, it is not in the browser and the circles just stay in the middle of the page. If I try to use the method with the text box, the circles do not react and when the user continues or decreases the size of the browser the circles to stick to the left and are not responsible for the same as in the example...

    Can someone please guide me briefly on how something like that can be a Muse?

    Thank you!

    Hello galpardo,

    In your case, I would recommend you to create circles as an image in Photoshop or a. SVG in Illustrator.

    And then import them into Muse, on which you will be easily able to apply responsiveness on this issue.

    It is a doc explaining how process and import graphics SVG in Adobe Muse .

    Best regards

    Ankush;

  • Change the visibility of the text with a button object

    Hey guys,.

    First post, so probably incredibly easy, noobworthy question.

    I'm in the Muse, and the project I created has a page with a 'true' and 'False button. ' When the user clicks on one of these keys, I want to display different responses on the page. First, that aren't visible.

    If I was coding from scratch, I would use a .onclick Javascript to show the 'div' with the appropriate text when the user has clicked on it... Is there a way to do the equivalent in Muse?

    Thanks in advance for answers! This had me boggled as a new user of Muse for centuries - it seems that something you should be able to do...

    Looks like a widget of Composition with 2 containers of trigger and 2 target.

  • Object to QML C++ signal/slot mechanism transfer

    Hello!

    I have a simple class:

    // myclass.hh
    
    class MyClass : public QObject {
    
        Q_OBJECT
    
        Q_PROPERTY(QString title READ title)
    
    public:
        MyClass(QObject* parent = nullptr)
            : QObject(parent)
        {}
    
        ~MyClass() {}
    
        MyClass(const MyClass&, QObject* parent = nullptr)
            : QObject(parent)
        {}
    
        QString title() const
        {
            return title_;
        }
    
    private:
        QString title_;
    };
    
    Q_DECLARE_METATYPE(MyClass);
    

    and in the main function, I save my metatype system class

    // main.cc
    
    ...
    qRegisterMetaType("MyClass");
    
    MainClass mainclass;qml->setContextProperty("mainclass", mainclass);
    ...
    

    and in another place, I try to convey the purpose of the MyClass class via the signal:

    // mainclass.hhclass MainClass : public QObject {    Q_OBJECT
    ...
    signals:
        void my_signal(MyClass);
    ...
    };
    // mainclass.cc
    ...
        MyClass mc;
        emit my_signal(mc);
    ...
    

    and try to catch this object in qml slot:

    // .qml
    
    Container {
        onCreationCompleted: {
            mainclass.my_signal.connect(signalHandler)
        }
    
        function signalHandler(myClassObj) {
            console.log('we here') // output 'we here'
            console.log(myClassObj.title) // output 'undefined'
            console.log(myClassObj.title()) // empty output
        }
    }
    

    Macro Q_INVOCABLE added before the declaration of MyClass::title() has the same effect.

    What is wrong with my code?

    This is the signal for all

    Q_SIGNALS:
    
        void addedToAllOrder(Order* order);
    

    Order is registered:

    qmlRegisterType("org.ekkescorner.data", 1, 0, "Order");
    

    Import in qml:

    import org.ekkescorner.data 1.0
    

    Qml connection:

    onCreationCompleted: {
            dataManager.addedToAllOrder.connect(onAddedToAllOrder)
        }
    

    Important! set a property in qml:

    Page {
        id: orderPage
        .....
        property Order anotherOrder
    

    then everything works well in qml function (SLOT)

        function onAddedToAllOrder(theOrder) {
            anotherOrder = theOrder
            console.debug("Order added: " + anotherOrder.nr)
        }
    

    This is how I have face this kind of stuff

    using a pointer ensures that there'e really a single object used in memory and you can use QML.

    the cool thing: he is glad assist in qml: type anotherOrder. ... gives all properties to select and you deal directly with your C++ object. don't forget that your C++ class is the owner (parent) of your object

    hope that gives you some ideas to try

Maybe you are looking for