Retreive QvaraintMap values of Custom QObject in QML

Hello

I'm working on an application that has a general usecase of getting data from the server and show it on the client.

Here is the code for a better understanding

//NetworkCommunicator.hpp

class NetworkCommunicator: public QObject {
    Q_OBJECT
    Q_PROPERTY(QString url READ url WRITE setUrl)
    Q_PROPERTY(Weather weather READ weather WRITE setWeather)
public:
...................
    void setWeather(Weather weather);
    Weather weather();

    void setUrl(QString url);
    QString url();

    signals:
    void dataAvailable();
    void error();
private:
    QNetworkAccessManager *vNetworkAccessManager;
    Weather vWeather;
    QString urlStr;
...........
// NetworkCommunicator.cpp
...........................
vWeather.setLocationMap(rootMap.value("yweather:location").value());
vWeather.setUnitsMap(rootMap.value("yweather:units").value());   vWeather.setWindMap(rootMap.value("yweather:wind").value());

//Weather.h
.................
    Q_PROPERTY(QVariantMap unitsMap READ getUnitsMap WRITE setUnitsMap);
    Q_PROPERTY(QVariantMap windMap READ getWindMap WRITE setWindMap);

//QML
        NetworkCommunicator {
            id: networkCommunicator
            url: "http://weather.yahooapis.com/forecastrss?w=2442047&u=c"
            onDataAvailable: {
                console.log("got response " + networkCommunicator.url);
                console.log("weather " + networkCommunicator.weather);
                console.log("weather.unitsmap " + networkCommunicator.weather.getUnitsMap.value("distance"));
                activityIndicator.stop();
            }
        }

Here is the result

has got the answer http://weather.yahooapis.com/forecastrss?w=2442047&u=c
QVariant (Weather) weather
..................................... 3/native/Assets / / hand. QML:26: TypeError: result of expression 'networkCommunicator.weather.getUnitsMap' [undefined] is not an object.

The issue could be included in the output.

Netcommunicator request a data server and analyzes the data and affects weather analyzed data object receives the response.

But after that I couldn't retrieve the string data to weather object that stores in the form of QvariantMap.

Any help is very appreciated.

As I could not achieve this is QML, I created the view in C++ and started using that. Thanks for you help guys.

Tags: BlackBerry Developers

Similar Questions

  • The value of custom device entry

    Hello

    In fact, I create a custom (asynchronous) device that controls a climate system. It consists in adapting a functional code LabVIEW to create custom device. Unfortunately the LabVIEW code uses a lot of FGVs that act as input and outputs at the same time (this means that the system can change the value of an entry).

    So, I would like to know if there is an easy way to set the value of an entry in the custom device engine code. I tried the following without success:

    • Written in the FIFO of the entrance channel.

    • 'Set channel use value' of the API of NI VeriStand-> I get the error 307970.

    Yes, is there something I can do to facilitate the creation of my custom device? instead of "Rethinking" all the code which is a real pain in the * the complexity of it?

    Thanks in advance.

    Pen

    We solved that by using part of inllne to only update the channel and postponed the real asynchronous threads treatments with exchanges of data through FIFOs.

    ++

  • Call a custom C++ of QML control

    Hi, I have a CustomControl created in c ++.

    How to Prime it and place it in my page of QML?

    I couldn't find anywhere on the sample of docs?

    An example of code? Thanks to yoi.

    use qmlRegisterType('customcontrol', 1, 0, "CustomControl");

    then import them into qml using import customcontrol 1.0

    The example of fire explains quite well using custom timer.

  • Get value of custom attributes in VO property programmatically

    Hello

    I have a custom VO (based on SQL, not an EO instruction), I know it's possible to get programmatically the attribute names (of in the central) using something like:

    AttributeDef[] meta = vo.getAttributeDefs();
    //...
    int attrCount = vo.getAttributeCount();
    for (int i = 0; i < attrCount; i++) {
    String curName = meta[i].getName(); 
    //...
    }
    

    However I would like to know if there is a way to get the value defined in the element of the Description of the custom for each attribute in the VO properties?

    jDeveloper: 10g

    EBS: 12.1.3

    Kind regards
    Carl

    If you are after the custom property to the VO level then you can use the code given by AnilA.

    If you are Custom "DESCRIPTION" property when defined at the level of the attribute, then you can get that by adding a line in your code as below:

