bool EventFilteringMainWindow::event(QEvent *event)
{
    if (event->type() == m_deviceEventId) {
        event->accept();
        emit deviceChange();
        return true;
    }
    return QMainWindow::event(event);
}
Beispiel #2
0
bool AppMainWindow::event(QEvent *event)
{
    const QEvent::Type type = event->type();
    if (type == m_deviceEventId) {
        event->accept();
        emit deviceChange();
        return true;
    }
    if (type == QEvent::ThemeChange)
        setThemeApplicationPalette();
    return QMainWindow::event(event);
}
Beispiel #3
0
bool Notifier::nativeEvent(const QByteArray& eventType, void* msg, long* result)
{
    Q_UNUSED( eventType );
    MSG* message = reinterpret_cast<MSG*>(msg);
#else
bool Notifier::winEvent(MSG *message, long *result)
{
#endif
Q_UNUSED( result );
if(message->message == WM_DEVICECHANGE)
{
    switch(message->wParam)
    {
    case DBT_DEVICEARRIVAL:
        emit deviceChange(true);
        break;

    case DBT_DEVICEREMOVECOMPLETE:
        emit deviceChange(false);
        break;
    }
}
return false;
}