开发者

focusNextChild problems in PyQt

开发者 https://www.devze.com 2022-12-10 01:10 出处:网络
I\'m trying to set the focus from one widget to the next one using the focusNextChild() method. It works, but I there seems to be a slight difference between using the tab-key or doing things in code.

I'm trying to set the focus from one widget to the next one using the focusNextChild() method. It works, but I there seems to be a slight difference between using the tab-key or doing things in code. If the next control is a button, using the tab-key results in a focused button with its caption surrounded with little dots, so you see immediately which control has the f开发者_如何学编程ocus. Using code no dots are visible. How can I force the dots to appear?


This problem (that the focus rectangle is not drawn except when using explicit keyboard focussing; e.g. using the tab-key) could be a result of how the chosen theme (and window manager?) chooses to render the given element.

Some themes may choose to draw focus rectangles around 'any' element which receives focus, while others will only draw focus rectangles when explicitely using 'keyboard' navigation.

In short: this is probably a theme-specific issue.

0

精彩评论

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