Skip to content

Commit

Permalink
Fixed the fullscreen keyboard shortcut
Browse files Browse the repository at this point in the history
`Qt::Key_F11` and `QKeySequence::FullScreen` are of different enum types
(`Qt::Key` and `QKeySequence::StandardKey`, respectively) with
overlapping value ranges. Using a standard integral type (int, unsigned,
long, etc) as a common type for them results in the type information
being lost and an ensuing impossibility to take advantage of overloaded
constructors of `QKeySequence`. The simple fix is to use `QKeySequence`
as the common type of the conditional expression.
  • Loading branch information
veloman-yunkan authored and kelson42 committed Apr 12, 2024
1 parent b3b09c4 commit 1ccfcad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kiwixapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ void KiwixApp::createActions()
this, [=]() { getTabWidget()->openFindInPageBar(); });

const auto fullScreenKeySeq = QKeySequence(QKeySequence::FullScreen).isEmpty()
? (int) Qt::Key_F11
: (int) QKeySequence::FullScreen;
? QKeySequence(Qt::Key_F11)
: QKeySequence(QKeySequence::FullScreen);
CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), fullScreenKeySeq);
connect(mpa_actions[ToggleFullscreenAction], &QAction::toggled,
this, [=](bool checked) {
Expand Down

0 comments on commit 1ccfcad

Please sign in to comment.