Add keyboard shorcuts to focus and unfocus chat (#3898)

* Added keyboard shorcuts to focus and unfocus chat

* Fixed format

* Changed the Esc behavior to work on any QLineEdit in the main Window and ignore shortcut conflicts

* Fixed a conflict with shortcuts

* Configurable unfocus shortcut and format fixes

* minor style fix
This commit is contained in:
Xenos6666 2020-03-17 02:48:05 +01:00 committed by GitHub
parent 7285f24a29
commit 63b4f9b2f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 235 additions and 107 deletions

View file

@ -1,4 +1,5 @@
#include "tab_deck_editor.h"
#include "abstractclient.h"
#include "carddatabasemodel.h"
#include "cardframe.h"
@ -16,6 +17,7 @@
#include "settingscache.h"
#include "tab_supervisor.h"
#include "tappedout_interface.h"
#include <QAction>
#include <QApplication>
#include <QClipboard>
@ -28,6 +30,7 @@
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
@ -50,7 +53,7 @@ void SearchLineEdit::keyPressEvent(QKeyEvent *event)
{
if (treeView && ((event->key() == Qt::Key_Up) || (event->key() == Qt::Key_Down)))
QCoreApplication::sendEvent(treeView, event);
QLineEdit::keyPressEvent(event);
LineEditUnfocusable::keyPressEvent(event);
}
void TabDeckEditor::createDeckDock()
@ -79,7 +82,7 @@ void TabDeckEditor::createDeckDock()
nameLabel = new QLabel();
nameLabel->setObjectName("nameLabel");
nameEdit = new QLineEdit;
nameEdit = new LineEditUnfocusable;
nameEdit->setObjectName("nameEdit");
nameLabel->setBuddy(nameEdit);
connect(nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateName(const QString &)));
@ -121,7 +124,7 @@ void TabDeckEditor::createDeckDock()
auto *hashSizePolicy = new QSizePolicy();
hashSizePolicy->setHorizontalPolicy(QSizePolicy::Fixed);
hashLabel1->setSizePolicy(*hashSizePolicy);
hashLabel = new QLineEdit;
hashLabel = new LineEditUnfocusable;
hashLabel->setObjectName("hashLabel");
hashLabel->setReadOnly(true);
hashLabel->setFrame(false);