Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. There has a the difference about QTransform between qt5 and qt6, How can I do?
Forum Updated to NodeBB v4.3 + New Features

There has a the difference about QTransform between qt5 and qt6, How can I do?

Scheduled Pinned Locked Moved Unsolved Qt 6
6 Posts 5 Posters 172 Views 2 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.
  • H Offline
    H Offline
    hidxl
    wrote 22 days ago last edited by hidxl 5 Aug 2025, 02:39
    #1

    I created a scene (QGraphicsScene) with a range of (-360,-360,720,720), then created an item on the scene that represents a layer, and then created an item whose parent is a layeritem.
    Finally, through debugging, it is found that the device matrix of item is QTransform(0.0, 9.2370219841123224e-07, 0.0,
    -9.2370219841123224e-07, 0.0, 0.0,
    117.01799774169922, -36.503170013427734, 1.0)

    In this QTransform, QT5 can click on the item normally, but not under QT6.

    QT5 is considered this QTransform invertible, but QT6 is NOT .
    the return value of "ok" QT5 is TRURE but QT6 is FALSE
    Here's the test code:

    auto powertransform =  QTransform(0.0, 9.2370219841123224e-07, 0.0,
    -9.2370219841123224e-07, 0.0, 0.0,
    117.01799774169922, -36.503170013427734, 1.0);
    bool ok(false);
    auto newtr= powertransform.inverted(&ok);
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote 21 days ago last edited by
      #2

      Hi and welcome to devnet,

      Which version of Qt are you using ?
      Can you provide a minimal compilable example just to be sure that everybody can reproduce the failure the same way as you ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote 21 days ago last edited by Christian Ehrlicher 5 Aug 2025, 19:03
        #3

        Nothing changed in between here - a QTransform can be inverted when the determinant is not 0 Your determinant is near zero (8.53226e-13) but not completely. Maybe you used float in Qt5 so it is 0 or a special compiler flags which uses precise math or whatever.

        /edit: changed from 'is 0' to 'is not 0'

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        J 1 Reply Last reply 21 days ago
        0
        • C Christian Ehrlicher
          21 days ago

          Nothing changed in between here - a QTransform can be inverted when the determinant is not 0 Your determinant is near zero (8.53226e-13) but not completely. Maybe you used float in Qt5 so it is 0 or a special compiler flags which uses precise math or whatever.

          /edit: changed from 'is 0' to 'is not 0'

          J Offline
          J Offline
          JohanSolo
          wrote 21 days ago last edited by
          #4

          @Christian-Ehrlicher said in There has a the difference about QTransform between qt5 and qt6, How can I do?:

          a QTransform can be inverted when the determinant is 0 Your determinant is near zero (8.53226e-13) but not completely. Maybe you used float in Qt5 so it is 0 or a special compiler flags which uses precise math or whatever.

          Pardon me to add my two cents, but a transformation can be inverted if and only if its determinant is different from zero, otherwise it is called a singular matrix and cannot be inverted.

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          J C 2 Replies Last reply 21 days ago
          1
          • J JohanSolo
            21 days ago

            @Christian-Ehrlicher said in There has a the difference about QTransform between qt5 and qt6, How can I do?:

            a QTransform can be inverted when the determinant is 0 Your determinant is near zero (8.53226e-13) but not completely. Maybe you used float in Qt5 so it is 0 or a special compiler flags which uses precise math or whatever.

            Pardon me to add my two cents, but a transformation can be inverted if and only if its determinant is different from zero, otherwise it is called a singular matrix and cannot be inverted.

            J Offline
            J Offline
            JonB
            wrote 21 days ago last edited by
            #5

            @JohanSolo
            I think you should provide the following information:

            • What version of Qt5 which behaves "well" do you use?
            • What version of Qt6 which performs "badly" do you use?
            • What platform are you on?
            • What compiler do you use?
            • What exact flags are passed to compiler in both cases?
            • Can you provide a complete program in a few lines of code which illustrates your issue?
            1 Reply Last reply
            0
            • J JohanSolo
              21 days ago

              @Christian-Ehrlicher said in There has a the difference about QTransform between qt5 and qt6, How can I do?:

              a QTransform can be inverted when the determinant is 0 Your determinant is near zero (8.53226e-13) but not completely. Maybe you used float in Qt5 so it is 0 or a special compiler flags which uses precise math or whatever.

              Pardon me to add my two cents, but a transformation can be inverted if and only if its determinant is different from zero, otherwise it is called a singular matrix and cannot be inverted.

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote 21 days ago last edited by
              #6

              @JohanSolo said in There has a the difference about QTransform between qt5 and qt6, How can I do?:

              if and only if its determinant is different from zero,

              Yeah, forgot the not, thx & fixed

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1

              1/6

              8 May 2025, 02:37

              • Login

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