[PyQt] Learning Qt5 designer

Rich Shepard rshepard at appl-ecosys.com
Tue Jan 10 22:48:16 GMT 2017


On Tue, 10 Jan 2017, Rich Shepard wrote:

> I think my other problems with adding horizontal spacers and layouts can
> be fixed now that I understand the form layout compared with others.

   I wrote too quickly. I've read the layout manager page
<http://doc.qt.io/qt-5/layout.html#layout-examples> and looked at the
examples. The code makes sense but I'm trying to learn to use the designer
so I can more quickly create the UI than by writing it all by hand.

   A dialog is created with 10 line edit widgets and their labels (code
attached). When I try to add horizontal spacers designer tells me that the
file will not be saved because I don't have a layout on the dialog.

   Adding a grid layout, then trying to place a horizontal spacer between the
left two cells and the right two cells it displays across the entire grid
box (because that is displayed in grey when I move the spacer to the dialog
and I cannot place it where I want) and does not shrink. I know this should
be obvious but I'm not seeing how to use designer to add layouts and spacers
(and how to name text line entry widgets so they can be referenced in
methods).

   So, my first question is: What is the order of adding layouts (such as the
grid) and spacers?

Rich



More information about the PyQt mailing list