Add custom hotkeys. (#2340)
Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com> Co-authored-by: Paweł <zneix@zneix.eu> Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -27,6 +27,7 @@ ResizingTextEdit::ResizingTextEdit()
|
||||
});
|
||||
|
||||
this->setFocusPolicy(Qt::ClickFocus);
|
||||
this->installEventFilter(this);
|
||||
}
|
||||
|
||||
QSize ResizingTextEdit::sizeHint() const
|
||||
@@ -95,6 +96,22 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
|
||||
return lastWord;
|
||||
}
|
||||
|
||||
bool ResizingTextEdit::eventFilter(QObject *, QEvent *event)
|
||||
{
|
||||
// makes QShortcuts work in the ResizingTextEdit
|
||||
if (event->type() != QEvent::ShortcutOverride)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto ev = static_cast<QKeyEvent *>(event);
|
||||
ev->ignore();
|
||||
if ((ev->key() == Qt::Key_C || ev->key() == Qt::Key_Insert) &&
|
||||
ev->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
Reference in New Issue
Block a user