Merge pull request #565 from DieterMayerOSS/pr/qt6-partslist-printdialog

Restore two more Qt5-only code paths on Qt6 (parts list, print dialog)
This commit is contained in:
Laurent Trinques
2026-07-28 17:38:44 +02:00
committed by GitHub
2 changed files with 9 additions and 17 deletions
+5 -9
View File
@@ -480,15 +480,11 @@ void QETElementEditor::fillPartsList()
} }
} }
QListWidgetItem *qlwi = new QListWidgetItem(part_desc); QListWidgetItem *qlwi = new QListWidgetItem(part_desc);
QVariant v; // Qt declares the QGraphicsItem* metatype itself, so this
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove // works on Qt 5 and Qt 6 alike. Without the stored pointer
v.setValue<QGraphicsItem *>(qgi); // the parts list loses its item association and selecting
#else // a part no longer selects it on the canvas.
#if TODO_LIST QVariant v = QVariant::fromValue(qgi);
#pragma message("@TODO remove code for QT 6 or later")
#endif
qDebug()<<"Help code for QT 6 or later";
#endif
qlwi -> setData(42, v); qlwi -> setData(42, v);
m_parts_list -> addItem(qlwi); m_parts_list -> addItem(qlwi);
qlwi -> setSelected(qgi -> isSelected()); qlwi -> setSelected(qgi -> isSelected());
+4 -8
View File
@@ -79,14 +79,10 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
print_dialog.setWindowFlags(Qt::Sheet); print_dialog.setWindowFlags(Qt::Sheet);
#endif #endif
print_dialog.setWindowTitle(tr("Options d'impression", "window title")); print_dialog.setWindowTitle(tr("Options d'impression", "window title"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove // setOptions() is the modern spelling of the Qt4-era
print_dialog.setEnabledOptions(QAbstractPrintDialog::PrintShowPageSize); // setEnabledOptions() (removed in Qt 6): replace the enabled
#else // option set with just PrintShowPageSize, on Qt 5 and 6 alike.
#if TODO_LIST print_dialog.setOptions(QAbstractPrintDialog::PrintShowPageSize);
#pragma message("@TODO remove code for QT 6 or later")
#endif
qDebug()<<"Help code for QT 6 or later";
#endif
if (print_dialog.exec() == QDialog::Rejected) { if (print_dialog.exec() == QDialog::Rejected) {
delete printer_; delete printer_;
return; return;