Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qgraphicsscene selecteditems boundingrect returns -nan?



  • [CODE] QList<QGraphicsItem*> iList;

    iList = scene->selectedItems();
    QRectF bRect = scene->selectionArea().boundingRect();
    

    [/CODE]

    Hello: The above code returns
    h (qreal)
    w (qreal)
    x -nan(0xffffe1518ee2)
    y (qreal)

    Sometimes is the y coordinate that returns -nan and x is OK.

    Since I am new to QT perhaps this is to be expected, but the selectedItems() function seems a bit sketchy, skipping items that might be obscured. I have an important routine that relies on it and it doesn't seem to return all the items consistently. Has anyone an explanation or similar experiences?


Log in to reply