Qt World Summit: Submit your Presentation

hide() or load data on constructor in QDialog?

  • Hi !.

    I have a QMainWindow that has a QMenu , there is a QAction that opens a QDialog window, this QDialog window has a QTableWidget, it reads from a std::vector<MyObject>, where MyObject is an object that contains QString fields that will be loaded into the table...

    What is the most orthodox way to follow:

    1. show() QDialog ... load data table on constructor from std::vector use it then close(), this will delete the QDialog window pointer so each time i open this will need constructor to read data

    2. show QDialog ... load data table from std::vector then hide() (it will load data once, but will be kept on memory)

    3. any other way?


  • @U7Development
    Do you want to trade speed or space? How big is the data, how often do you show/hide dialog? Your choice!

  • That is a good point, i'm really not sure how much data is going my client manipulate... the only think i know is speed is more important... so i guess hide() makes more sense to me right now..

    The good point is i confirmed with your answer that both ways are fine.


Log in to reply