• 2496阅读
  • 1回复

[提问]添加installEventFilter后,为什么用QSS写的button按下,不按下,激活时候的背景图片不变化了 [复制链接]

上一主题 下一主题
离线foxgod
 

只看楼主 倒序阅读 楼主  发表于: 2013-03-22
在父窗口添加installEventFilter后,为什么用QSS写的在父窗口上的button-按下,不按下,激活时候的背景图片不变化了。


在问下,我在子窗口写的buttonslot,怎么能让他在父窗口做slot,而不是在子窗口做slot。
离线foxgod

只看该作者 1楼 发表于: 2013-03-25
经过QT网站研发人员告诉我,是我没有写返回值。下面是量为研发人员给的解决方法,

Don’t omit return value. This is undefined behavior and it’s a shame that some compilers allow you to compile that.
Explicitly return false at the end of your eventFilter.
Also, as SGaist said, you are eating the event by returning true. You should probably return false to let Qt handle it properly or call the base implementation yourself.

Hi and welcome to DevNet,
Could you show the code of your event filter ? You most likely eat all events in there so the button probably misses QEvent::StyleChange
Hope it helps
快速回复
限100 字节
 
上一个 下一个