开发者

Track window/control resize in PyQt?

开发者 https://www.devze.com 2023-01-01 17:30 出处:网络
I have a window with 2 QTableWidgets, having their scrolling synchronized. The 1st one usually has horizontal scroll, while the 2nd usually (automatically) not.

I have a window with 2 QTableWidgets, having their scrolling synchronized. The 1st one usually has horizontal scroll, while the 2nd usually (automatically) not. In order for them 开发者_C百科to show consistent data (row against row) I make the 2nd have the scroll (through property HorizontalScrollBar -> AlwaysOn).

But sometimes the 1st table doesn't have the scroll. What's event worse, it may have it or not depending on the window size (when making window wider the scroll disappears). As far as I see there's no signal for resize of window or control (widget).

I can, of course, use some constantly running timer to check if 1st table has scroll, but I wounder if there's more pure solution.

Thanks!


The answer was to reimplement the resizeEvent and check table.horizontalScrollBar().isVisible()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号