Changeset 5649086 in subsurface


Ignore:
Timestamp:
Jan 28, 2015, 2:30:19 PM (3 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.4-branch, v4.5-branch
Children:
5f01321
Parents:
eaec0bc
git-author:
Tomaz Canabrava <tomaz.canabrava@…> (01/28/15 12:06:27)
git-committer:
Dirk Hohndel <dirk@…> (01/28/15 14:30:19)
Message:

Make search and close shortcut for user manual work on Mac

When the help dialog appears, remove the shortcuts for filter and close from
the main window so that the identical keys for the help window work. This is
not necessary on other platforms, but on Mac it appears to be required.

[Dirk Hohndel: Tomaz had a slightly different approach of removing the actions,

instead I changed this to just modify the shortcuts]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Location:
qt-ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qt-ui/usermanual.cpp

    r9e5c6a6 r5649086  
    44
    55#include "usermanual.h"
    6 
     6#include "mainwindow.h"
    77#include "helpers.h"
    88
     
    123123        QDesktopServices::openUrl(url);
    124124}
     125
     126#ifdef Q_OS_MAC
     127void UserManual::showEvent(QShowEvent *e) {
     128        filterAction = NULL;
     129        closeAction = NULL;
     130        MainWindow *m = MainWindow::instance();
     131        Q_FOREACH (QObject *o, m->children()) {
     132                if (o->objectName() == "actionFilterTags") {
     133                        filterAction = qobject_cast<QAction*>(o);
     134                        filterAction->setShortcut(QKeySequence());
     135                } else if (o->objectName() == "actionClose") {
     136                        closeAction  = qobject_cast<QAction*>(o);
     137                        closeAction->setShortcut(QKeySequence());
     138                }
     139        }
     140}
     141void UserManual::hideEvent(QHideEvent *e) {
     142        if (closeAction != NULL)
     143                closeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
     144        if (filterAction != NULL)
     145                filterAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
     146        closeAction = filterAction = NULL;
     147}
     148#endif
  • qt-ui/usermanual.h

    rbd993a41 r5649086  
    2727public:
    2828        explicit UserManual(QWidget *parent = 0);
     29
     30#ifdef Q_OS_MAC
     31protected:
     32        void showEvent(QShowEvent *e);
     33        void hideEvent(QHideEvent *e);
     34        QAction *closeAction;
     35        QAction *filterAction;
     36#endif
     37
    2938private
    3039slots:
Note: See TracChangeset for help on using the changeset viewer.