Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 6.9.0 GraphicScene scrollbars give wrong value ( nan or inf )
Forum Updated to NodeBB v4.3 + New Features

Qt 6.9.0 GraphicScene scrollbars give wrong value ( nan or inf )

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 239 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.
  • Z Offline
    Z Offline
    zenon
    wrote on last edited by zenon
    #1

    Hello,

    The problem occurs with Qt 6.9.0 on Mac Intel and silicon but not with Linux.

    I joined a QGraphicsView with a QGraphicsScene . I initialize
    g_scene..setSceneRect( 0,0,0,0 );
    and then plot a lot of points ( in ex 300 ) :

    QGraphicsTextItem * pt
    pt->setPos( x, y )
    gscene.addItem( pt );

    If many plots in a normal range are inserted the scrollbars is stucked because the coord of de scene give qreal that are inf nan.

    to test I do this :

    QRectF R = g_scene.sceneRect();
    and I obseved that the values in R were not a number or infinite. No real values.

    It happens when many graphiics are inserted . And these wrong real values do not appear with Qt 6.8.0 on Mac and do not appear with Qt 6.9.0 on Linux

    When a certain amount of items are inserted the coordinates of the graphic turns to give wrong real values lile not a number or infinite.

    I suspect a bug.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2
      g_scene..setSceneRect( 0,0,0,0 ); 
      

      (preserved your typo)

      You have told the scene that it has zero width and height (and set the view's default scrolling area also). I do not find it surprising that the view has issues scrolling a zero-size area .

      Perhaps you meant to set a null QRectF: g_scene.setSceneRect(QRectF());

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zenon
        wrote on last edited by zenon
        #3

        No it's not a problem setting to zero gives extended size . That does not make any change as I've just tested. The wrong real values appears affter inserting smalll text items.

        If i posted it's because this misbehaviour appears only with Qt 6.9.0 on Mac not on Linux . I did not test on Windiows. Qt 6.8.0 was right on Mac.

        I discovered the bug with

        int is_nan(  qreal  a )
        {
          return ( boost::math::isinf(a) ||  boost::math::isnan(a) ) ; 
        }
        

        Some more updated information if I compile a debug version the bug does not appear but with some optimization

        1. QMAKE_CXXFLAGS += -std=c++17 -O3 -ffast-math -flto -funroll-loops -march=native -DNDEBUG

        goes wrong

        1. QMAKE_CXXFLAGS += -std=c++17 -Og

        goes well

        Regards

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          zenon
          wrote on last edited by zenon
          #4

          last minute . I found the right way.
          In fact it is the -ffast-math compiler option which beheave differently on Mac and Linux with Qt 6.9.0

          Qt 6.9.0 does not support any more very fast compiler optiion
          on Mac Mx

          CFLAGS        = -pipe -Ofast    $(EXPORT_ARCH_ARGS) -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=15.0 -Wall -Wextra $(DEFINES)
          CXXFLAGS      = -pipe -stdlib=libc++ -std=c++17 -Ofast -funroll-loops -flto -march=native -DNDEBUG -Ofast -std=gnu++1z $(EXPORT_ARCH_ARGS) -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=15.0 -Wall -Wextra $(DEFINES)
          

          Fast optimisation does not work any more on 6.9.0. Is it Qt or Apple difficult to say.

          Thank you anyway .

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zenon
            wrote on last edited by
            #5

            Well in fact the problem came from --ffast-math in -03 or Ofast

            But I do not understand why on Mac Qt 6.9.0 is so sensitive to fast floating point compilation options when it is not with Qt 6.8.0 ?

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zenon
              wrote on last edited by
              #6

              IT'S SOLVED

              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