            AttributeDef[] meta = testVO.getAttributeDefs();
            //...
            int attrCount = testVO.getAttributeCount();
            for (int i = 0; i < attrCount; i++) {
                String curName = meta[i].getName();
                System.out.println("curName:" + curName);
                String curNameDesc = (String)meta[i].getProperty("DESCRIPTION");
                System.out.println("curNameDesc:" + curNameDesc);
                //...
            }
    

    I hope this helps.

    See you soon

    AJ

  • Capturing the value of custom in the OA Page profile

    Hello

    We created a custom profile and set a value for it.

    Now, I need to capture this value of profile in my OA Page.

    What is the method for capturing the value of profile Page OA?


    Krishna

    Please update the same

    Please read the ettiquettes forums

    http://forums.Oracle.com/forums/Ann.jspa?annID=914

    Thank you
    AJ

  • Singular attitude, selecting a value of custom profile...

    Hello
    I have a very strange situation in which sometimes the selecting a row in the lov on the default form of the EBS 11.5.10. (set the profile values, responsibility for sysadmin, profiles-> system) is not accepted and the lov suddenly appears again,...
    Specifically, as the responsibility of the application developer, we defined a custom profile (defining a sql query, so that the user-> sysadmin should choose from a custom table to a custom application).
    Subsequently, as sysdamin resp., the user must select a value for the profile in the defined lov and affecting the level of responsibility. (by default in form: profile-> system).
    Sometimes, but unfortunately the circumstances or conditions are not repeatable, that the value of the user wants and concludes when the system does not accept it in the lov... and lov window again... the user selects again and the lov reappears... and again... because the value selected from the lov is not valid... {but it is selected in the lov and there is no problem in the majority of cases...}

    Does anyone have any idea... maybe a patch...?


    Note: I use EBS 11.5.10, DB 10 g v.2
    Hopefully, I have described the problem in order to be understandable...
    Thank you
    SIM

    SIM,

    What is the client OS and browser? Can you reproduce the problem on multiple clients with a different user name?

    You will find all errors in the database/application log files?

    Can you reproduce the problem on a test (cloned) instance? If so, I suggest that you turn on debugging and see if you can produce the question and gather more details.

    You can also turn on debugging on JRE/Jinitiator and see if the errors are recorded (see Note: 549423.1 - how to enable tracing and logging for Sun JRE (plugin Native)).

    Kind regards
    Hussein

  • What is correnct how to use GroupDataModel custom inside a qml?

    Hello.

    Got this code qml

        Tab {
            title: qsTr("Friends")
            content: NavigationPane {
                Page {
                    content: ListView {
                        id: friendsView
                            dataModel: friendsModel
                        listItemComponents: [
                            ListItemComponent {
                                type: "header"
                                StandardListItem {
                                    title: friendsModel.header
                                }
                            },
                            ListItemComponent {
                                type: "item"
                                StandardListItem {
                                    title: friendsModel.first_name
                                    description: friendsModel.last_name
                                }
                            }
                        ]
                    }
                    onCreationCompleted: {
                      if (friendsModel){
                        console.log("Here is non 0 model")
    
                      }
                    }
                }
    
            }
        }
    

    And this C++ code

        FriendsApiService* friendsApi = new FriendsApiService();
        friendsApi->getFriendsList();
    
        QmlDocument *qml = QmlDocument::create("asset:///main.qml")
        .parent(this);
    
        qml->setContextProperty("friendsModel", friendsApi);
    
        AbstractPane *root = qml->createRootObject();
    
        app->setScene(root);
    

    It's interesting because I see my virtual functions in groupdatamodel (childcount() and data()), debugging messages

    but then was an error in the console: "Reference error cannot find varialable friendsModel.

    So as a result, I got 5 (cause my model data has 5 rows) empty strings in my ListView.

    In your StandardListItem you use ListItemData.first_name, not friendsModel

  • Pantone value for custom spot colors

    Hello

    I'm working on a project package that was created by another agency and was picked by my agency for future prints/changes.  I am trying to label all the PMS values used in the work of the printer; However, I came across one called color, "SILVER COUNCIL KNOCKOUT".  On the original final design, it's a bright silver strip where the name of the hair dye. I assumed that this grade has been created by the previous Agency.


    My question is how to find the value of that color PANTONE (if possible), OR whether it would be best to choose another color of PMS equivalent? I work in Illustrator CS6 on an iMac.

    Thank you in advance!

