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,9 +557,8 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
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_PageDown:
if(obj == ui->lineEdit)
{
QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt));
if (obj == ui->lineEdit) {
QApplication::sendEvent(ui->messagesWidget, keyevt);
return true;
}
break;
@ -567,7 +566,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
case Qt::Key_Enter:
// forward these events to lineEdit
if (obj == autoCompleter->popup()) {
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
QApplication::sendEvent(ui->lineEdit, keyevt);
autoCompleter->popup()->hide();
return true;
}
@ -581,7 +580,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
{
ui->lineEdit->setFocus();
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
QApplication::sendEvent(ui->lineEdit, keyevt);
return true;
}
}