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.

Tags: BlackBerry Developers

Similar Questions

  • reset the settings to the printer... still no print... more haven't added any items to the menu bar... they went

    reset the settings to the printer... still no print... more haven't added any items to the menu bar... they went bar & customize window title bar changed...

    By default Firefox will be "reduced to adjust." You who can disable in layout in a regular window or in print preview, but it's hard to call Preview in the window pop up in print, because the menu bar and the toolbar are removed. If it is a common problem, you can use a different add-on (!) which puts the print preview before printing and Page Setup on the shortcut menu.

    I have not used for some time, but I hope that it always works in Firefox 29: https://addons.mozilla.org/firefox/addon/printprint-preview/

  • Behavior of the text-to-speech function when any rows returned.

    Hello
    I have problems with a text-to-speech function.
    The summary cell contains this code:
    <? xdofx:If count (ORDXHR) = 0 then 0 else sum (ORDXHR) count (ORDXHR) end if div? >
    She still shows zero, even when the rows are returned.
    It was originally coded like this:
    <? sum (ORDXHR) div (ORDXHR) count? >
    but this version fails when any rows returned.
    Any tips?
    Thank you

    The cell containing two items that are suggested did the trick.
    Thank you!

  • I can't get an answer to any item under settings

    I can't get an answer to any item under settings

    Hold the sleep/wake and the "home" button until the Apple logo appears and then try again. -AJ

  • has anyone had any strange phone calls claiming to be from Microsoft? Phone number: 007277489117

    Has anyone had any strange phone calls claiming to be from Microsoft? Phone number when you dial 1471 is: 007277489117

    Hello

    Calls unrequested telephone of this nature are almost always a common scam. Do not let them give any info, do not give access to your PC, not give them all the money and do not go to all the websites that they suggest. One moment.

    Please see:

    http://www.Microsoft.com/en-GB/security/online-privacy/avoid-phone-scams.aspx

    Microsoft issues never not solicited for phone calls of support or security.

    These types of callers can use completely fictitious names or bogusly claim to be of real companies other than Microsoft as well.

  • What I did, because I can't copy and paste any item, or I can't move it after pressing the 'V' or

    What I did, because I can't copy and paste any item, or I can't move it after pressing the key 'V' or 'ESC '? Can I cancel it anywhere? THX

    Version of InDesign? OPERATING SYSTEM?

    Is the locked object, or on a locked layer?

  • How to return the QML C++ bb::cascades:Control as a property object?

    Hi all

    I need to return the value of the property QML in C++ code, problem is that this value is object of bb::cascades:Control

    Look at the example:

    import bb.cascades 1.2
    
    Page {
     property NavigationPane currentNavigationPane: tab1.navHandle
     property int testprop:0
    }
    

    In C++, I need to retrieve the value of currentNavigationPane property (I suppose it must point to NavigationPane *)

           QVariant const   prop=__current_page->property("currentNavigationPane");
            NavigationPane* nav_p=prop.value();
            if (nav_p!=NULL){
                qDebug()<<"nav_p is not NULL";
            }
            qDebug()<
    

    As a result of this code: nav_p is the null pointer and app crashes without any note of debugging on qDebug()<>

    I found the solution by Exhibitor class c ++ in QML and I can call its methods with pointer to bb::cascades:Control as a parameter

    QML

    Page {
    id:this_page
        onCreationCompleted: {
            mainCPP.UpdatePage(this_page);
        }
    }
    

    C++

    Q_INVOKABLE void UpdatePage(bb::cascades::Page *call_back_page){
    if(call_back_page){
    qDebug()<<"Page is valid";
    }
    }
    

    By this method, I can use control of Cascade in C++

     

  • Identify any items in the project window?

    I don't know if it is within the limits of what AE script can do, but is there a way to identify all types of layer in the project exclusively window? I essentially tries to grab the item, check if it has certain properties, and then use that to identify what kind of point is (IE record sound, video, adjustment layer etc...).

    This code is pretty rudementary and obviously missing things, but it's the general substance of what I'm trying to do. I need an easy way to accurately identify all the elements in the project window.

    function fileType(item){
                var curItemType;
                
            if(item instanceof FolderItem && item.parentFolder != "Root" && item.parentFolder != item.name){
                    return "Subfolder";
                }    
            if(item instanceof FolderItem){
                    return "Folder";
                }        
             if(item.nullLayer == true){
                    return "Null";
                }
            if(item instanceof ShapeLayer){
                    return "Shape Layer"
        }
    
    
            if(item.adjustmentLayer == true){
                    return "Adjustment Layer";
        }
            if(item.hasVideo == true && item.hasAudio == false && item.duration == 0){
                    return "Picture";
                }
             if(item.hasVideo == true && item.hasAudio == true && item.duration != 0){
                    return "Video";
                }     
             if(item.hasVideo == false && item.hasAudio == true){
                    return "Audio";
                }
            if(item instanceof CompItem){
                    return "Comp";
                }
            
            
        }
    

    Thank you, and I apologize in advance for posting so often on the forums.

    -Nate

    For items, you can not check if it is used as a solid, adjustLayer, etc. Because an item can be used more than once, how can we know the layers from the same source has the same parameters, such as adjustmentLayer or nullLayer?

    The number of types of elements is less than your thinking.

    Regarding the types of layer, a part of my script that save info from any layer of file based on xml and create new layers from this file can be useful for you.

    Here is the code:

    var layerInf = new Object();

    layerInf.type = "null";

    If (thisLayer instanceof TextLayer) {}

    layerInf.type = 'Text ';

    } else

    If (thisLayer instanceof LightLayer) {}

    layerInf.type = "light";

    layerInf.lightType = thisLayer.lightType;

    } else

    If (thisLayer instanceof ShapeLayer) {}

    layerInf.type = "form";

    } else

    If (thisLayer instanceof AVLayer) {}

    If (thisLayer.source.mainSource instanceof SolidSource & thisLayer.nullLayer! = true &!) () thisLayer.source instanceof CompItem)) {}

    layerInf.type = "solid";

    layerInf.solidColor = thisLayer.source.mainSource.color;

    } ElseIf (thisLayer.source.mainSource instanceof FileSource & thisLayer.nullLayer! = null &!) () thisLayer.source instanceof CompItem)) {}

    layerInf.sound = thisLayer.hasAudio;

    If {(layerInf.sound)

    layerInf.type = "VideoWithSound";

    } else {}

    layerInf.type = "VideoWithoutSound";

    }

    } ElseIf (thisLayer.source instanceof CompItem) {}

    layerInf.type = "Comp."

    }

    } else

    If (thisLayer instanceof AVLayer) {}

    If {(thisLayer.nullLayer)

    layerInf.type = "Null";

    }

    } else

    If (thisLayer instanceof CameraLayer) {}

    layerInf.type = "camera";

    }

    In fact, there is another important thing on layer types:is the model a model drawn with RADIUS? So, we have to check as follows:

    layerInfo.geoType = "null";

    If (layerInfo.type! = 'null' & layerInfo.three == true & layerInfo.ray == true) {}

    If (layerInfo.type == "Shape" | layerInfo.type == 'Text') {}

    layerInfo.geoType = "small";          has no source

    } else {}

    layerInfo.geoType = "large";          at the source

    }

    }

  • Not able to receive any (Specific) International Calls on my motorcycle A953

    Hello

    I bought my Motorola A953 of the United Kingdom last month. I recently moved to China. I am faced with this particular problem in which I'm not in a position of some specific operators in India Mobile International calls (I get calls/local calls of the India, fixed Germany etc.). I get a call & on the first ring drops appeal & is marked as a missed call. I raise this question in this forum because I tried to use the SIM card in another mobile & it works well?

    I use 64 K SIM of China Mobile.

    Please let me know of any resolution. Thank you.

    Arnab Sinha

    Shanghai, China

    Ah well, changed my mobile operator China Unicom & sound very well now.

    Thank you.

    Arnab Sinha

    Shanghai, China

  • Function call QML from C++ by signal... it does not work

    Hello.

    Please help me because I'm stuck the last day three...

    Well

    In main.qml

    onComplete() / / signal... .to in button click

    {

    closeProgressBar();

    }

    function closeProgressBar() / / allows to stop the progress as dwonlaoding data from the internet bar had finished.

    {

    progressIndicator.stop ();

    }

    Now in my file app.c

    Q_SIGNALS:

    Sub rollback();

    in my app.hpp

    Emit Rollback();

    but he calling is not my onComplete method...

    and I am unable to stop my progressabar

    pls help me...

    As I did today my plug-in...

    I am wating for your reply eagerly...

    the connect statement is not correct. to take
    Login.Complete.Connect (closeProgressBar)

    I suggest to connect the signal in the onCreationCompleted of the component slot so that runs only once.

    I also suggest that you use some console.log statements to see if the slot is called.

    Furthermore, you mixed hpp and c (or CPP) in your messages.

  • call QML in main.cpp

    Hello

    I want to call a function in main.cpp main.qml!  Is it possible to do this?

    Help me solve this problem!

    Hi Paul24,

    Please check below link

    http://developer.BlackBerry.com/Cascades/documentation/dev/integrating_cpp_qml/index.html

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

    feel free to press the button like on the right side to thank the user who has helped you.

  • QtQuick - C++ Connections item reported in QML

    Hello everyone

    QtQuick has a connection element for access to C++ in QML signals and manage. It looks like this:

    {Of connections
    target: live
    onLiveUpdateStarted: {}
    Console.Debug ("onLiveUpdateStarted qml")
    updatingLiveData.running = true
    updatingLiveData.visible = true
    }
    onLiveUpdateFinished: {}
    Console.Debug ("onLiveUpdateFinished qml")
    updatingLiveData.running = false
    updatingLiveData.visible = false
    }
    }

    'live' where is defined through main.cpp: viewer.rootContext ()-> setContextProperty ('live', live);

    How can I make this connection with stunts like connections does not seem to be available.

    Best regards

    Sebastian

    In fact the connections item is always available, but you need to 'import QtQuick 1.0"first to enter namespace.  At this point, because it is not a visual node, you also need to place it in a list of attachedObjects instead of just came out with the rest of the content page as you have Qt QML.

    Is not necessary, however. Another option that requires no setting in QtQuick is to make direct connections to signals, something like this:

    onCreationCompleted: {
        live.liveUpdateStarted.connect(someFunction);
        live.liveUpdateFinished.connect(someOtherFunction);
    }
    

    Then, you would obviously regular JavaScript (for example, someFunction) functions with the same content as the managers that you have demonstrated.

  • ImageButton error call .qml (beta 3 of waterfall)

    Hello friends, after beta 3 came the waterfall had several errors of new variables and some chains of command in my mobile, entiendiendo already realized a few fix a little problem I had this code works perfectly in Beta 3, I have a button called a qml

            ImageButton {
                id: donar
                defaultImageSource: "asset:///images/donacion.png"
                pressedImageSource: "asset:///images/donacion.png"
                layoutProperties: AbsoluteLayoutProperties {
                }
                onClicked: {
                navigationPane.deprecatedPushQmlByString("donaciones.qml");
                }
                preferredWidth: width
                preferredHeight: height
                translationX: 80.0
                translationY: -60.0
            }
    

    But when I run the application in the alpha dev and I click on the ImageButton control I opened the QML, I think it's due to the structuring of new programming language, could help me with this problem to invoke the QML?

    Greetings.

    I have the Alpha of Dev with Os 10.0.9.44

    Hello

    Please check below link

    https://developer.BlackBerry.com/Cascades/documentation/dev/dynamic_qml/index.html

    Use ComponentDefinition.

    Thank you.

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

    feel free to press the button like on the right side to thank the user who has helped you.

  • Cannot call QML C++ objects

    I tried to check the active frame example since the blackberry official site https://developer.blackberry.com/native/documentation/cascades/ui/active_frames/ and it worked perfectly. But when I tried to integrate it into my app, it showed "cannot find variable activeFrame" warning.

    I know, I have to expose the object of QML with setContextProperty, I did it but in order to use nothing. I use other objects incorporated as batteryinfo (of class BatteryInfo) and all this without any issue at all, either.

    The problem has also occurred when I tried to implement Qsettings in my application and create the reference to the object to use in QML as _myapp and once again had WARNING 'cannot find variable _myapp' in the console.

    The examples perform very well when I run them independently as a stand-alone application. The problem creeps when I integrate and run it in my application!

    All thoughts, which could possible could have gone wrong?

    You seem to be loading your main qml twice, it must be done in the applicationui.

    But to be honest that I fight to read this, please can implement you the suggested changes above, I did?

  • Show only items returns Null while watch value

    Hello

    I have a single display element (P1_ID) on my page in which:

    Source: replacement always, value that exists in session state

    Source type: SQL (return the unique value) query

    Select Max (ID) from User_table

    I have a process that will remove data in another table based on the value of this element. (ID is PK in User_table and FK in my_table)

    DELETE FROM MY_TABLE WHERE ID =: P1_ID;

    Zero or lines will be deleted

    However, : P1_ID is null, while this is to show the value... when I do the point as hidden and protected the deletion will work... but I need to show the value on my page as show only...

    I use APEX 4.2

    so could someone please help me?

    Minoo.TK wrote:

    Hello

    I have a single display element (P1_ID) on my page in which:

    Source: replacement always, value that exists in session state

    Source type: SQL (return the unique value) query

    Select Max (ID) from User_table

    I have a process that will remove data in another table based on the value of this element. (ID is PK in the User_table and is FK my_table)

    DELETE FROM MY_TABLE WHERE ID =: P1_ID;

    Zero or lines will be deleted

    However,: P1_ID is null when it indicates the value... when I make the point as hidden and protected the deletion will work... but I need to show the value on my page as show only...

    I use APEX 4.2

    so could someone please help me?

    case 1:-IF you use session state - YES

    and dynamically change its value it give error protection session state in the future.

    Reference:--

    Session state protection violation

    display only the item and save session state

    case 2:- but if your session set State = no. it ends the session state protection error

    but you will not be able to use the value defined in the feature display

    Solution:-in your case if you want to use the value in the element displayed only as you say

    It works with the value of the hidden Yes it will be.

    either use your display for viewing only, and also set the value of element element hidden to remove from the table

    because

    NOTE:-you cannot set save no. session and its value used in parallel (or it can be used to remove or add that I tested and faced this thing too)

    one last thing keep hidden protected point value NO otherwise, it will give error:-manually editing the protected point

    Reference:--

    HI, Patrick:

    We had the same problem that ' "violation of Page protection: this can be caused by a manual editing of a protected page items." " If you don't know what caused this error, contact the administrator of the application for assistance. Contact your administrator for the application. ».

    APEX 4.1.1.00.23 page protection violation

Maybe you are looking for