Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use console.log in this case

How to use console.log in this case

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 933 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qttester5
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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;
      }
      @

      (Z(:^

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qttester5
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved