Skip to content

Commit 3ec6504

Browse files
committed
qt: Do not use QKeyEvent copy constructor
This change is preparation for Qt 6, and it fixes an experimental build with Qt 6.2.4 as copying of `QEvent` has been disabled in Qt 6.0.0 (see 19f9b0d5f54379151eb71e98555b203ad6756276 upstream commit).
1 parent e0680bb commit 3ec6504

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)