Pregunta

Actually, how can I extract size of gui elements in general in PyQt?

So far I have only found sizeHint mentioning anything regarding sizes in PyQt.

Could anyone please explain how sizes works in PyQt?

¿Fue útil?

Solución

In general, it's not possible to guarantee the exact sizes of widgets, because there are so many different factors that come in to play. Widgets will rendered differently depending on the window manager in use, the current GUI style, the fonts, etc - and each platform has it's own peculiarities.

To get a better understanding of all this, I would suggest you take a look at Qt's own overviews of window geometry, widgets and layouts and layout management.

To answer the specific question on the height of QListWidgetItems: they will have whatever height is calculated by the QListWidget when it lays out its items. This may take into account the items' sizeHint, which can be set programmatically with QListWidgetItem.setSizeHint.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top