mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix actions not triggering reliably + ctrl+insert shortcut on linux
This commit is contained in:
parent
887f021323
commit
719481b040
|
@ -25,6 +25,7 @@
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T clamp(T x, T min, T max)
|
T clamp(T x, T min, T max)
|
||||||
|
@ -65,15 +66,21 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
copyAction->setText(tr("Copy"));
|
copyAction->setText(tr("Copy"));
|
||||||
copyAction->setShortcut(QKeySequence::Copy);
|
copyAction->setShortcut(QKeySequence::Copy);
|
||||||
copyAction->setEnabled(false);
|
copyAction->setEnabled(false);
|
||||||
connect(copyAction, &QAction::triggered, this, [this](bool) { copySelectedText(); });
|
connect(copyAction, &QAction::triggered, this, [this]() { copySelectedText(); });
|
||||||
addAction(copyAction);
|
addAction(copyAction);
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
// Ctrl+Insert shortcut
|
||||||
|
QShortcut* copyCtrlInsShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Insert), this);
|
||||||
|
connect(copyCtrlInsShortcut, &QShortcut::activated, this, [this]() { copySelectedText(); });
|
||||||
|
#endif
|
||||||
|
|
||||||
// select all action (ie. Ctrl+A)
|
// select all action (ie. Ctrl+A)
|
||||||
QAction* selectAllAction = new QAction(this);
|
QAction* selectAllAction = new QAction(this);
|
||||||
selectAllAction->setIcon(QIcon::fromTheme("edit-select-all"));
|
selectAllAction->setIcon(QIcon::fromTheme("edit-select-all"));
|
||||||
selectAllAction->setText(tr("Select all"));
|
selectAllAction->setText(tr("Select all"));
|
||||||
selectAllAction->setShortcut(QKeySequence::SelectAll);
|
selectAllAction->setShortcut(QKeySequence::SelectAll);
|
||||||
connect(selectAllAction, &QAction::triggered, this, [this](bool) { selectAll(); });
|
connect(selectAllAction, &QAction::triggered, this, [this]() { selectAll(); });
|
||||||
addAction(selectAllAction);
|
addAction(selectAllAction);
|
||||||
|
|
||||||
// This timer is used to scroll the view while the user is
|
// This timer is used to scroll the view while the user is
|
||||||
|
|
Loading…
Reference in New Issue
Block a user