    You can choose your own PMS, but you can convert exsiting Pantone color chart with the command reset: https://www.rockymountaintraining.com/adobe-illustrator-convert-cmyk-swatches-to-pantone/

  • Value css custom for a combobox control

    Hello

    I have much combobx in my application.

    I only want a single combo with my skin CSS.

    I want to customize this property: #combo - box - base .arrow-button

    I don't know how he by code and css it does not work.

    I tried

    {.arrow-button-custom #combo - box - base}

    -fx-background-color: red;

    }

    and I have in my drop-down list

    combo.getStyleClass (.addAll("error","combo-box-base"));

    combo.setId("arrow-button-custom");

    but it does not work.

    Use setId() on the node instead of getStyleClass().

    combo.setId("combo-box-custom");

    {.arrow-button #combo - box - custom}

    -fx-background-color: red;

    }

  • HSV values in custom mode

    Maybe it's my lack of understanding.
    1 but if I get the first value of the VHS (so the value shade), I understand this must be a value in degrees on 360, right?
    According to wikipedia: varies between 0 and 360 (but standardized 0-100% in some applications)
    http://en.Wikipedia.org/wiki/HSV_color_space

    But none of the two versions up to 100 or 360, it creates the right angles in the color wheel.

    2. more or less, is also built on the last question because I want to start creation of color combination based on the harmony of the degrees indicated in the image of this site:
    http://www.metacolor.de/winkelharmonie.htm

    Can you please help? By the way: great tool!



    Concerning

    Steffen


    Hello

    This from our special invited talk Ty Voliter, Adobe kuler:

    The reason that the hue of the HSV color model number does not match the angle of the wheel is that Kuler uses a red-yellow-blue color wheel. This wheel fits the color wheel that many artists know where red/green, blue, orange and magenta/yellow are supplements. This wheel has been invented by Johannes Itten, a theoretician of color and art Switzerland. The color wheel does not correspond with different types of color receptors in the human eye and reflects rather how pigments are mixed by painting. Addition of complement of a color with the color wheel Cup.

    Here are a few references with more information:
    http://realcolorwheel.com/othercolorwheel.htm
    http://www.Color-Wheel-Pro.com/color-wheel-types.html
    http://en.Wikipedia.org/wiki/RYB_color_model

  • Value of multi ArrayDataModel in QML

    I have the ArrayDataModel:

     ArrayDataModel {
                id: arrayModel
    
            },
    

    DataSource:

            DataSource {
                id: subListDataSource
                source: "data/xPlayer.db"
                query: "SELECT * FROM song_data WHERE album ='" + subListPage.keyWord + "'";
    
                onDataLoaded: {
                    subListDataModel.clear();
                    for (var i = 0; i < data.length; ++ i) {
                        arrayModel.append(data[i])
                    }
    
                }
    
            }
    

    and ListView:

