Skip to content

Commit 37e49cc

Browse files
committed
Merge #580: Getting ready to Qt 6 (3/n). Do not use QKeyEvent copy constructor
3ec6504 qt: Do not use `QKeyEvent` copy constructor (Hennadii Stepanov) Pull request description: This PR is preparation for [Qt 6](bitcoin/bitcoin#24798), and it fixes an experimental build with Qt 6.2.4 as copying of `QEvent` has been [disabled](qt/qtbase@19f9b0d) in Qt 6.0.0. ACKs for top commit: w0xlt: tACK 3ec6504 on Ubuntu 21.10, Qt 5.15.2 shaavan: reACK 3ec6504 Tree-SHA512: 583a9dad0c621d9f02f77ccaa9f55ee79e12e3c47f418911ef2dfe0de357d772d1928ae3ec19b6f0c0674da858bab9d4542a26cc14b06ed921370dfeabd1c194
2 parents 8103fff + 3ec6504 commit 37e49cc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/qt/rpcconsole.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -618,17 +618,16 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
618618
case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break;
619619
case Qt::Key_PageUp: /* pass paging keys to messages widget */
620620
case Qt::Key_PageDown:
621-
if(obj == ui->lineEdit)
622-
{
623-
QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt));
621+
if (obj == ui->lineEdit) {
622+
QApplication::sendEvent(ui->messagesWidget, keyevt);
624623
return true;
625624
}
626625
break;
627626
case Qt::Key_Return:
628627
case Qt::Key_Enter:
629628
// forward these events to lineEdit
630-
if(obj == autoCompleter->popup()) {
631-
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
629+
if (obj == autoCompleter->popup()) {
630+
QApplication::sendEvent(ui->lineEdit, keyevt);
632631
autoCompleter->popup()->hide();
633632
return true;
634633
}
@@ -642,7 +641,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
642641
((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
643642
{
644643
ui->lineEdit->setFocus();
645-
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
644+
QApplication::sendEvent(ui->lineEdit, keyevt);
646645
return true;
647646
}
648647
}

0 commit comments

Comments
 (0)