Please nominate your Qt Champions for 2021!

Qt Creator - working with promoted widgets in .ui file

  • My .ui file includes several "regular" widgets (like a QPlainTextEdit and QTableView) and several layouts, but there is an issue - one of my widgets is a promoted QWidget. It has child widgets inside it, but they are only created during runtime, and are initialized in code. So when the application runs, everything is fine.

    But when I'm working in the editor, this screws up the whole view. My promoted QWidget is displayed as a horizontal line. So when I want to place a new grid layout just above it, I'm really doing some serious pixel hunting. (The grid view would also end up a horizontal line but that's a separate problem.

    Is there are tip/trick to overcome this limitation of the designer? Any common practice that could help?

  • You can try to set a minimum or maximum size on your promoted widget to help and then remove those size constraints when you save the ui file.

  • Ah that's a relief!

    Do you have a similar solution for empty grid layouts that are populated during runtime?

Log in to reply