      ListView {
                dataModel: subListDataModel
    
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.title
                            status: ListItemData.album
    
                        }
    
                    }
                ]
          }
    

    the xPlayer.db file is a table of song_data to store data that include the info of the song (album, artist, title)

    I implement this code but list view do not seem to work properly, it show only the ownership of the album in the title of listview?

    Can I have a multi property table data model?

    Implement a routine listType() on the ListView, something like this:

                    function itemType(data, indexPath) {
                        return 'item';
                    }
    

    Without this, it has no way of knowing that the type of the elements returned by the DataModel should match the type of 'item' you specified in the ListItemComponent.

    You can also change the ListItemComponent to say just type: "" because it is essentially the default element type.

  • Custom QML component not recognized

    From my understanding, to create a custom component of QML, you basically just create a new QML file, create the user interface, and you can immediately call the file name component. He does not like that for my application.

    Currently I have in my assets from the main.qml file, and I want to create a custom separator, so I create a new folder in assets called common, and I create a new QML file with QML container model, called CustomDivider.qml. So far, I'm following the example of Cookbook very well.

    The end result of my CustomDivider.qml is literally that:

    import bb.cascades 1.0

    {Of container

    Divider {}

    topMargin:10

    bottomMargin:1

    }

    }

    In my main.qml, I call CustomDivider {}, and it is not recognized by the IDE. When I run my application, the screen turns black, indicating that something is wrong

    Can someone tell me what exactly is the problem?

    You can also use import "nom_de_dossier".

  • paintEvent for custom QML elements

    Qt, it was easy customized to a QML item re-implement the paintEvent() surroundings and using a QPainter.

    Is it possible to Cascade Custom a QML item? For example, create a pie chart item as shown by the above document:

    http://Qt-project.org/doc/Qt-4.8/declarative-tutorials-extending-Chapter1-basics.html

    Cascades makes its rendering in a separate thread and does not expose an API to render/custom paint.

    There are two solutions for this:

    1. Use the ForeignWindow class, it is possible to incorporate a window in the scene of Cascades. Therefore, you can create your own window and paint your window sort you like - OpenGL or use QPainter on a QImage with the QImage supported by the current window buffer.
    2. Paint a QImage and use it as a source for a PaintDefinition inside an ImageView
  • Help needed to create a POP UP window and stores the values of the custom tab

    Hello

    I have a requirement to store a program competing in a custom table name.

    Fields are concurrent_program_name, user_concurrent_program_name (of fnd_concurrent_programs_vl) and end_user_column_name (fnd_descr_flex_col_usage_vl setting) I finished the job of script to fill the value in the table.

    Now the problem is that I have to design a creation page which have concurrent_program_name (LOV) and user_concurrent_program_name (MTI) and setting (link)

    If the user selects the value in concurrent_program_name means LOV it should display a relevant user_concurrent_program_name (in MTI) and (window) settings.

    So I create card LOV in Concurrent_program_name as follows: 1. the concurrent_program_name card 2. Map of the user_concurrent_program_name.

    Now I select an LOV concurrent_program_name and it shows a user_concurrent_program_name in MTI. (Works fine)

    I need help how to go ahead with parameters.

    If the user clicks on the link he must navigate the window pop up and displays the values of the settings, now I need to keep the close button (if the close button hit the user navigates to page creation.) and if the user hit the button Save page create then it should record the following values of custom table (concurrent_program_name user_concurrent_program_name and settings).

    Pls give me an idea to go ahead and also give me some articles about it.

    Thank you

    Corinne Bertrand

    check out this blog to create a popup window http://mukx.blogspot.com/2007/07/javascript-in-oa-framework.html

    You can create a button with 'Window.Close ()' to close the window...
    You can get the parameters of CP in the following query

    SELECT * from fnd_descr_flex_col_usage_vl
    where as descriptive_flexfield_name ' $srs$. CONCURRENT_PROGRAM'
    AND APPICATION_ID = xx

    Warning : do not do transactions with the pop-up window.

    For information about how to create the page, see Create exercise...

    Prasanna-

  • Any items returned calls QML?

    Hello world

    I am trying to create an instance of a C++ object to a form QML. For now, I did this:

    Game * game = new Game();

    QML->setContextProperty("game", match);

    This gives me the possibility to call functions of the game class in the QML file. (for example: game.getPlayer (0);) The function is called (so that works).

    My problem now is: get an object of this class. For example:

    Player * Game::getPlayer(intplayer)

    {

    Player * p = _players.at (player);

    return p;

    }

    When calling this function, it will succeed (but when I try to connect the result I get nothing. For example, the Player function: getName() returns nothing).

    What I am doing wrong? I think that the references to the obkect, but I don't know where.

    I hope someone can help me with this!

    Thanks in advance!

    Did you register the class of player using qmlRegisterType? If this is not the case, do (before calling setScene). Import the custom type in qml, then.
    The class also has to extend the QObject.

Maybe you are looking for

  • Notes crashes everytime in the sierra of mac os

    recently, sierra mac os update on my MacBook air, application notes worked well even after updated however it suddenly stopped while the sound works well on my parallel devices iPhone and iPad. Please guide me

  • Customize the Dock with Script

    I'm doing an AppleScript script that puts a .app in my dock users based on the org group that they are part of Active Directory.  For example, a teacher will get a different app in the dock as a student, because they are part of another group in Acti

  • How to use the Satellite Pro A100 speakers as a hands-free SmartPhone device?

    I have a your Satellite Pro A100 (PSAAC) and a T-Mobile SDA Smartphone. I would use my laptop speakers and microphone to talk to my cell phone hands-free. I use Vista.

  • How to change the boot on Satellite 5200 sequence

    Hey, I've got laptop - Satellite 5200 901 and I would like to reinstall OS but I don't know how to operate the cd boot, always laptop run the operating system from the HARD drive.I would like to change boot on a CD and I don't know how to change it.I

  • How to recognize the physical cd in vmware

    Hi all, I tried to recognize the physical cd in vmwarebut it is undetectable.Do I know what can be please?