How to use console.log in this case



  • I want to simply make sure that my property is getting set correctly, so I am logging it to console, but this logging is only possible when I use the brackets, but then this makes the actual setting of the value no longer work:

    @ FileMenu{
    width: menuListView.width
    height: menuBar.height
    topmargin: {labelList.height;
    console.log("top margin is:"+labelList.height)
    }@

    Of course, this builds fine:

    topmargin: labelList.height

    How do you inject a console log in this case?


  • Moderators

    Better move your logging elsewhere.

    But if you want it like this, then this should work:
    @
    topMargin: {
    console.log("top margin is:"+labelList.height);
    return labelList.height;
    }
    @



  • I see, so the brackets basically act like an anonymous function in place.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.