diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-07-05 19:43:17 +0200 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-07-05 19:43:17 +0200 |
commit | 7b04f55feb0d50e03d013b2be0ec555d363a40b2 (patch) | |
tree | 589da3860728c7328161810e8893d7dbe6e664a0 /src/basegui.cpp | |
parent | 42be0eb4f1d7a25dca97e8e2eb4ec4d03b7931fb (diff) |
Imported Upstream version 16.7.0~ds0
Diffstat (limited to 'src/basegui.cpp')
-rw-r--r-- | src/basegui.cpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/src/basegui.cpp b/src/basegui.cpp index 08d4c42..cc3a889 100644 --- a/src/basegui.cpp +++ b/src/basegui.cpp @@ -203,12 +203,7 @@ BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags ) #if STYLE_SWITCHING qApp->setStyleSheet(""); - - #if QT_VERSION >= 0x050000 - default_style = "fusion"; - #else default_style = qApp->style()->objectName(); - #endif #ifdef Q_OS_LINUX // Some controls aren't displayed correctly with the adwaita style @@ -5619,7 +5614,9 @@ void BaseGui::applyStyles() { qDebug() << "BaseGui::applyStyles: style:" << style; if (!style.isEmpty()) { qApp->setStyle(style); + #ifdef Q_OS_WIN qApp->setPalette(qApp->style()->standardPalette()); + #endif } #endif } @@ -5813,7 +5810,7 @@ void BaseGui::hideEvent( QHideEvent * ) { bool BaseGui::event(QEvent * e) { //qDebug("BaseGui::event: %d", e->type()); - bool result = QWidget::event(e); + bool result = QMainWindow::event(e); if ((ignore_show_hide_events) || (!pref->pause_when_hidden)) return result; if (e->type() == QEvent::WindowStateChange) { @@ -5943,7 +5940,7 @@ void BaseGui::showFindSubtitlesDialog() { qDebug("BaseGui::showFindSubtitlesDialog"); if (!find_subs_dialog) { - find_subs_dialog = new FindSubtitlesWindow(this, Qt::Window | Qt::WindowMinMaxButtonsHint); + find_subs_dialog = new FindSubtitlesWindow(0); find_subs_dialog->setSettings(Global::settings); find_subs_dialog->setWindowIcon(windowIcon()); #if DOWNLOAD_SUBS @@ -6036,6 +6033,38 @@ void BaseGui::changeEvent(QEvent *e) { } } +#ifdef NUMPAD_WORKAROUND +// Due to a bug in Qt 5 on linux, accelerators in numeric keypad don't work +// This catches the key presses in the numeric keypad and calls the associated action +void BaseGui::keyPressEvent(QKeyEvent *event) { + if (event->modifiers().testFlag(Qt::KeypadModifier)) { + qDebug() << "BaseGui::keyPressEvent: key:" << event->key() << "modifiers:" << event->modifiers(); + + QKeySequence ks(event->key()); + QList<QAction *> actions = this->actions(); + foreach(QAction * action, actions) { + QList<QKeySequence> shortcuts = action->shortcuts(); + foreach(QKeySequence s, shortcuts) { + bool match = (s == ks); + if (match) { + qDebug() << "BaseGui::keyPressEvent: action found:" << action->objectName() << "enabled:" << action->isEnabled(); + } + if (match && action->isEnabled()) { + if (action->isCheckable() && action->objectName() != "play_or_pause") { + action->toggle(); + } else { + action->trigger(); + } + return; + } + } + } + } + + QMainWindow::keyPressEvent(event); +} +#endif + #ifdef Q_OS_WIN #ifndef SM_CONVERTIBLESLATEMODE |