Personalized with custom functions callabe DataModel

Hi all

I am creating a data template customized with some features available in the QML code. This is the header file:

#ifndef XMLDATAMODEL_HPP
#define XMLDATAMODEL_HPP

#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 

class XmlDataModel: public bb::cascades::DataModel{

public:
    XmlDataModel();
    virtual ~XmlDataModel();

    // Required interface implementation
    virtual int childCount(const QVariantList& indexPath);
    virtual bool hasChildren(const QVariantList& indexPath);
    virtual QVariant data(const QVariantList& indexPath);

public:

    Q_INVOKABLE
    void load(const QString& file_name);

    Q_INVOKABLE
    void setHeaderName(const QString& headerName);

private:
    QVariant *m_sourceList;
    QString *m_headerName;

};

#endif

And it's the QML app:

onCreationCompleted: {
        console.log("main.qml loaded");

        _model.setHeaderName("hello");
    }

But when the QML code try to run the setheaderName function, I get this error:

TypeError: Result of expression '_model.setHeaderName' [undefined] is not a function.

I have the _topSpeed is accessible by the QML code, but I don't know why I can't run my own functions...

Can someone help me?

Make a Q_OBJECT:

class XmlDataModel: public bb::cascades::DataModel{  Q_OBJECT  ...

Tags: BlackBerry Developers

Similar Questions

  • Sorting table with custom function

    Hello

    I use JDev 11.1.1.4.0

    I have a table with records.

