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
Forum Updated to NodeBB v4.3 + New Features

Qt5 vs Qt6 assigning empty string variable QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 825 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 25 Aug 2022, 09:37 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
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 25 Aug 2022, 11:19 last edited by
      #2
      property string taskType: ""
      
      // Test:
      if (taskType.length === 0) {
        // something
      }

      (Z(:^

      1 Reply Last reply
      3

      1/2

      25 Aug 2022, 09:37

      • Login

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