Qt6 port:

Fix deprecation warnings with version 6.3 or 6.4
This commit is contained in:
wmayer
2023-07-23 17:23:23 +02:00
committed by Chris Hennes
parent 68101ac933
commit 7d0926d0b3
9 changed files with 51 additions and 40 deletions

View File

@@ -992,7 +992,13 @@ void PythonConsole::mouseReleaseEvent( QMouseEvent *e )
// Now we must amend the received event and pass forward. As e->setLocalPos() is only
// available in Qt>=5.8, let's stop the original event propagation and generate a fake event
// with corrected pointer position (inside the prompt line of the widget)
QMouseEvent newEv(e->type(), QPoint(newPos.x(),newPos.y()), e->button(), e->buttons(), e->modifiers());
#if QT_VERSION < QT_VERSION_CHECK(6,4,0)
QMouseEvent newEv(e->type(), QPoint(newPos.x(),newPos.y()),
e->button(), e->buttons(), e->modifiers());
#else
QMouseEvent newEv(e->type(), QPoint(newPos.x(),newPos.y()), e->globalPosition(),
e->button(), e->buttons(), e->modifiers());
#endif
e->accept();
QCoreApplication::sendEvent(this->viewport(), &newEv);
return;
@@ -1318,7 +1324,8 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
QAction *a;
bool mayPasteHere = cursorBeyond( this->textCursor(), this->inputBegin() );
a = menu.addAction(tr("&Copy"), this, &PythonConsole::copy, QKeySequence(QString::fromLatin1("CTRL+C")));
a = menu.addAction(tr("&Copy"), this, &PythonConsole::copy);
a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+C")));
a->setEnabled(textCursor().hasSelection());
a = menu.addAction(tr("&Copy command"), this, &PythonConsole::onCopyCommand);
@@ -1337,11 +1344,13 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
menu.addSeparator();
a = menu.addAction(tr("&Paste"), this, &PythonConsole::paste, QKeySequence(QString::fromLatin1("CTRL+V")));
a = menu.addAction(tr("&Paste"), this, &PythonConsole::paste);
a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+V")));
const QMimeData *md = QApplication::clipboard()->mimeData();
a->setEnabled( mayPasteHere && md && canInsertFromMimeData(md));
a = menu.addAction(tr("Select All"), this, &PythonConsole::selectAll, QKeySequence(QString::fromLatin1("CTRL+A")));
a = menu.addAction(tr("Select All"), this, &PythonConsole::selectAll);
a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+A")));
a->setEnabled(!document()->isEmpty());
a = menu.addAction(tr("Clear console"), this, &PythonConsole::onClearConsole);