mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
eaec0bc842
commit
5649086d61
2 changed files with 34 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
|||
#include <QFile>
|
||||
|
||||
#include "usermanual.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "helpers.h"
|
||||
|
||||
SearchBar::SearchBar(QWidget *parent): QWidget(parent)
|
||||
|
@ -122,3 +122,27 @@ void UserManual::linkClickedSlot(const QUrl& url)
|
|||
{
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void UserManual::showEvent(QShowEvent *e) {
|
||||
filterAction = NULL;
|
||||
closeAction = NULL;
|
||||
MainWindow *m = MainWindow::instance();
|
||||
Q_FOREACH (QObject *o, m->children()) {
|
||||
if (o->objectName() == "actionFilterTags") {
|
||||
filterAction = qobject_cast<QAction*>(o);
|
||||
filterAction->setShortcut(QKeySequence());
|
||||
} else if (o->objectName() == "actionClose") {
|
||||
closeAction = qobject_cast<QAction*>(o);
|
||||
closeAction->setShortcut(QKeySequence());
|
||||
}
|
||||
}
|
||||
}
|
||||
void UserManual::hideEvent(QHideEvent *e) {
|
||||
if (closeAction != NULL)
|
||||
closeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
|
||||
if (filterAction != NULL)
|
||||
filterAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
|
||||
closeAction = filterAction = NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,15 @@ class UserManual : public QWidget {
|
|||
|
||||
public:
|
||||
explicit UserManual(QWidget *parent = 0);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
protected:
|
||||
void showEvent(QShowEvent *e);
|
||||
void hideEvent(QHideEvent *e);
|
||||
QAction *closeAction;
|
||||
QAction *filterAction;
|
||||
#endif
|
||||
|
||||
private
|
||||
slots:
|
||||
void searchTextChanged(const QString& s);
|
||||
|
|
Loading…
Add table
Reference in a new issue