1. 使用qt + cef3 開發的 pc 桌面程式出現一個奇怪的問題,描述如下:
1. 程式最小化之後,再最大化,所有Qt 按鈕的hover狀态都失效。
2. hover 失效後的程式,showNormal 之後再 showMax。 hover狀态又恢複正常。
3. 将cef 加載的連結屏蔽掉,隻保留C++架構,所有Qt 按鈕的hover狀态正常。
2. 解決方法:
在mainwindow 的 showEvent()函數裡面設定Qt::WA_Mapped屬性:
void showEvent(QShowEvent *event) { setAttribute(Qt::WA_Mapped); QWidget::showEvent(event); }