    Public Record (int id, String desc) {}
    This.ID = id;
    This.Description = desc;
    }

    I want to implement a sort function, the description column, based on the length of the string.

    No idea how to do it?

    Hi Pedro,

    In this case, the class registration should be 'comparable' as you say.
    You can replace the current collection with an ordered list/set and then to implement the comparator interface.
    This is an example:

    public java.util.TreeSet getRecords() {
      TreeSet records = new TreeSet(new RecordComparator());
      // routine to get the records
      return records;
    }
    ...
    class RecordComparator implements Comparator {
      @Override
      public int compare(Record o1, Record o2) {
        // be careful with null records/attributes!
        return o1.getDescription().length() > o2.getDescription().length() ? 1 : o1.getDescription().length() < o2.getDescription().length() ? -1 : 0;
      }
    }
    

    After that, try this:
    http://technology.AMIS.nl/2012/03/01/ADF-11g-Programmatically-Configuring-sort-for-rich-table/

    AP

    Correction:
    Just add a transitional attribute to the Record class and try this with this new attribute: http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/

    AP

    Published by: Alejandro Profet on November 12, 2012 15:32

  • How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    Hello

    I want to give as open & export to the level of permissions.

    How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    For example, if the group permissions, inturn should reflect on the users.

    Please help me.

    Thanks in advance,

    A.Kavya.

    Your question is quite broad and fuzzy then I suggest the security catalog presentation to read documentation: http://docs.oracle.com/middleware/1221/biee/BIESC/mgrgrpsusers.htm#CIHIBJGD

    And I think that you mix you two things which are managed in different places:

    ) an object as read access permissions, write, delete... which control you through the object "Permissions" dialog box

    (b) functional privileges controlled through "Manage privileges" under "Administration".

  • OPA Cloud vs custom function

    Hello

    Is it possible in the Cloud edition (version August 2014) to integrate custom functions?

    I'm not in the in the online help...

    http://documentation.custhelp.com/EUF/assets/devdocs/august2014/PolicyAutomation/en/default.htm

    Orlando.

    Hi Orlando,.

    Custom rule functions are not supported in the edition of cloud. What do you want to do with a custom function in particular?

    Kind regards

    Davin.

  • Why is there a limit to the number of Boolean parameters in a custom function?

    We have a custom function which "flattens" four time values of the text in a single time value.

    We want to do the same thing with the Boolean time values.

    However, OPM throws an error when it reads the metadata for the function in extensions.xml.  It shows all the Boolean parameters must be the last.  We can not put all changed because there is more than one.

    This is error code W00001-OPM OPM.

    Any ideas on how I can work around this limitation?

    Excerpt from the OPA developer assistance:

    Only a Boolean parameter can be passed to a function, and it must be the last parameter.  This is due to a limitation in the compiler of the rule.  Any number of other parameters may however be present.

    If you want to pass multiple Boolean values, create a temporary text variable / document values "True" / "False" using the table of rules.

  • Error-could not create an instance of the custom function

    Hello

    I'm trying to implement an extension of the simple custom function OPM 10.2. Here is the code:
    package com.oracle.determinations.examples;

    import com.oracle.determinations.engine.CustomFunction;
    import com.oracle.determinations.engine.EntityInstance;
    import java.util.Random;

    SerializableAttribute public class RandomFunction extends CustomFunction {}
    public Object evaluate (EntityInstance entityInstance, Object [] items) {}

    If (items [0] == null) {}
    return 0;
    } else {}
    -Code to generate a random number
    }
    }
    }

    The xml extension is the following:
    -< extension >
    -< features >
    -name of the function = "RandomFunction" type return = 'number' >
    < name arg = "enterednumber" type = "number" / >
    < Manager platform = 'java' class = "com.oracle.determinations.examples.RandomFunction" / > "
    < Manager platform = "dotnet" class = "com.oracle.determinations.examples.RandomFunction" / > "
    < / feature >
    < / functions >
    < / extension >

    I placed the code extension xml under the Development\Extensions\Examples folder and the jar file named "JavaLibrary1" containing only the above mentioned code is under Development\Extensions\Examples\lib.

    The rule that calls the custom function is as follows:
    the random number = RandomFunction (figure)

    I get the error "Unable to create year instance of com.oracle.determinations.examples.RandomFunction" when I debug the project.

    Please tell me how to solve this problem.

    Thank you
    JAS

    Received your email and found the problem. The problem is the custom .NET, function definition is invalid, and must be (or must be removed).

    When you are debugging with screens, it uses a combination of dosages of Web for Java and the host of the debugger, which takes place in .NET. Although the modules runs into reality in the determinations of web, the debugger needs always to be able to open the modules locally for purposes of reflection (eg. obtaining a list of all possible attributes and the type of data). Even if the modules is not actually executed in .NET, it must therefore be loadable, which means that if you do not provide a custom function .NET Manager, it must be valid. This:

    >

    >

    Does not appoint a .NET class, that's why the debugger complains. Delete this line (only the Manager of java leaving intact) and your example works.

    >
    You also mentioned that the random function is not a good choice, that means that the engine of dosage will not work with the random function?
    >

    Yes, a random function will not work because the engine must be (and is optimized to be) deterministic - same entry should always produce the same result.

    It is difficult to imagine what you can in theory of random numbers for (otherwise), but if you don't need, you may either) front of seeds new sessions with random inputs as attributes of basic (requires customization of your host application, for example, web determinations) or b) generate the random number from other values in your modules such as the customer, name and date of birth. This should ensure that the same combination of inputs will result in the same number of 'random' each time.

  • no selection in the list with custom itemRenderer

    Once an itemRenderer custom, consisting of a canvas with image and label, submit to a list control that list loses the ability to choose. the selectable attribute is set to true. There are no managers in the renderer that can eat the event.

    How can I provide the itemRenderer custom without losing the functionality of the list?

    Theoretically, you should avoid using containers as element converters because they are 'heavy' with the functionality you don't need.

    Best practice is to extend or to copy and modify ListItemRenderer.as. The source is in the file framework somewhere.

    This is not trivial, but it's not rocket science either. The Adobe code is quite clear and well commented.

    In addition, google: Alex Harui element converter, for a few examples by a master of Adobe.

    Tracy

  • OPM does not have the custom function Manager

    1. I have manually created an 'include' file in the 'Development' folder and add it to the project in the OPM.
    2. I put the program manager JAR in the "include" folder
    3. I created "" MyProject - config.xml "and place it in the"include"folder."
    4 OPM charge MyProject - config.XML when I generate the project. I found this by making the XML invalid, and OPM has complained about this.
    5. When you debug the project, OPM says:
    A custom function "isValidSPId" has been called and there is no custom function Manager. Choose a DLL and a class to provide a custom functions for this one.


    And I chose "Java" as a platform for the project properties.

    5. When you debug the project, OPM says:
    A custom function "isValidSPId" has been called and there is no custom function Manager. Choose a DLL and a class to provide a custom functions for this one.

    The debugger expects a function custom .NET, not a custom Java function

    And I chose "Java" as a platform for the project properties.

    I'm not sure what you mean - there is no such thing as a platform of modules - all rulebases are platform independent. Do you mean the setting of "Regression Tester - platform properties? If so, these effects only the platform used to run regression tests - not for compiling, debugging, or running with or without screens.

  • Problems with custom events

    I'm trying to figure out this problem I'm having with custom events, I've read all the documents and tutorials that I can find, and this bit still makes no sense.

    I have the following configuration:

    LoginForm: custom component (which is created as a popup via the PopupManager)
    ApplicationHeader: custom component (which is added to the MXML application)
    application: creates the LoginForm as a popup via the PopupManager, has ApplicationHeader defined in the MXML.

    When a user logs in the LoginForm dispatches an event customized, there are two defined listeners:

    1. in the application:

    private void showLoginForm(): void {}
    var loginForm:LoginForm = LoginForm (PopUpManager.createPopUp (this, LoginForm, true));
    loginForm.addEventListener (UserLoggedInEvent.USERLOGGEDINEVENT, userLoggedInHandler);
    }

    2. in the component custom of ApplicationHeader :

    private function init (): void {}
    parent.addEventListener (UserLoggedInEvent.USERLOGGEDINEVENT, userLoggedInHandler);
    }

    When the event is dispatched the request listener picks it up as expected, however the listener inside the custom component sees ever-even if the event is set to bubble.

    The only way I managed to get this working is to do the following in the application:

    private void userLoggedInHandler (event:UserLoggedInEvent.USERLOGGEDINEVENT): void {}
    // .. the event handling logic
    the return of the event
    dispatchEvent (event);
    }

    This makes no sense at all, what happens if I didn't want the application to handle the event itself. There is a line in the documentation of the event
    who says "You can only save a listener of events with an object if that object dispatches the event." who could explain it, but it is still absurd.

    Any help/tips/examples would be most useful as I am pulling my hair out here.

    Never mind, I just read this post ( http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid = 1257178 & highlight_key = y & keyword1 = custom % 20components) and I was pointed in the right direction - I had to add the metadata for the event to the application.

  • Firefox 4 deployment with custom user settings?

    Hi people,

    I want to deploy FF 4.0 with custom user settings, but where is the "localized" my prefs.js file folder? In FF 3.6.x we extract the setup.exe file and with sources, we have deployed our customized firefox. In FF 4.0 now, there is some file missing from news sources. Are there any documents that explain the deployment of FF 4.0? Thank you very much

    You can always create a folder/defaults/profile and places the files in this folder to have in a new default profile. Folders that have no content are no longer present in the version of Firefox 4 RC, but some are still read and processed.

  • Can I use data value references with a functional overall?

    Can I use data value references with a functional global?  I am trying, but it causes problems:  I run the attached VI with "new DVR" selected.  Then I run it again with "return array" and I get the error 1556: "The reference is invalid. This error might occur because the reference has been deleted."  It seems to have forgotten the DVR, but I thought it should be stored in the shift register.
    
    Another odd thing:  In my VI, if I try to connect the wire shown in "something strange", then the type changes (from U16 array to DBL), i.e. it doesn't recognize the type referenced by the DVR.
    
    I want to pass a very large 4-dimensional array between parallel loops with a functional global.  To avoid memory problems, I want to use a DVR and in-place element structures.  If that's not allowed in Labview, I will try passing it through a user event or notifier.  Any problems with those alternatives?
    
    Thanks.
    

    I received a response from an engineer applications OR on this subject, and it seems that it is perhaps a problem with Labview.  They are working on it, so I'll go ahead and close this discussion.

    Thanks for the help,

    Allan

  • Error with the function "Open/create/overwrite file" with cancel button

    I have attached a very simple VI who embodies what I want to do with my function to open the file. I just want to stop the rest of my program (theoretically embedded in the Structure box) to run if the user deigns to do not to specify a file location.

    However, if you click on the button cancel an error is produced before the rest of the program is running. If ignore you the error and continue, the "canceled" properly true made variable and the Structure of business runs correctly. "" I just want to remove the error message given to me by LabVIEW.

    Any ideas on why or how?

    Read the help of LabVIEW on automatic error handling.

    In your case, you can just wire the output of cluster of error to the structure of your business.

  • Unexplained error with custom events

    LabVIEW 8.6.1f1, Win Vista

    I have an error an once-in-a-blue-moon in my program, I need to track down.

    I have it boiled down to a simple test case, where the error occurs more frequently (but still relatively rarely).

    I have a program called MERS, which is separated from my main code HDT.

    TCM can run on a separate machine, but for this test, it is on the same machine, running under the development of LV system.

    This test simply opens a TCP connection to the TCM, calls for a "signature", it receives and stop the connection.

    The part that opens the connection starts also the TCM RECEIVER running, and kill the connection stops this receiver.

    Here's the code for the main event, and you can see that I get an error apparently because I get no response in MS 2000:

    ---------

    The code to GET the SIGNATURE of TCM is here: what it does is to send a request for the signature and then waiting for an event SIGNATURE RECEIVED by the RECEIVER, or a timeout 2000 mSec.

    The error that I get (-100005) comes from there.  If the TCM has failed to respond, it would look like this.  Indeed, this is why the timeouot trap is here.

    -----------

    However, here is the code of the receiver and the Panel, immediately after a failure.

    It is clear from the TABLE that he received the SIGNATURE of TCM TCM.

    There are NO orders in the table indicates that the receiver was still running for 2000 mSec (4 x 500 mSec) after receipt of the order.

    When it receives a SIGNATURE, the code written will trigger an event.  No errors are reported here.

    So what's happening?  It seems that the event should be raised, but it is not received (Event #0 in photo #2 reacts to the event and returns the word signature, without error).

    This happens not all the time - this case is broken loop # 211 - this number is between 20 and 2000.

    With all those open windows in fact do more often: without them always fails, but she performs thousands of do loops.

    So perhaps it is related to the CPU bustle.

    I checked that there is no error with the function SAVE of EVENTS, even when it fails.

    I come back to the fact that the PICTURE in photo #3 says that the signature was received, but it seems that the EVENT did not get generated or received.

    What are the causes that?

    Is it possible that, since the receiver is dynamically loaded and run, that things are not really created and ready when he says they are?

    OK, that seems to have fixed. -He managed 5000 loops, with the windows open and no failure.

    How completely obvious it sounds, when I put it in words:

    Don't ask a question until you are ready to hear the answer.

    The revised registers for events and THEN asks for the signature.

    So, when the answer comes, even if it is immediately, you're ready.

    Don't ask a question until you are ready to hear the answer.

    Don't ask a question until you are ready to hear the answer.

    Don't ask a question until you are ready to hear the answer.

    Don't ask a question until you are ready to hear the answer.

    Don't ask a question until you are ready to hear the answer.


  • Fitting with integral functions

    Hello

    I try to fit the data with full functions.  It is impossible to obtain analytical solutions of the integrations.

    Integration is integral [(T - abs [x]) f (x) dx, T, - T]

    Here, f (x) is one of the functions of autocorrelation for different model systems.

    Thank you

    Doogie

    Hi Doogie,

    We certainly have the integration and curve build VIs in LabVIEW. For example, you can find several kinds of system integrators in the mathematics > integration & differentiation palette. Also, if you use our design Simulation tools by & control, that built the integration as well. However, because you are dealing with an equation as opposed to sampled signals, I'd start by programming your equation in LabVIEW. Take a look at this forum thread that discusses this, and examples of code.

    Once you have programmed the equation and can generate an array of points for your stove, you might try to enter a function of integration as the "Integrate x (t) .vi" and then use a function as the "general polynomial Fit.vi" curve to generate an equation fitting for him. I would try getting started in this way. Please let me know if I address not the functionality that you are interested in.

    Best regards

  • Why do I get emails intended for person with completely different e-mail address?

    Why do I get emails intended for person with completely different e-mail address? some of the Emails are addressed to names nowhere near the same spelling to my address and I always get them

    You CAN receive email if your email is added to the BCC list [1].

    Most spammers use this medium to spam others.

    [1] http://en.wikipedia.org/wiki/Blind_carbon_copy

    See you soon!

Maybe you are looking for