From 2d4ab5af20a73e433b88c94da5f30877c854248a Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 1 Mar 2025 09:17:30 +0100 Subject: [PATCH] REMOVE old QT<= 5.14 code Ubuntu 22.04 use qt 1.15.3. In the code is still used qt code <5.10. A cleanup was done by removing qT code version used in ubuntu 18.04. --- src/Base/CMakeLists.txt | 2 - src/Base/QtTools.cpp | 37 ------------- src/Base/QtTools.h | 55 ------------------- src/Gui/Application.cpp | 10 +--- src/Gui/BitmapFactory.cpp | 5 +- src/Gui/Command.cpp | 8 --- src/Gui/Dialogs/DlgAbout.cpp | 6 -- src/Gui/Dialogs/DlgCheckableMessageBox.cpp | 6 -- src/Gui/DocumentRecovery.cpp | 7 --- src/Gui/DownloadItem.cpp | 13 ----- src/Gui/FileDialog.cpp | 13 ----- src/Gui/MainWindow.cpp | 5 +- src/Gui/MenuManager.cpp | 38 ------------- src/Gui/OverlayManager.cpp | 18 ------ src/Gui/OverlayWidgets.cpp | 34 ------------ src/Gui/Placement.cpp | 5 -- src/Gui/PreferencePages/DlgSettingsEditor.cpp | 15 ----- src/Gui/PythonWrapper.cpp | 9 +-- src/Gui/Quarter/Mouse.cpp | 4 -- src/Gui/Quarter/QuarterWidget.cpp | 11 +--- src/Gui/ReportView.cpp | 4 -- src/Gui/TaskView/TaskAppearance.cpp | 7 --- src/Gui/TaskView/TaskView.cpp | 10 ---- src/Gui/Tools.h | 9 +-- src/Gui/Transform.cpp | 5 -- src/Gui/View3DInventorViewer.cpp | 2 +- src/Gui/propertyeditor/PropertyItem.cpp | 4 -- src/Mod/Fem/Gui/TaskFemConstraint.cpp | 3 +- src/Mod/Material/App/MaterialValue.cpp | 1 - .../Material/Gui/DlgDisplayPropertiesImp.cpp | 11 ---- src/Mod/Measure/App/MeasurePosition.cpp | 7 +-- src/Mod/Mesh/Gui/DlgSmoothing.cpp | 5 -- src/Mod/Part/Gui/DlgPrimitives.cpp | 4 -- src/Mod/Part/Gui/TaskShapeBuilder.cpp | 5 -- .../PartDesign/Gui/TaskBooleanParameters.cpp | 3 +- .../PartDesign/Gui/TaskDressUpParameters.cpp | 4 -- .../PartDesign/Gui/TaskExtrudeParameters.cpp | 2 - src/Mod/PartDesign/Gui/TaskLoftParameters.cpp | 2 - src/Mod/PartDesign/Gui/TaskPipeParameters.cpp | 15 ++--- src/Mod/PartDesign/Gui/TaskShapeBinder.cpp | 2 - .../Gui/TaskTransformedParameters.cpp | 4 -- src/Mod/TechDraw/App/LineGenerator.cpp | 13 ----- src/Mod/TechDraw/Gui/QGSPage.cpp | 10 ---- src/Mod/TechDraw/Gui/QGVPage.cpp | 9 +-- src/Mod/TechDraw/Gui/TaskCenterLine.cpp | 6 -- src/Mod/TechDraw/Gui/TaskProjGroup.cpp | 4 -- src/Mod/TechDraw/Gui/mrichtextedit.cpp | 37 +------------ 47 files changed, 22 insertions(+), 467 deletions(-) delete mode 100644 src/Base/QtTools.cpp delete mode 100644 src/Base/QtTools.h diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt index df4eb45bc1..d8d3868f6b 100644 --- a/src/Base/CMakeLists.txt +++ b/src/Base/CMakeLists.txt @@ -221,7 +221,6 @@ SET(FreeCADBase_CPP_SRCS PyExport.cpp PyObjectBase.cpp PythonTypeExt.cpp - QtTools.cpp Reader.cpp Rotation.cpp RotationPyImp.cpp @@ -289,7 +288,6 @@ SET(FreeCADBase_HPP_SRCS PyObjectBase.h PyWrapParseTupleAndKeywords.h PythonTypeExt.h - QtTools.h Reader.h Rotation.h ServiceProvider.h diff --git a/src/Base/QtTools.cpp b/src/Base/QtTools.cpp deleted file mode 100644 index 0b37513953..0000000000 --- a/src/Base/QtTools.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2022 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" - -#include "QtTools.h" - - -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) -namespace Qt -{ -BaseExport QTextStream& endl(QTextStream& stream) -{ - return stream << QLatin1Char('\n') << flush; -} -} // namespace Qt -#endif diff --git a/src/Base/QtTools.h b/src/Base/QtTools.h deleted file mode 100644 index 4d9cdb2497..0000000000 --- a/src/Base/QtTools.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2022 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef BASE_QTTOOLS_H -#define BASE_QTTOOLS_H - -#include -#include -#include - -// Suppress warning about 'SkipEmptyParts' not being used -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-variable" -#elif defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -#endif - -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) -#include -namespace Qt -{ -BaseExport QTextStream& endl(QTextStream& stream); -static auto SkipEmptyParts = QString::SkipEmptyParts; -} // namespace Qt -#endif - -#if defined(__clang__) -#pragma clang diagnostic pop -#elif defined(__GNUC__) -#pragma GCC diagnostic pop -#endif - -#endif // BASE_QTTOOLS_H diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index c8827f4b01..66ba504f1f 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1836,22 +1836,16 @@ QStringList Application::workbenches() const QStringList hidden, extra; if (ht != config.end()) { QString items = QString::fromLatin1(ht->second.c_str()); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) hidden = items.split(QLatin1Char(';'), Qt::SkipEmptyParts); -#else - hidden = items.split(QLatin1Char(';'), QString::SkipEmptyParts); -#endif + if (hidden.isEmpty()) { hidden.push_back(QLatin1String("")); } } if (et != config.end()) { QString items = QString::fromLatin1(et->second.c_str()); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + extra = items.split(QLatin1Char(';'), Qt::SkipEmptyParts); -#else - extra = items.split(QLatin1Char(';'), QString::SkipEmptyParts); -#endif if (extra.isEmpty()) { extra.push_back(QLatin1String("")); } diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index a51178fef3..5c70844bb1 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -530,11 +530,8 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const size[0] = p.width(); size[1] = p.height(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) int buffersize = static_cast(p.sizeInBytes()); -#else - int buffersize = p.byteCount(); -#endif + int numcomponents = 0; QVector table = p.colorTable(); if (!table.isEmpty()) { diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 2837dc0d54..2739030847 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -660,11 +660,7 @@ void Command::_doCommand(const char *file, int line, DoCmd_Type eType, const cha va_list ap; va_start(ap, sCmd); QString s; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - const QString cmd = s.vsprintf(sCmd, ap); -#else const QString cmd = s.vasprintf(sCmd, ap); -#endif va_end(ap); // 'vsprintf' expects a utf-8 string for '%s' @@ -785,10 +781,7 @@ void Command::_copyVisual(const char *file, int line, const App::DocumentObject if(!from || !from->isAttachedToDocument() || !to || !to->isAttachedToDocument()) return; static std::map attrMap = { - // {"ShapeColor","ShapeMaterial.DiffuseColor"}, {"ShapeAppearance", "ShapeMaterial"}, - // {"LineColor","ShapeMaterial.DiffuseColor"}, - // {"PointColor","ShapeMaterial.DiffuseColor"}, {"Transparency","Transparency"}, }; auto it = attrMap.find(attr_to); @@ -816,7 +809,6 @@ void Command::_copyVisual(const char *file, int line, const App::DocumentObject objCmd.c_str(),attr_to,getObjectCmd(from).c_str(),attr_from,objCmd.c_str(),attr_to); } catch(Base::Exception& /*e*/) { - // e.ReportException(); } } diff --git a/src/Gui/Dialogs/DlgAbout.cpp b/src/Gui/Dialogs/DlgAbout.cpp index ca6c8b9011..87e8debb7e 100644 --- a/src/Gui/Dialogs/DlgAbout.cpp +++ b/src/Gui/Dialogs/DlgAbout.cpp @@ -508,13 +508,7 @@ void AboutDialog::showPrivacyPolicy() auto textField = new QTextBrowser(tabPrivacyPolicy); textField->setOpenExternalLinks(true); hLayout->addWidget(textField); - -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - // We can't actually render the markdown, so just display it as text - textField->setText(text); -#else textField->setMarkdown(text); -#endif } void AboutDialog::linkActivated(const QUrl& link) diff --git a/src/Gui/Dialogs/DlgCheckableMessageBox.cpp b/src/Gui/Dialogs/DlgCheckableMessageBox.cpp index c326c739aa..0e077d5331 100644 --- a/src/Gui/Dialogs/DlgCheckableMessageBox.cpp +++ b/src/Gui/Dialogs/DlgCheckableMessageBox.cpp @@ -172,13 +172,7 @@ void DlgCheckableMessageBox::setText(const QString &t) QPixmap DlgCheckableMessageBox::iconPixmap() const { -#if QT_VERSION >= QT_VERSION_CHECK(5,15,0) return m_d->ui.pixmapLabel->pixmap(Qt::ReturnByValue); -#else - if (const QPixmap *p = m_d->ui.pixmapLabel->pixmap()) - return QPixmap(*p); - return QPixmap(); -#endif } void DlgCheckableMessageBox::setIconPixmap(const QPixmap &p) diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index e4ae5a94b0..ae577901d0 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -713,17 +713,10 @@ void DocumentRecoveryCleaner::clearDirectory(const QFileInfo& dir) void DocumentRecoveryCleaner::subtractFiles(QStringList& files) { if (!ignoreFiles.isEmpty() && !files.isEmpty()) { -#if QT_VERSION >= QT_VERSION_CHECK(5,14,0) auto set1 = QSet(files.begin(), files.end()); auto set2 = QSet(ignoreFiles.begin(), ignoreFiles.end()); set1.subtract(set2); files = QList(set1.begin(), set1.end()); -#else - QSet set1 = files.toSet(); - QSet set2 = ignoreFiles.toSet(); - set1.subtract(set2); - files = set1.toList(); -#endif } } diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 1ef9e9d0ed..289f09f814 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -261,11 +261,7 @@ void DownloadItem::init() m_url = m_reply->url(); m_reply->setParent(this); connect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(m_reply, qOverload(&QNetworkReply::error), this, &DownloadItem::error); -#else connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error); -#endif connect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress); connect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged); connect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished); @@ -312,8 +308,6 @@ void DownloadItem::getFileName() { QSettings settings; settings.beginGroup(QLatin1String("downloadmanager")); - // QString defaultLocation = - // QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); QString defaultLocation = getDownloadDirectory(); QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); @@ -536,14 +530,7 @@ void DownloadItem::metaDataChanged() url = redirectUrl; disconnect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - disconnect(m_reply, - qOverload(&QNetworkReply::error), - this, - &DownloadItem::error); -#else disconnect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error); -#endif disconnect(m_reply, &QNetworkReply::downloadProgress, this, diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 353672461a..aeca1932c1 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -454,10 +454,6 @@ FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl ) setOption(QFileDialog::DontUseNativeDialog); - // This is an alternative to add the button to the grid layout - //QDialogButtonBox* box = this->findChild(); - //box->addButton(extensionButton, QDialogButtonBox::ActionRole); - //search for the grid layout and add the new button auto grid = this->findChild(); grid->addWidget(extensionButton, 4, 2, Qt::AlignLeft); @@ -571,11 +567,6 @@ void FileOptionsDialog::setOptionsWidget(FileOptionsDialog::ExtensionPosition po setMinimumWidth(extensionWidget->width()); } - // Instead of resizing the dialog we can fix the layout size. - // This however, doesn't work nicely when the extension widget - // is higher/wider than the dialog. - //grid->setSizeConstraint(QLayout::SetFixedSize); - oldSize = size(); w->hide(); if (show) @@ -912,11 +903,7 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types // connections connect(buttonBox, &QDialogButtonBox::accepted, this, &SelectModule::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &SelectModule::reject); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(group, qOverload(&QButtonGroup::buttonClicked), this, &SelectModule::onButtonClicked); -#else connect(group, &QButtonGroup::idClicked, this, &SelectModule::onButtonClicked); -#endif } SelectModule::~SelectModule() = default; diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 4bc644ce7f..524a032e56 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -431,10 +431,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) d->windowMapper = new QSignalMapper(this); // connection between workspace, window menu and tab bar -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(d->windowMapper, qOverload(&QSignalMapper::mapped), - this, &MainWindow::onSetActiveSubWindow); -#elif QT_VERSION < QT_VERSION_CHECK(6,0,0) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) connect(d->windowMapper, &QSignalMapper::mappedWidget, this, &MainWindow::onSetActiveSubWindow); #else diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index ea95c63c60..3acb85cab5 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -205,45 +205,7 @@ void MenuManager::setup(MenuItem* menuItems) const QMenuBar* menuBar = getMainWindow()->menuBar(); -#if 0 -#if defined(FC_OS_MACOSX) && QT_VERSION >= 0x050900 - // Unknown Qt macOS bug observed with Qt >= 5.9.4 causes random crashes when viewing reused top level menus. menuBar->clear(); -#endif - - // On Kubuntu 18.10 global menu has issues with FreeCAD 0.18 menu bar. - // Optional parameter, clearing the menu bar, can be set as a workaround. - // Clearing the menu bar can cause issues, when trying to access menu bar through Python. - // https://forum.freecad.org/viewtopic.php?f=10&t=30340&start=440#p289330 - if (App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/MainWindow")->GetBool("ClearMenuBar",false)) { - menuBar->clear(); - } -#else - // In addition to the reason described in the above comments, there is - // another more subtle one that's making clearing menu bar a necessity for - // all platforms. - // - // By right, it should be fine for more than one command action having the - // same shortcut but in different workbench. It should not require manual - // conflict resolving in this case, as the action in an inactive workbench - // is expected to be inactive as well, or else user may experience - // seemingly random shortcut miss firing based on the order he/she - // switches workbenches. In fact, this may be considered as an otherwise - // difficult to implement feature of context aware shortcut, where a - // specific shortcut can activate different actions under different - // workbenches. - // - // This works as expected for action adding to a toolbar. As Qt will ignore - // actions inside an invisible toolbar. However, Qt refuse to do the same - // for actions in a hidden menu action of a menu bar. This is very likely a - // Qt bug, as the behavior does not seem to conform to Qt's documentation - // of Qt::ShortcutContext. - // - // Clearing the menu bar, and recreate it every time when switching - // workbench with only the active actions can solve this problem. - menuBar->clear(); -#endif QList actions = menuBar->actions(); for (auto& item : menuItems->getItems()) diff --git a/src/Gui/OverlayManager.cpp b/src/Gui/OverlayManager.cpp index ce44ecf614..f7b437e54b 100644 --- a/src/Gui/OverlayManager.cpp +++ b/src/Gui/OverlayManager.cpp @@ -1914,11 +1914,7 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev) } case QEvent::Wheel: { auto we = static_cast(ev); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - QPoint globalPos = we->globalPos(); -#else QPoint globalPos = we->globalPosition().toPoint(); -#endif lastIntercept = getChildAt(widget, globalPos); // For some reason in case of 3D View we have to target it directly instead of targeting @@ -1932,7 +1928,6 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev) } } -#if QT_VERSION >= QT_VERSION_CHECK(5,12,0) QWheelEvent wheelEvent(lastIntercept->mapFromGlobal(globalPos), globalPos, we->pixelDelta(), @@ -1942,19 +1937,6 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev) we->phase(), we->inverted(), we->source()); -#else - QWheelEvent wheelEvent(lastIntercept->mapFromGlobal(globalPos), - globalPos, - we->pixelDelta(), - we->angleDelta(), - 0, - Qt::Vertical, - we->buttons(), - we->modifiers(), - we->phase(), - we->source(), - we->inverted()); -#endif QApplication::sendEvent(lastIntercept, &wheelEvent); break; } diff --git a/src/Gui/OverlayWidgets.cpp b/src/Gui/OverlayWidgets.cpp index a34865bec4..fac07090f2 100644 --- a/src/Gui/OverlayWidgets.cpp +++ b/src/Gui/OverlayWidgets.cpp @@ -1197,11 +1197,6 @@ void OverlayTabWidget::_setOverlayMode(QWidget *widget, OverlayOption option) if(!widget) return; -#if QT_VERSION>QT_VERSION_CHECK(5,12,2) && QT_VERSION < QT_VERSION_CHECK(5,12,6) - // Work around Qt bug https://bugreports.qt.io/browse/QTBUG-77006 - widget->setStyleSheet(OverlayManager::instance()->getStyleSheet()); -#endif - if (qobject_cast(widget)) { auto parent = widget->parentWidget(); if (parent) { @@ -2602,14 +2597,6 @@ void OverlayGraphicsEffect::draw(QPainter* painter) if (px.isNull()) return; -#if 0 - if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { - static int count; - getMainWindow()->showMessage( - QStringLiteral("dock overlay redraw %1").arg(count++)); - } -#endif - QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); @@ -2682,27 +2669,6 @@ void OverlayGraphicsEffect::draw(QPainter* painter) // draw the actual pixmap... painter->drawPixmap(offset, px, QRectF()); -#if 0 - QWidget *focus = qApp->focusWidget(); - if (focus) { - QWidget *widget = qobject_cast(this->parent()); - if (auto *edit = qobject_cast(focus)) { - if (!edit->isReadOnly() && edit->isEnabled()) { - for(auto w=edit->parentWidget(); w; w=w->parentWidget()) { - if (w == widget) { - QRect r = edit->cursorRect(); - QRect rect(edit->viewport()->mapTo(widget, r.topLeft()), - edit->viewport()->mapTo(widget, r.bottomRight())); - // painter->fillRect(rect, edit->textColor()); - // painter->fillRect(rect, edit->currentCharFormat().foreground()); - painter->fillRect(rect.translated(offset), Qt::white); - } - } - } - } - } -#endif - // restore world transform painter->setWorldTransform(restoreTransform); } diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 5e63bb3558..105d5e4174 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -530,13 +530,8 @@ void Placement::setupSignalMapper() signalMapper->setMapping(it, id++); } -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(signalMapper, qOverload(&QSignalMapper::mapped), - this, &Placement::onPlacementChanged); -#else connect(signalMapper, &QSignalMapper::mappedInt, this, &Placement::onPlacementChanged); -#endif } void Placement::setupRotationMethod() diff --git a/src/Gui/PreferencePages/DlgSettingsEditor.cpp b/src/Gui/PreferencePages/DlgSettingsEditor.cpp index 6567533e73..8e189c88a8 100644 --- a/src/Gui/PreferencePages/DlgSettingsEditor.cpp +++ b/src/Gui/PreferencePages/DlgSettingsEditor.cpp @@ -76,11 +76,7 @@ DlgSettingsEditor::DlgSettingsEditor(QWidget* parent) setupConnections(); -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - ui->textEdit1->setTabStopWidth(40); -#else ui->textEdit1->setTabStopDistance(40.0); -#endif d = new DlgSettingsEditorP(); QColor col; @@ -173,17 +169,10 @@ void DlgSettingsEditor::setupConnections() this, &DlgSettingsEditor::onDisplayItemsCurrentItemChanged); connect(ui->colorButton, &ColorButton::changed, this, &DlgSettingsEditor::onColorButtonChanged); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - connect(ui->fontFamily, qOverload(&QComboBox::activated), - this, &DlgSettingsEditor::onFontFamilyActivated); - connect(ui->fontSize, qOverload(&PrefSpinBox::valueChanged), - this, &DlgSettingsEditor::onFontSizeValueChanged); -#else connect(ui->fontFamily, &QComboBox::textActivated, this, &DlgSettingsEditor::onFontFamilyActivated); connect(ui->fontSize, &PrefSpinBox::textChanged, this, &DlgSettingsEditor::onFontSizeValueChanged); -#endif // clang-format on } @@ -213,11 +202,7 @@ void DlgSettingsEditor::setEditorTabWidth(int tabWidth) { QFontMetrics metric(font()); int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0')); -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - ui->textEdit1->setTabStopWidth(tabWidth * fontSize); -#else ui->textEdit1->setTabStopDistance(tabWidth * fontSize); -#endif } void DlgSettingsEditor::saveSettings() diff --git a/src/Gui/PythonWrapper.cpp b/src/Gui/PythonWrapper.cpp index fa4d06a64b..b07308ca2e 100644 --- a/src/Gui/PythonWrapper.cpp +++ b/src/Gui/PythonWrapper.cpp @@ -75,18 +75,13 @@ # ifdef HAVE_PYSIDE2 # define HAVE_PYSIDE -// Since version 5.12 shiboken offers a method to get wrapper by class name (typeForTypeName) -// This helps to avoid to include the PySide2 headers since MSVC has a compiler bug when -// compiling together with std::bitset (https://bugreports.qt.io/browse/QTBUG-72073) - // Include shiboken first to get the version # include // Do not use SHIBOKEN_MICRO_VERSION; it might contain a dot # define SHIBOKEN_FULL_VERSION QT_VERSION_CHECK(SHIBOKEN_MAJOR_VERSION, SHIBOKEN_MINOR_VERSION, 0) -# if (SHIBOKEN_FULL_VERSION >= QT_VERSION_CHECK(5, 12, 0)) -# define HAVE_SHIBOKEN_TYPE_FOR_TYPENAME -# endif +# define HAVE_SHIBOKEN_TYPE_FOR_TYPENAME + # ifndef HAVE_SHIBOKEN_TYPE_FOR_TYPENAME # include diff --git a/src/Gui/Quarter/Mouse.cpp b/src/Gui/Quarter/Mouse.cpp index 1d91f77d95..99423adae3 100644 --- a/src/Gui/Quarter/Mouse.cpp +++ b/src/Gui/Quarter/Mouse.cpp @@ -153,12 +153,8 @@ const SoEvent * MouseP::mouseWheelEvent(QWheelEvent * event) { PUBLIC(this)->setModifiers(this->wheel, event); -#if QT_VERSION >= QT_VERSION_CHECK(5,15,0) QPoint pnt = event->position().toPoint(); SbVec2s pos(pnt.x(), PUBLIC(this)->windowsize[1] - pnt.y() - 1); -#else - SbVec2s pos(event->pos().x(), PUBLIC(this)->windowsize[1] - event->pos().y() - 1); -#endif // the following corrects for high-dpi displays (e.g. mac retina) pos *= publ->quarter->devicePixelRatio(); this->location2->setPosition(pos); //I don't know why location2 is assigned here, I assumed it important --DeepSOIC diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index bcc76dd297..a0ee2577ef 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -154,12 +154,7 @@ public: Q_UNUSED(shareWidget); QSurfaceFormat surfaceFormat(format); surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - // With the settings below we could determine deprecated OpenGL API - // but can't do this since otherwise it will complain about almost any - // OpenGL call in Coin3d - //surfaceFormat.setMajorVersion(3); - //surfaceFormat.setMinorVersion(2); - //surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + #if defined (_DEBUG) && 0 surfaceFormat.setOption(QSurfaceFormat::DebugContext); #endif @@ -937,11 +932,7 @@ bool QuarterWidget::viewportEvent(QEvent* event) } else if (event->type() == QEvent::Wheel) { auto wheel = static_cast(event); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - QPoint pos = wheel->pos(); -#else QPoint pos = wheel->position().toPoint(); -#endif QGraphicsItem* item = itemAt(pos); if (!item) { QGraphicsView::viewportEvent(event); diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index 2e6f90d048..fce293d6a5 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -860,11 +860,7 @@ void ReportOutput::OnChange(Base::Subject &rCaller, const char * sR setFont(font); QFontMetrics metric(font); int width = QtTools::horizontalAdvance(metric, QLatin1String("0000")); -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - setTabStopWidth(width); -#else setTabStopDistance(width); -#endif } else if (strcmp(sReason, "RedirectPythonOutput") == 0) { bool checked = rclGrp.GetBool(sReason, true); diff --git a/src/Gui/TaskView/TaskAppearance.cpp b/src/Gui/TaskView/TaskAppearance.cpp index ebeaab46d2..67d4d5bab2 100644 --- a/src/Gui/TaskView/TaskAppearance.cpp +++ b/src/Gui/TaskView/TaskAppearance.cpp @@ -71,17 +71,10 @@ TaskAppearance::~TaskAppearance() void TaskAppearance::setupConnections() { // clang-format off -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - connect(ui->changeMode, qOverload(&QComboBox::activated), - this, &TaskAppearance::onChangeModeActivated); - connect(ui->changePlot, qOverload(&QComboBox::activated), - this, &TaskAppearance::onChangePlotActivated); -#else connect(ui->changeMode, &QComboBox::textActivated, this, &TaskAppearance::onChangeModeActivated); connect(ui->changePlot, &QComboBox::textActivated, this, &TaskAppearance::onChangePlotActivated); -#endif connect(ui->spinTransparency, qOverload(&QSpinBox::valueChanged), this, &TaskAppearance::onTransparencyValueChanged); connect(ui->spinPointSize, qOverload(&QSpinBox::valueChanged), diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index ad99f23ada..9e21b0d4f4 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -270,9 +270,6 @@ QSize TaskPanel::minimumSizeHint() const TaskView::TaskView(QWidget *parent) : QScrollArea(parent),ActiveDialog(nullptr),ActiveCtrl(nullptr) { - //addWidget(new TaskEditControl(this)); - //addWidget(new TaskAppearance(this)); - //addStretch(); taskPanel = new TaskPanel(this); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); @@ -751,18 +748,11 @@ void TaskView::addTaskWatcher() taskPanel->addStretch(); updateWatcher(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - // Workaround to avoid a crash in Qt. See also - // https://forum.freecad.org/viewtopic.php?f=8&t=39187 - // - // Notify the button box about a style change so that it can - // safely delete the style animation of its push buttons. auto box = taskPanel->findChild(); if (box) { QEvent event(QEvent::StyleChange); QApplication::sendEvent(box, &event); } -#endif taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme()); } diff --git a/src/Gui/Tools.h b/src/Gui/Tools.h index f90b87675c..06aa07ae6e 100644 --- a/src/Gui/Tools.h +++ b/src/Gui/Tools.h @@ -37,18 +37,11 @@ namespace Gui { class GuiExport QtTools { public: static int horizontalAdvance(const QFontMetrics& fm, QChar ch) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + return fm.horizontalAdvance(ch); -#else - return fm.width(ch); -#endif } static int horizontalAdvance(const QFontMetrics& fm, const QString& text, int len = -1) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) return fm.horizontalAdvance(text, len); -#else - return fm.width(text, len); -#endif } static bool matches(QKeyEvent* ke, const QKeySequence& ks) { uint searchkey = (ke->modifiers() | ke->key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier); diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp index 7d3f661321..e1d22d1105 100644 --- a/src/Gui/Transform.cpp +++ b/src/Gui/Transform.cpp @@ -298,13 +298,8 @@ Transform::Transform(QWidget* parent, Qt::WindowFlags fl) signalMapper->setMapping(it, id++); } -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(signalMapper, qOverload(&QSignalMapper::mapped), - this, &Transform::onTransformChanged); -#else connect(signalMapper, &QSignalMapper::mappedInt, this, &Transform::onTransformChanged); -#endif setTransformStrategy(new DefaultTransformStrategy(this)); } diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 078d9380b4..eae47b843d 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -74,7 +74,7 @@ # include # include # include -#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0) && QT_VERSION >= QT_VERSION_CHECK(5,13,0) +#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0) # include # define HAS_QTBUG_95434 #endif diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index d4aa272aae..e6e0371279 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -891,11 +891,7 @@ QWidget* PropertyFontItem::createEditor(QWidget* parent, const std::functionsetFrame(false); cb->setDisabled(isReadOnly()); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QObject::connect(cb, qOverload(&QComboBox::activated), method); -#else QObject::connect(cb, &QComboBox::textActivated, method); -#endif return cb; } diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index 4a41e50514..10acfae65d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -173,10 +173,9 @@ void TaskFemConstraint::createDeleteAction(QListWidget* parentList) auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut(); deleteAction->setShortcut(QKeySequence(shortcut)); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry deleteAction->setShortcutVisibleInContextMenu(true); -#endif parentList->addAction(deleteAction); parentList->setContextMenuPolicy(Qt::ActionsContextMenu); } diff --git a/src/Mod/Material/App/MaterialValue.cpp b/src/Mod/Material/App/MaterialValue.cpp index 9cd5245a57..af84945adf 100644 --- a/src/Mod/Material/App/MaterialValue.cpp +++ b/src/Mod/Material/App/MaterialValue.cpp @@ -26,7 +26,6 @@ #endif #include -#include #include #include diff --git a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp index 7e4a3e419b..b043b20ac0 100644 --- a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp @@ -199,16 +199,6 @@ void DlgDisplayPropertiesImp::setupFilters() void DlgDisplayPropertiesImp::setupConnections() { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - connect(d->ui.changeMode, - qOverload(&QComboBox::activated), - this, - &DlgDisplayPropertiesImp::onChangeModeActivated); - connect(d->ui.changePlot, - qOverload(&QComboBox::activated), - this, - &DlgDisplayPropertiesImp::onChangePlotActivated); -#else connect(d->ui.changeMode, &QComboBox::textActivated, this, @@ -217,7 +207,6 @@ void DlgDisplayPropertiesImp::setupConnections() &QComboBox::textActivated, this, &DlgDisplayPropertiesImp::onChangePlotActivated); -#endif connect(d->ui.spinTransparency, qOverload(&QSpinBox::valueChanged), this, diff --git a/src/Mod/Measure/App/MeasurePosition.cpp b/src/Mod/Measure/App/MeasurePosition.cpp index 0364f4db53..aa3d3160a2 100644 --- a/src/Mod/Measure/App/MeasurePosition.cpp +++ b/src/Mod/Measure/App/MeasurePosition.cpp @@ -134,17 +134,12 @@ QString MeasurePosition::getResultString() QString unit = QString::fromStdString(Position.getUnit().getString()); int precision = 2; QString text; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QTextStream(&text) << "X: " << QString::number(value.x, 'f', precision) << " " << unit << endl - << "Y: " << QString::number(value.y, 'f', precision) << " " << unit << endl - << "Z: " << QString::number(value.z, 'f', precision) << " " << unit; -#else + QTextStream(&text) << "X: " << QString::number(value.x, 'f', precision) << " " << unit << Qt::endl << "Y: " << QString::number(value.y, 'f', precision) << " " << unit << Qt::endl << "Z: " << QString::number(value.z, 'f', precision) << " " << unit; -#endif return text; } diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.cpp b/src/Mod/Mesh/Gui/DlgSmoothing.cpp index 006a8cf310..4a668aa9d9 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.cpp +++ b/src/Mod/Mesh/Gui/DlgSmoothing.cpp @@ -53,13 +53,8 @@ DlgSmoothing::DlgSmoothing(QWidget* parent) connect(ui->checkBoxSelection, &QCheckBox::toggled, this, &DlgSmoothing::onCheckBoxSelectionToggled); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(bg, qOverload(&QButtonGroup::buttonClicked), - this, &DlgSmoothing::methodClicked); -#else connect(bg, qOverload(&QButtonGroup::idClicked), this, &DlgSmoothing::methodClicked); -#endif ui->labelLambda->setText(QString::fromUtf8("\xce\xbb")); ui->labelMu->setText(QString::fromUtf8("\xce\xbc")); diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index a23d89f404..bde63661a4 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -215,11 +215,7 @@ bool AbstractPrimitive::hasValidPrimitive() const void AbstractPrimitive::connectSignalMapper(QSignalMapper* mapper) { -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(mapper, qOverload(&QSignalMapper::mapped), this, &AbstractPrimitive::changeValue); -#else connect(mapper, &QSignalMapper::mappedObject, this, &AbstractPrimitive::changeValue); -#endif } namespace PartGui { diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.cpp b/src/Mod/Part/Gui/TaskShapeBuilder.cpp index 8dfa5c65c1..295764cfba 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.cpp +++ b/src/Mod/Part/Gui/TaskShapeBuilder.cpp @@ -122,13 +122,8 @@ ShapeBuilderWidget::ShapeBuilderWidget(QWidget* parent) this, &ShapeBuilderWidget::onSelectButtonClicked); connect(d->ui.createButton, &QPushButton::clicked, this, &ShapeBuilderWidget::onCreateButtonClicked); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(&d->bg, qOverload(&QButtonGroup::buttonClicked), - this, &ShapeBuilderWidget::switchMode); -#else connect(&d->bg, &QButtonGroup::idClicked, this, &ShapeBuilderWidget::switchMode); -#endif d->gate = new ShapeSelection(); Gui::Selection().addSelectionGate(d->gate); diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 6fe2e5764a..ba4e4eb320 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -89,10 +89,9 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean* BooleanView, Q auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut(); action->setShortcut(QKeySequence(shortcut)); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry action->setShortcutVisibleInContextMenu(true); -#endif ui->listWidgetBodies->addAction(action); connect(action, &QAction::triggered, this, &TaskBooleanParameters::onBodyDeleted); ui->listWidgetBodies->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp index 8467f87ed7..a3fa570886 100644 --- a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp @@ -292,10 +292,8 @@ void TaskDressUpParameters::createAddAllEdgesAction(QListWidget* parentList) addAllEdgesAction = new QAction(tr("Add all edges"), this); addAllEdgesAction->setShortcut(QKeySequence(QStringLiteral("Ctrl+Shift+A"))); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // display shortcut behind the context menu entry addAllEdgesAction->setShortcutVisibleInContextMenu(true); -#endif parentList->addAction(addAllEdgesAction); addAllEdgesAction->setStatusTip(tr("Adds all edges to the list box (active only when in add selection mode).")); parentList->setContextMenuPolicy(Qt::ActionsContextMenu); @@ -311,10 +309,8 @@ void TaskDressUpParameters::createDeleteAction(QListWidget* parentList) auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut(); deleteAction->setShortcut(QKeySequence(shortcut)); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // display shortcut behind the context menu entry deleteAction->setShortcutVisibleInContextMenu(true); -#endif parentList->addAction(deleteAction); parentList->setContextMenuPolicy(Qt::ActionsContextMenu); } diff --git a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp index f22d89afb1..c9f2a7bb42 100644 --- a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp @@ -179,10 +179,8 @@ void TaskExtrudeParameters::setupDialog() auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut(); unselectShapeFaceAction->setShortcut(QKeySequence(shortcut)); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // display shortcut behind the context menu entry unselectShapeFaceAction->setShortcutVisibleInContextMenu(true); -#endif ui->listWidgetReferences->addAction(unselectShapeFaceAction); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index 8529a322ea..4f32dadac2 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -77,10 +77,8 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft* LoftView, bool /*newObj auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut(); remove->setShortcut(QKeySequence(shortcut)); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // display shortcut behind the context menu entry remove->setShortcutVisibleInContextMenu(true); -#endif ui->listWidgetReferences->addAction(remove); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); connect(remove, &QAction::triggered, this, &TaskLoftParameters::onDeleteSection); diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index 0c65626b2e..74aa3c8fcc 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -92,10 +92,11 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe* PipeView, bool /*newObj remove->setShortcut(QKeySequence(shortcut)); } remove->setShortcutContext(Qt::WidgetShortcut); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry - remove->setShortcutVisibleInContextMenu(true); -#endif + remove->setShortcutVisibleInContextMenu(true); + + ui->listWidgetReferences->addAction(remove); connect(remove, &QAction::triggered, this, &TaskPipeParameters::onDeleteEdge); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); @@ -615,10 +616,10 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, remove->setShortcut(QKeySequence(shortcut)); } remove->setShortcutContext(Qt::WidgetShortcut); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry remove->setShortcutVisibleInContextMenu(true); -#endif + ui->listWidgetReferences->addAction(remove); connect(remove, &QAction::triggered, this, &TaskPipeOrientation::onDeleteItem); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); @@ -908,10 +909,10 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW remove->setShortcut(QKeySequence(shortcut)); } remove->setShortcutContext(Qt::WidgetShortcut); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry remove->setShortcutVisibleInContextMenu(true); -#endif + ui->listWidgetReferences->addAction(remove); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); connect(remove, &QAction::triggered, this, &TaskPipeScaling::onDeleteSection); diff --git a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp index c9a285c169..0bbaf0e8c3 100644 --- a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp @@ -134,10 +134,8 @@ void TaskShapeBinder::setupContextMenu() remove->setShortcut(QKeySequence(shortcut)); } remove->setShortcutContext(Qt::WidgetShortcut); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // display shortcut behind the context menu entry remove->setShortcutVisibleInContextMenu(true); -#endif ui->listWidgetReferences->addAction(remove); connect(remove, &QAction::triggered, this, &TaskShapeBinder::deleteItem); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp index 83f4e4fc25..fcef26c508 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp @@ -131,11 +131,7 @@ void TaskTransformedParameters::setupUI() ui->buttonGroupMode->setId(ui->radioTransformToolShapes, static_cast(Mode::TransformToolShapes)); connect(ui->buttonGroupMode, -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - qOverload(&QButtonGroup::buttonClicked), -#else &QButtonGroup::idClicked, -#endif this, &TaskTransformedParameters::onModeChanged); diff --git a/src/Mod/TechDraw/App/LineGenerator.cpp b/src/Mod/TechDraw/App/LineGenerator.cpp index d793cee635..e5a7bd0387 100644 --- a/src/Mod/TechDraw/App/LineGenerator.cpp +++ b/src/Mod/TechDraw/App/LineGenerator.cpp @@ -57,9 +57,6 @@ using DU = DrawUtil; LineGenerator::LineGenerator() { reloadDescriptions(); -// m_elementDefs = loadElements(); -// m_lineDefs = getLineDefinitions(); -// m_lineDescs = getLineDescriptions(); } void LineGenerator::reloadDescriptions() @@ -73,8 +70,6 @@ void LineGenerator::reloadDescriptions() //! we prefer to use the ISO Line Number if available. QPen LineGenerator::getBestPen(size_t isoNumber, Qt::PenStyle qtStyle, double width) { -// Base::Console().Message("DLG::getBestPen((%d, %d, %.3f)\n", -// isoNumber, qtStyle, width); // TODO: use TechDraw::LineFormat::InvalidLine here if (isoNumber > 0 && isoNumber < m_lineDefs.size()) { @@ -160,11 +155,7 @@ QPen LineGenerator::getLinePen(size_t lineNumber, double nominalLineWidth) dashPattern.push_back(static_cast< double >(m_elementDefs[entry]) / proportionalAdjust); } -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QVector qDashPattern = QVector::fromStdVector(dashPattern); -#else QVector qDashPattern(dashPattern.begin(), dashPattern.end()); -#endif linePen.setDashPattern(qDashPattern); linePen.setWidthF(nominalLineWidth); @@ -175,8 +166,6 @@ QPen LineGenerator::getLinePen(size_t lineNumber, double nominalLineWidth) //! convert Qt line style to closest ISO line number int LineGenerator::fromQtStyle(Qt::PenStyle style) { -// Base::Console().Message("DLG::fromQtStyle(%d)\n", style); - // the 4 standard Qt::PenStyles and ISO128 equivalents int dashed = 2; int dotted = 7; @@ -221,7 +210,6 @@ int LineGenerator::fromQtStyle(Qt::PenStyle style) //! ANSI Y14.2 standards file std::map LineGenerator::loadElements() { -// Base::Console().Message("DLG::loadElements()\n"); std::map result; // open file, for each record, parse element name and length, then insert into // the output map. @@ -252,7 +240,6 @@ std::map LineGenerator::loadElements() //! load the line definition file into memory std::vector< std::vector > LineGenerator::getLineDefinitions() { -// Base::Console().Message("DLG::loadLineDefinitions()\n"); std::vector< std::vector > lineDefs; std::string record; Base::FileInfo fi(Preferences::currentLineDefFile()); diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index 2be8bcab13..cb7ac278e0 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -199,7 +199,6 @@ void QGSPage::addChildrenToPage() matchSceneRectToTemplate(); } - // viewAll(); } //********** template related routines ********* @@ -251,7 +250,6 @@ QPointF QGSPage::getTemplateCenter() void QGSPage::matchSceneRectToTemplate() { - // Base::Console().Message("QGSP::matchSceneRectToTemplate()\n"); App::DocumentObject* obj = m_vpPage->getDrawPage()->Template.getValue(); auto pageTemplate(dynamic_cast(obj)); if (pageTemplate) { @@ -264,7 +262,6 @@ void QGSPage::matchSceneRectToTemplate() void QGSPage::setPageTemplate(TechDraw::DrawTemplate* templateFeat) { - // Base::Console().Message("QGSP::setPageTemplate()\n"); removeTemplate(); if (templateFeat->isDerivedFrom()) { @@ -869,7 +866,6 @@ bool QGSPage::hasQView(App::DocumentObject* obj) void QGSPage::refreshViews() { - // Base::Console().Message("QGSP::refreshViews()\n"); QList list = items(); QList qgiv; //find only QGIV's @@ -1197,16 +1193,10 @@ void QGSPage::postProcessXml(QTemporaryFile& temporaryFile, QString fileName, QS QStringLiteral("stroke: none;")); // Scale the template group correctly -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - templateGroup.setAttribute( - QStringLiteral("transform"), - QString().sprintf("scale(%f, %f)", Rez::guiX(1.0), Rez::guiX(1.0))); -#else templateGroup.setAttribute(QStringLiteral("transform"), QStringLiteral("scale(%1, %2)") .arg(Rez::guiX(1.0), 0, 'f') .arg(Rez::guiX(1.0), 0, 'f')); -#endif // Finally, transfer all template document child nodes under the template group while (!templateDocElem.firstChild().isNull()) { diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index bd1516ccaf..893d077767 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -233,7 +233,6 @@ void QGVPage::initNavigationStyle() void QGVPage::setNavigationStyle(std::string navParm) { - // Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str()); if (m_navStyle) { delete m_navStyle; } @@ -309,15 +308,10 @@ void QGVPage::deactivateHandler() void QGVPage::startBalloonPlacing(DrawView* parent) { - // Base::Console().Message("QGVP::startBalloonPlacing(%s)\n", parent->getNameInDocument()); balloonPlacing = true; m_balloonParent = parent; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) activateCursor( QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y())); -#else - activateCursor(QCursor(*balloonCursor->pixmap(), balloonHotspot.x(), balloonHotspot.y())); -#endif } void QGVPage::cancelBalloonPlacing() @@ -339,7 +333,6 @@ void QGVPage::drawBackground(QPainter* painter, const QRectF&) } if (!m_vpPage->getDrawPage()) { - // Base::Console().Message("QGVP::drawBackground - no Page Feature!\n"); return; } @@ -697,7 +690,7 @@ static QCursor createCursor(QBitmap &bitmap, QBitmap &mask, int hotX, int hotY, #else Q_UNUSED(dpr) #endif -#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0) && QT_VERSION >= QT_VERSION_CHECK(5,13,0) +#if defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(6,6,0) if (qGuiApp->platformName() == QLatin1String("wayland")) { QImage img = bitmap.toImage(); img.convertTo(QImage::Format_ARGB32); diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp index c6591ee96a..657c6bdd90 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp @@ -158,11 +158,7 @@ void TaskCenterLine::setUiConnect() connect(ui->qsbHorizShift, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onShiftHorizChanged); connect(ui->qsbExtend, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onExtendChanged); connect(ui->qsbRotate, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCenterLine::onRotationChanged); -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(ui->bgOrientation, qOverload(&QButtonGroup::buttonClicked), this, &TaskCenterLine::onOrientationChanged); -#else connect(ui->bgOrientation, &QButtonGroup::idClicked, this, &TaskCenterLine::onOrientationChanged); -#endif } void TaskCenterLine::setUiPrimary() @@ -449,7 +445,6 @@ void TaskCenterLine::createCenterLine() void TaskCenterLine::updateOrientation() { -// Base::Console().Message("TCL::updateOrientation()\n"); if (!m_cl) { return; } @@ -613,7 +608,6 @@ TaskDlgCenterLine::~TaskDlgCenterLine() void TaskDlgCenterLine::update() { -// widget->updateTask(); } void TaskDlgCenterLine::modifyStandardButtons(QDialogButtonBox* box) diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp index 21d60f6dac..8ed734293c 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp @@ -112,13 +112,9 @@ void TaskProjGroup::connectWidgets() connect(ui->sbScaleDen, qOverload(&QSpinBox::valueChanged), this, &TaskProjGroup::scaleManuallyChanged); // Slot for Projection Type (layout) -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(ui->projection, qOverload(&QComboBox::currentIndexChanged), this, &TaskProjGroup::projectionTypeChanged); -#else connect(ui->projection, qOverload(&QComboBox::currentIndexChanged), this, [this](int index) { projectionTypeChanged(ui->projection->itemText(index)); }); -#endif // Spacing connect(ui->cbAutoDistribute, &QPushButton::clicked, this, &TaskProjGroup::AutoDistributeClicked); diff --git a/src/Mod/TechDraw/Gui/mrichtextedit.cpp b/src/Mod/TechDraw/Gui/mrichtextedit.cpp index 75c81ab9a6..d6fbccb654 100644 --- a/src/Mod/TechDraw/Gui/mrichtextedit.cpp +++ b/src/Mod/TechDraw/Gui/mrichtextedit.cpp @@ -63,12 +63,7 @@ using namespace TechDraw; MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent) { setupUi(this); m_lastBlockList = nullptr; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - f_textedit->setTabStopWidth(40); -#else f_textedit->setTabStopDistance(40); -#endif -// setDefFontSize(getDefFontSizeNum()); setDefFontSize(TechDrawGui::PreferencesGui::labelFontSizePX()); m_defFont = getDefFont().family(); f_textedit->setFont(getDefFont()); @@ -204,15 +199,10 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent) for(int size: sizes) { f_fontsize->addItem(QString::number(size)); } - //TODO: void QComboBox::setEditText(const QString &text) to " " when multiple select -#if QT_VERSION < QT_VERSION_CHECK(5,15,0) - connect(f_fontsize, qOverload(&QComboBox::currentIndexChanged), - this, &MRichTextEdit::textSize); -#else + connect(f_fontsize, qOverload(&QComboBox::currentIndexChanged), this, [this](int index) { textSize(f_fontsize->itemText(index)); }); -#endif // text foreground color @@ -282,9 +272,6 @@ void MRichTextEdit::textRemoveFormat() { fmt.setFontStrikeOut (false); fmt.setFontItalic (false); fmt.setFontPointSize (m_defFontSize); -// fmt.setFontFamily ("Helvetica"); -// fmt.setFontStyleHint (QFont::SansSerif); -// fmt.setFontFixedPitch (true); f_bold ->setChecked(false); f_underline ->setChecked(false); @@ -292,9 +279,6 @@ void MRichTextEdit::textRemoveFormat() { f_strikeout ->setChecked(false); f_fontsize ->setCurrentIndex(f_fontsize->findText(getDefFontSize())); -// QTextBlockFormat bfmt = cursor.blockFormat(); -// bfmt->setIndent(0); - fmt.clearBackground(); mergeFormatOnWordOrSelection(fmt); @@ -428,11 +412,7 @@ void MRichTextEdit::textStyle(int index) { } if (index == ParagraphMonospace) { fmt = cursor.charFormat(); -#if QT_VERSION < QT_VERSION_CHECK(5,13,0) - fmt.setFontFamily(QString::fromUtf8("Monospace")); -#else fmt.setFontFamilies(QStringList() << QString::fromUtf8("Monospace")); -#endif fmt.setFontStyleHint(QFont::Monospace); fmt.setFontFixedPitch(true); } @@ -530,7 +510,6 @@ void MRichTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format) } void MRichTextEdit::slotCursorPositionChanged() { -// qDebug() << "MRTE::slotCursorPositionChanged()"; //why do we change text style when selecting text? QTextCursor cursor = f_textedit->textCursor(); if (cursor.hasSelection()) { //let selection logic handle this @@ -569,7 +548,6 @@ void MRichTextEdit::slotCursorPositionChanged() { } void MRichTextEdit::fontChanged(const QFont &font) { -// qDebug() << "MRTE::fontChanged()"; //TODO: change this to real font selector f_fontsize->setCurrentIndex(f_fontsize->findText(QString::number(font.pointSize()))); f_bold->setChecked(font.bold()); @@ -634,14 +612,7 @@ void MRichTextEdit::bgColorChanged(const QColor &color) { } void MRichTextEdit::slotCurrentCharFormatChanged(const QTextCharFormat &format) { -// qDebug() << "MRTE::slotCurrentCharFormatChanged()"; Q_UNUSED(format); - //again, why do we do all this just because the cursor moved? - //can it be this simple??? -// fontChanged(format.font()); -// bgColorChanged((format.background().isOpaque()) ? format.background().color() : QColor()); -// fgColorChanged((format.foreground().isOpaque()) ? format.foreground().color() : QColor()); -// f_link->setChecked(format.isAnchor()); } void MRichTextEdit::slotClipboardDataChanged() { @@ -723,7 +694,6 @@ void MRichTextEdit::onExit() void MRichTextEdit::onSelectionChanged() { -// qDebug() << "MRTE::onSelectionChanged()"; if (hasMultipleSizes()) { f_fontsize->setEditText(QString()); f_fontsize->setCurrentIndex(-1); @@ -739,7 +709,6 @@ void MRichTextEdit::onSelectionChanged() //does selection have multiple sizes? bool MRichTextEdit::hasMultipleSizes() { -// qDebug() << "MRTE::hasMultipleSizes()"; QTextCursor cursor = f_textedit->textCursor(); if (cursor.hasSelection()) { int begin = cursor.selectionStart(); @@ -767,7 +736,6 @@ bool MRichTextEdit::hasMultipleSizes() void MRichTextEdit::setDefFontSize(int fontSize) { -// Base::Console().Message("MRTE::setDefFontSize(%d)\n", fs); m_defFontSize = fontSize; m_fontsize_h1 = fontSize + 8; m_fontsize_h2 = fontSize + 6; @@ -787,7 +755,6 @@ void MRichTextEdit::setDefFontSize(int fontSize) int MRichTextEdit::getDefFontSizeNum() { -// Base::Console().Message("MRTE::getDefFontSizeNum()\n"); double fontSize = TechDraw::Preferences::dimFontSizeMM(); //this conversion is only approximate. the factor changes for different fonts. @@ -799,7 +766,6 @@ int MRichTextEdit::getDefFontSizeNum() QString MRichTextEdit::getDefFontSize() { -// Base::Console().Message("MRTE::getDefFontSize()\n"); return QString::number(getDefFontSizeNum()); } @@ -823,7 +789,6 @@ QFont MRichTextEdit::getDefFont() // if the conversion factor is float, will generate non-standard sizes void MRichTextEdit::addFontSize(QString fontSize) { -// Base::Console().Message("MRTE::addFontSize(%s)\n", qPrintable(fs)); QStringList newList; int fsVal = fontSize.toInt(); int size = f_fontsize->count();