Gui: Qt6 port

* QString::indexOf() is now marked as [[nodiscard]]
* Replace deprecated methods of QMessageBox
* QMouseEvent::globalPos() is deprecated, use globalPosition().toPoint()
* QWidget::enterEvent() requires a QEnterEvent as argument
* QLibraryInfo::location() is deprecated, use path()
* QVariant::Type is deprecated, use QMetaType::Type
* QVariant::canConvert(int) is deprecated, use QVariant::canConvert(QMetaType) or QVariant::canConvert<T>()
* QMessageBox::standardIcon is deprecated, use QStyle::standardIcon()
* Replace deprecated method QMessageBox::question(), ...
* QApplication::fontMetrics() is deprecated
* QDropEvent::mouseButtons() is deprecated, use buttons()
* QDropEvent::keyboardModifiers() is deprecated, use modifiers()
* Constructor of QFontDatabase is deprecated, use static methods instead
* Qt::AA_DisableHighDpiScaling is deprecated
* Qt::AA_EnableHighDpiScaling is deprecated
* Qt::AA_UseHighDpiPixmaps is deprecated
This commit is contained in:
wmayer
2022-11-05 15:08:58 +01:00
parent 588620fd9f
commit 81d2361d9f
19 changed files with 123 additions and 49 deletions

View File

@@ -852,7 +852,7 @@ void PythonConsole::runSource(const QString& line)
if (check) {
ret = QMessageBox::question(this, tr("System exit"),
tr("The application is still running.\nDo you want to exit without saving your data?"),
QMessageBox::Yes, QMessageBox::No|QMessageBox::Escape|QMessageBox::Default);
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
}
if (ret == QMessageBox::Yes) {
PyErr_Clear();
@@ -1017,7 +1017,11 @@ void PythonConsole::dropEvent (QDropEvent * e)
else {
// always copy text when doing drag and drop
if (mimeData->hasText()) {
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QTextCursor cursor = this->cursorForPosition(e->pos());
#else
QTextCursor cursor = this->cursorForPosition(e->position().toPoint());
#endif
QTextCursor inputLineBegin = this->inputBegin();
if (!cursorBeyond( cursor, inputLineBegin )) {
@@ -1025,7 +1029,11 @@ void PythonConsole::dropEvent (QDropEvent * e)
QRect newPos = this->cursorRect();
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QDropEvent newEv(QPoint(newPos.x(), newPos.y()), Qt::CopyAction, mimeData, e->mouseButtons(), e->keyboardModifiers());
#else
QDropEvent newEv(QPoint(newPos.x(), newPos.y()), Qt::CopyAction, mimeData, e->buttons(), e->modifiers());
#endif
e->accept();
QPlainTextEdit::dropEvent(&newEv);
}