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. console.log formatting
Qt 6.11 is out! See what's new in the release blog

console.log formatting

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 754 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.
  • D Offline
    D Offline
    David Parker
    wrote on last edited by
    #1

    console.log formatting seems to not work.

    console.log("%s treated as a string", myvar)
    console.log("%i treated as an int", myvar)

    output:
    Debug, "%s treated as a string 4"
    Debug, "%i treated as a string 4"

    ndiasN 1 Reply Last reply
    0
    • D David Parker

      console.log formatting seems to not work.

      console.log("%s treated as a string", myvar)
      console.log("%i treated as an int", myvar)

      output:
      Debug, "%s treated as a string 4"
      Debug, "%i treated as a string 4"

      ndiasN Offline
      ndiasN Offline
      ndias
      wrote on last edited by
      #2

      Hi @David-Parker:

      As documented in Debugging QML Applications - Console API, you must use:

      console.log(myvar, "treated as a string")
      
      1 Reply Last reply
      0
      • D Offline
        D Offline
        David Parker
        wrote on last edited by
        #3

        OK thanks. The qt docs strongly imply that QML supports Javascript, but I guess it's a subset.

        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