Merge bitcoin-core/gui#580: Getting ready to Qt 6 (3/n). Do not use QKeyEvent copy constructor

3ec6504a2e5b4afb7a2719a82191e0b96fe23214 qt: Do not use `QKeyEvent` copy constructor (Hennadii Stepanov)

Pull request description:

  This PR is preparation for [Qt 6](https://github.com/bitcoin/bitcoin/pull/24798), and it fixes an experimental build with Qt 6.2.4 as copying of `QEvent` has been [disabled](19f9b0d5f5) in Qt 6.0.0.

ACKs for top commit:
  w0xlt:
    tACK 3ec6504a2e on Ubuntu 21.10, Qt 5.15.2
  shaavan:
    reACK 3ec6504a2e5b4afb7a2719a82191e0b96fe23214

Tree-SHA512: 583a9dad0c621d9f02f77ccaa9f55ee79e12e3c47f418911ef2dfe0de357d772d1928ae3ec19b6f0c0674da858bab9d4542a26cc14b06ed921370dfeabd1c194
This commit is contained in:
Hennadii Stepanov 2022-04-19 19:31:11 +02:00 committed by pasta
parent 50287e2403
commit 6a21035941
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -557,17 +557,16 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break; case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break;
case Qt::Key_PageUp: /* pass paging keys to messages widget */ case Qt::Key_PageUp: /* pass paging keys to messages widget */
case Qt::Key_PageDown: case Qt::Key_PageDown:
if(obj == ui->lineEdit) if (obj == ui->lineEdit) {
{ QApplication::sendEvent(ui->messagesWidget, keyevt);
QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt));
return true; return true;
} }
break; break;
case Qt::Key_Return: case Qt::Key_Return:
case Qt::Key_Enter: case Qt::Key_Enter:
// forward these events to lineEdit // forward these events to lineEdit
if(obj == autoCompleter->popup()) { if (obj == autoCompleter->popup()) {
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); QApplication::sendEvent(ui->lineEdit, keyevt);
autoCompleter->popup()->hide(); autoCompleter->popup()->hide();
return true; return true;
} }
@ -581,7 +580,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
((mod & Qt::ShiftModifier) && key == Qt::Key_Insert))) ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
{ {
ui->lineEdit->setFocus(); ui->lineEdit->setFocus();
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); QApplication::sendEvent(ui->lineEdit, keyevt);
return true; return true;
} }
} }