Skip to content
  • 0 Votes
    12 Posts
    2k Views
    T

    @Christian-Ehrlicher said in How avoid memory leak with GUI programming:

    @TheEnigmist said in How avoid memory leak with GUI programming:

    VS points to p = p.scaled line that add every time 10k byte of data (50x50x4 bytes), and each time I create and detroy the widget where that QAbstractTableModel is I see in memory that all that Pixmap are never destroyed.

    There is no leak and can't be one - you should take a look into QPixmapCache and for the sake of performance and implicit sharing don't load the pixmap in your data() method every time.

    Yeah I just found out that I was really wrong with that :( I will fix it right now!
    So I can go over when see pixmap in my allocated memory due to QPixmapCache. Ofc is always better to improve my code and don't load so many times a pixmap!

    @Chris-Kawa said in How avoid memory leak with GUI programming:

    @TheEnigmist said in How avoid memory leak with GUI programming:

    So if I'm not wrong what is cached is not the file on disk, but its scaled version

    No. How would Qt know that it's the same pixmap? What's cached is the pixmap that you create from a file, and the path (with some additional info) becomes a key to look it up in the cache.

    I see, but why the debugger points me to the scaled() function when looking for the allocated memory istance?

  • 0 Votes
    3 Posts
    397 Views
    A

    @dynobo Starting a reply with " I am in same boat" is a cliche and it does not help (you) .
    I have half a dozen "objects" passing messages - both directions and using "emit" and "connect".

    I am using GUI / tab to keep track and of course QDebug.
    It is not ideal ....

    I was going to add old fashioned flowchart ( text or GUI ) , but got sidetracked....

  • 0 Votes
    2 Posts
    419 Views
    fcarneyF

    We just create models and use context properties. Or have the QML code request the model from another object via function or property. We generally have an application object that manages the lifetime of the smaller objects.

  • 0 Votes
    1 Posts
    149 Views
    No one has replied
  • 0 Votes
    3 Posts
    643 Views
    jeanmilostJ

    @sierdzio thank you for sharing your experience.

    An important point for our development team is to allow the designers to write a part of the qml code, at least to basically create the interface as they want, or to be able to modify a part of the interface during the development cycle without having to resort to developers. I must clarify that they have the skills to achieve that.

    We also have the possibility to reload any modified qml file on runtime from inside our apps, so the modifications may be shown directly into the running application.

    So, what I'm searching for is a framework or IDE which would allow to write qml code in the most possible independent way. Until now the closest tools I found were Qt Creator and Qt Design Studio, but Qt Creator is problematic when the qml code links to custom c++ widgets or references (especially when the code is created with Visual Studio), whereas Qt Design Studio allows to create a pure qml interface, but needs to be converted before using it in a real c++ project.

    2 questions interest me:

    Are there any other tools than the 2 mentioned above to generate qml content? How other development teams manage the change cycles between the design teams and the programming teams?
  • 0 Votes
    4 Posts
    871 Views
    mrjjM

    @Victor-M
    Ah, fair enough. performance testing is always wise.
    Did you read about
    http://doc.qt.io/qt-5/qgraphicsitem.html#CacheMode-enum ?
    Depending on the complexity of the paint function of the objects, this might
    be useful. (AFAIK)
    have you tested with
    http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html
    and and few very happy copy & paste moments to get a fair amount ? (just a thought, its a similar usecase-ish)

  • 0 Votes
    6 Posts
    3k Views
    NorthsoftN

    @kshegunov thanks a lot!

  • 0 Votes
    8 Posts
    3k Views
    A

    Thanks again for the input!

    I think I got now a rough understanding of the structure / logic.

    I'll try to load the contents dynamically and show them using eigther Stackview / Loader or some own implementation.

    That really helped me a lot! :-)