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. Qt5 vs Qt6 assigning empty string variable QML
Qt 6.11 is out! See what's new in the release blog

Qt5 vs Qt6 assigning empty string variable QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    shokarta
    wrote on last edited by
    #1

    Hello all,

    I have just moved from Qt5 to Qt6, so I have ported QMAKE to CMAKE,
    made lots of adjustments in the c++ files as well as QML files to fulfill qt6 requirements...

    and I am stuck at the probably most basic stuff I could find :)

    in Qt5 i use:

    property string taskType: null
    

    which was fine, no error or warnings...

    but when i compile this in Qt6 I have the warning:

    Warning: qrc:/xxxx.qml:17:31: Invalid property assignment: string expected - Assigning null to incompatible properties in QML is deprecated. This will become a compile error in future versions of Qt.
    

    so, how do i change the string to null value?
    then how do i test if the variable is null?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2
      property string taskType: ""
      
      // Test:
      if (taskType.length === 0) {
        // something
      }

      (Z(:^

      1 Reply Last reply
      3

      • Login

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