質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top