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

Looking for advice for use of Layouts in QGraphicsViews



  • Hi. I'm writing a software making intensive use of the QGraphicsView framework (using PySide2). Overall, I really like it. There is just one thing that's constantly keeping me from making progress, and I'm running out of ideas, so if anyone has experience with QGraphicsViews, I'd really appreciate some more experienced advice.

    Over the past months, I have encountered many different bugs and problems where those QGraphicsLayouts behave significantly different than normal QLayouts would and produce the ugliest code for fixing those, to me, often very unreasonable effects.

    (Example: the layouts don't properly scale according to size policies when content is changed, added or removed. I spent many days trying to get them to automatically adjust and the fix that's kinda working right now is by far the worst and most unscalable part of the whole software. Another thing would be the stretch system and the way stretches are treated when accessing a layout's content which complicates everything)

    I am using them for organizing QGraphicsWidgets and QWidgets in layouts for the scene. I want to point out though, I'm not a software developer and those issues might be due to a lack of knowledge, maybe I'm just too dumb for the documentation, I don't know.

    Question: Did someone here encounter similar issues and are there clean alternatives to using QGraphicsLayouts for accomplishing the same thing?

    Help is much appreciated.


  • Lifetime Qt Champion

    Hi,

    Can you provide a minimal runnable script that shows the issue ?
    That would allow for better discutions around what is happening and find if there is an issue in Qt or within your code.



  • @SGaist Thanks, but that wasn't really the question.
    I'm asking about alternatives. Maybe there is a way to use normal QLayouts to arrange QGraphicsWidgets, or something like that?


  • Lifetime Qt Champion

    The issue is, if one can run the script and have under his eyes the issues you are writing about, it will allow to talk about alternatives you are asking about or maybe bug fixing.


Log in to reply