QT程序響應系統激活和失去焦點

//在主窗口的事件中處理WindowDeactivate事件
bool Widget::event(QEvent *event)
{
    if(QEvent::WindowDeactivate == event->type()) {
        _wndRecord->hide(); //這裏就是啦!
    }
    return QWidget::event(event);
}ide

這裏必定要主窗口才能夠,由於子窗口是不會處理來自系統的通知消息!事件

相關文章
相關標籤/搜索