Results 1 to 1 of 1

Thread: qml slot (funtion) value cannot access out side the function

  1. #1
    Join Date
    Oct 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows Maemo/MeeGo

    Exclamation qml slot (funtion) value cannot access out side the function

    hi , please help me i receive a slot (function) in qml file when but function value cant access out side function as playername is class variable.
    but it return empty string my code is with out put .

    Qt Code:
    1. import QtQuick 1.0
    2. Rectangle {
    3. id: container
    4. property string playername: ""
    5. function playerinfo(str,str1,str2,str3){
    6. console.log(str,str1,str2,str3)
    7. console.log("i m comming from c++ file other player name is "+str1)
    8. container.playername= str1
    9. console.log("i am in functoin value displayed "+container.playername)
    10. }
    11. function hide() {
    12. container.opacity = 0;
    13. }
    14.  
    15. width: dialogText.width + 20
    16. height: dialogText.height + 20
    17. opacity: 0
    18.  
    19. Text {
    20. id: dialogText
    21. anchors.centerIn: parent
    22. color:"red"
    23. text: "Dummy"
    24. }
    25.  
    26. MouseArea {
    27. anchors.fill: parent
    28. onClicked:{
    29. console.log(" outside the function player name on clicked is empty " +container.playername)
    30. hide();
    31. }
    32. }
    33. }
    To copy to clipboard, switch view to plain text mode 
    output of this file is >>>>>>>>>>>>>>>>

    i m comming from c++ file other player name is azeem
    i am in functoin value displayed azeem
    outside the function player name on clicked is empty
    Last edited by Lykurg; 15th December 2011 at 06:39. Reason: missing [code] tags

Similar Threads

  1. Replies: 2
    Last Post: 26th August 2011, 08:51
  2. Manifest / Side by Side configuration.
    By hickscorp in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2010, 05:22
  3. Replies: 7
    Last Post: 8th August 2010, 09:05
  4. Replies: 5
    Last Post: 15th February 2008, 02:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.