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

Designer Table Widget features limitations



  • Trying to use Qt Designer (in Creator). Have a number of tables to design with design-time fixed information and column widths.

    For one table I need multiple columns which each have different length text in them. Here is what does not seem doable at design-time:

    1. I cannot set individual column (or cell) widths via any properties (only overall column default/minimum, which does me no good).

    2. I cannot set "stretch columns to fit content".

    3. From the Edit Table Widget > Items tab I can drag column widths just like I want, which is great, but that does not "stick"/get saved to file, it's lost immediately on exiting that dialog.

    4. I could try forcing some newlines into text in cells. I can't actually type a newline, but I can type \n into it at design-time. This is supposed to work if I did it from code, but whatever reads the .ui (uic) treats it as a literal string not as a newline. (EDIT: OK, I have found I can achieve this one by setting as Rich Text. Unfortunately this was a by-the-by point, it's #1--3 I really want.)

    Are all of the above limitations of Qt Designer or of my ability to use it?



  • @JonB said in Designer Table Widget features limitations:

    I cannot set individual column (or cell) widths via any properties (only overall column default/minimum, which does me no good).

    Yes, true :)

    @JonB said in Designer Table Widget features limitations:

    I cannot set "stretch columns to fit content".

    This stretch - ResizeMode is a QHeaderView property. Some (bool stretchLastSection) are accessible in QtDesigner directly, but the stretch-to-content - mode or the ResizeMode-enum in general isn't.
    https://doc.qt.io/qt-5/qheaderview.html#ResizeMode-enum

    @JonB said in Designer Table Widget features limitations:

    From the Edit Table Widget > Items tab I can drag column widths just like I want, which is great, but that does not "stick"/get saved to file, it's lost immediately on exiting that dialog.

    This "feature" is just a preview. It does not change any of your QTableWidget properties

    @JonB said in Designer Table Widget features limitations:

    Are all of the above limitations of Qt Designer or of my ability to use it?

    All three can not be done with QtDesigner.



  • @Pl45m4
    LOL, thanks. So basically: "Yes/No, you can indeed not do any of the things you want at design-time", right? :)

    I'm new to Designer, having done everything in code before. It seems (compared to other UI designers I have used, e.g. Visual Studio) that it has a lot of design-time limitations if you expect what you design to be like what you will see....



  • @JonB said in Designer Table Widget features limitations:

    So basically: "Yes/No, you can indeed not do any of the things you want at design-time", right? :)

    Well... YES :-)

    @JonB said in Designer Table Widget features limitations:

    I'm new to Designer, having done everything in code before.

    IMO the QtDesigner is great to create a, more or less, simple GUI (at least the template for a more complex one - You start with Designer and continue with code afterwards). Further specifictions you have to do in your code.

    Why you want to do all this things with QtDesigner, if you can (need to) code them anyway?



  • @Pl45m4 said in Designer Table Widget features limitations:

    Why you want to do all this things with QtDesigner, if you can (need) to code them anyway?

    I meant, I have coded everything dynamically in the past, no Designer. Not on this project. I did not say that hand-coding UI layouts was quick/productive/satisfying! :) Trying to guess what something will look like, and especially moving things around and trying to get the desired layout etc. from code, is a frustrating experience. So it's time to use Qt Designer for me!

    In this particular case, I have quite a number of printed tables with content which must be put into app, and visually approximate the printed layout. In general doing it via Designer is proving better/faster than hand-coding. Except when I get to the bits I know I could do so easily in code but I'd like to be able to do & see at design-time, but Designer is not offering the facilities as per my question. Then I get frustrated again :)

    Yes, I am now combing some design-time layout with some support run-time coding as I go, but it's a shame when I don't get the visual effect at design-time.



  • @JonB said in Designer Table Widget features limitations:

    I meant, I have coded everything dynamically in the past, no Designer

    I know that you can, that's why I asked.

    @JonB said in Designer Table Widget features limitations:

    In general doing it via Designer is proving better/faster than hand-coding

    That's exactly the thing. The Designer saves at lot of time, when creating GUIs, but it's not meant to replace most of the coding work. We have to accept, that most Qt widget things can't be done in QtDesigner. This is where you close the window and go back to your code :-)


Log in to reply