From 478f5345dd5acad1997f7077c7b144590c7517a2 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Tue, 11 Nov 2025 12:57:14 -0500 Subject: [PATCH] Bump minimum Qt version to 5.15 (#8129) --- CMakeLists.txt | 2 +- include/AutomationClip.h | 4 --- include/DeprecationHelper.h | 31 ------------------- include/EffectSelectDialog.h | 8 ----- include/FileBrowser.h | 6 +--- include/RemotePlugin.h | 8 +---- plugins/CarlaBase/Carla.cpp | 22 ------------- .../GranularPitchShifterControlDialog.cpp | 4 --- plugins/Lb302/Lb302.cpp | 10 ++---- .../SlewDistortionControlDialog.cpp | 4 --- plugins/Vestige/Vestige.cpp | 11 ------- plugins/VstEffect/VstEffectControlDialog.cpp | 10 ------ plugins/VstEffect/VstEffectControls.cpp | 12 +------ plugins/Xpressive/Xpressive.cpp | 12 ------- src/core/AutomationClip.cpp | 6 ---- src/core/PluginFactory.cpp | 4 --- src/core/RemotePlugin.cpp | 3 -- src/core/Song.cpp | 8 ----- src/gui/FileBrowser.cpp | 11 ------- src/gui/MicrotunerConfig.cpp | 30 ++---------------- src/gui/MixerView.cpp | 10 ------ src/gui/ProjectNotes.cpp | 16 ++-------- src/gui/SampleTrackWindow.cpp | 10 ------ src/gui/clips/MidiClipView.cpp | 5 +-- src/gui/editors/AutomationEditor.cpp | 2 +- src/gui/editors/PianoRoll.cpp | 13 ++++---- src/gui/editors/SongEditor.cpp | 5 +-- src/gui/embed.cpp | 4 --- src/gui/instrument/InstrumentTrackWindow.cpp | 11 ------- src/gui/modals/EffectSelectDialog.cpp | 7 +---- src/gui/modals/FileDialog.cpp | 3 -- src/gui/modals/SetupDialog.cpp | 16 ++-------- src/gui/modals/VersionedSaveDialog.cpp | 4 +-- src/gui/widgets/ComboBox.cpp | 11 ------- src/gui/widgets/Knob.cpp | 6 ++-- src/gui/widgets/LcdFloatSpinBox.cpp | 2 +- src/gui/widgets/LcdWidget.cpp | 6 ++-- src/gui/widgets/LedCheckBox.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 8 ++--- 39 files changed, 41 insertions(+), 306 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d39a5890..6b5e3ddfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,7 @@ if(WANT_QT6) set(STATUS_QT6 "Enabled") else() set(QT_VERSION_MAJOR 5) - set(LMMS_QT_MIN_VERSION 5.9.0) + set(LMMS_QT_MIN_VERSION 5.15.0) set(STATUS_QT6 "Disabled") endif() diff --git a/include/AutomationClip.h b/include/AutomationClip.h index 1b723f8e1..f59917eaf 100644 --- a/include/AutomationClip.h +++ b/include/AutomationClip.h @@ -226,11 +226,7 @@ private: // Mutex to make methods involving automation clips thread safe // Mutable so we can lock it from const objects -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) mutable QRecursiveMutex m_clipMutex; -#else - mutable QMutex m_clipMutex; -#endif AutomationTrack * m_autoTrack; std::vector m_idsToResolve; diff --git a/include/DeprecationHelper.h b/include/DeprecationHelper.h index 437f8a96b..6e131176a 100644 --- a/include/DeprecationHelper.h +++ b/include/DeprecationHelper.h @@ -38,37 +38,6 @@ namespace lmms { -/** - * @brief horizontalAdvance is a backwards-compatible adapter for - * QFontMetrics::horizontalAdvance and width functions. - * @param metrics - * @param text - * @return text's horizontal advance based on metrics. - */ -inline int horizontalAdvance(const QFontMetrics& metrics, const QString& text) -{ -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) - return metrics.horizontalAdvance(text); -#else - return metrics.width(text); -#endif -} - -/** - * @brief position is a backwards-compatible adapter for - * QWheelEvent::position and pos functions. - * @param wheelEvent - * @return the position of wheelEvent - */ -inline QPoint position(const QWheelEvent* wheelEvent) -{ -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - return wheelEvent->position().toPoint(); -#else - return wheelEvent->pos(); -#endif -} - /** * @brief position is a backwards-compatible adapter for * QDropEvent::position and pos functions. diff --git a/include/EffectSelectDialog.h b/include/EffectSelectDialog.h index 81a04dbed..6f0e09b8a 100644 --- a/include/EffectSelectDialog.h +++ b/include/EffectSelectDialog.h @@ -63,18 +63,10 @@ protected: QString name = sourceModel()->data(nameIndex, Qt::DisplayRole).toString(); QString type = sourceModel()->data(typeIndex, Qt::DisplayRole).toString(); - // TODO: cleanup once we drop Qt5 support -#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) QRegularExpression nameRegularExpression(filterRegularExpression()); nameRegularExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption); bool nameFilterPassed = nameRegularExpression.match(name).capturedStart() != -1; -#else - QRegExp nameRegularExpression(filterRegExp()); - nameRegularExpression.setCaseSensitivity(Qt::CaseInsensitive); - - bool nameFilterPassed = nameRegularExpression.indexIn(name) != -1; -#endif bool typeFilterPassed = type.contains(m_effectTypeFilter, Qt::CaseInsensitive); diff --git a/include/FileBrowser.h b/include/FileBrowser.h index 3d08b19db..a10e5452e 100644 --- a/include/FileBrowser.h +++ b/include/FileBrowser.h @@ -164,12 +164,8 @@ private: //! This should only be accessed or modified when m_pphMutex is held PlayHandle* m_previewPlayHandle; - -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) + QRecursiveMutex m_pphMutex; -#else - QMutex m_pphMutex; -#endif QList getContextActions(FileItem* item, bool songEditor); diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 5ed4cc320..f468c97e0 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -27,9 +27,7 @@ #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) -#include // IWYU pragma: keep -#endif +#include #include "RemotePluginBase.h" #include "SharedMemory.h" @@ -166,11 +164,7 @@ private: QString m_exec; QStringList m_args; -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) QRecursiveMutex m_commMutex; -#else - QMutex m_commMutex; -#endif bool m_splitChannels; SharedMemory m_audioBuffer; diff --git a/plugins/CarlaBase/Carla.cpp b/plugins/CarlaBase/Carla.cpp index d7a61117f..cb238a703 100644 --- a/plugins/CarlaBase/Carla.cpp +++ b/plugins/CarlaBase/Carla.cpp @@ -846,17 +846,6 @@ CarlaParamsView::CarlaParamsView(CarlaInstrumentView* const instrumentView, QWid splitter->addWidget(outputFrame); verticalLayout->addWidget(splitter); -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; - -#endif - // -- Sub window auto win = new CarlaParamsSubWindow(getGUI()->mainWindow()->workspace()->viewport(), Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); @@ -1051,17 +1040,6 @@ void CarlaParamsView::windowResized() void CarlaParamsView::addKnob(uint32_t index) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; - -#endif - bool output = m_carlaInstrument->m_paramModels[index]->isOutput(); if (output) { diff --git a/plugins/GranularPitchShifter/GranularPitchShifterControlDialog.cpp b/plugins/GranularPitchShifter/GranularPitchShifterControlDialog.cpp index 91073cbbd..ac4d21afb 100755 --- a/plugins/GranularPitchShifter/GranularPitchShifterControlDialog.cpp +++ b/plugins/GranularPitchShifter/GranularPitchShifterControlDialog.cpp @@ -139,10 +139,6 @@ QString GranularPitchShifterHelpView::s_helpText= GranularPitchShifterHelpView::GranularPitchShifterHelpView():QTextEdit(s_helpText) { -#if (QT_VERSION < QT_VERSION_CHECK(5,12,0)) - // Bug workaround: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - using ::operator|; -#endif setWindowTitle("Granular Pitch Shifter Help"); setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); getGUI()->mainWindow()->addWindowedWidget(this); diff --git a/plugins/Lb302/Lb302.cpp b/plugins/Lb302/Lb302.cpp index d103c1bcd..f56fc92ae 100644 --- a/plugins/Lb302/Lb302.cpp +++ b/plugins/Lb302/Lb302.cpp @@ -441,11 +441,8 @@ QString Lb302Synth::nodeName() const // OBSOLETE. Break apart once we get Q_OBJECT to work. >:[ void Lb302Synth::recalcFilter() { -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) vcf.loadRelaxed()->recalc(); -#else - vcf.load()->recalc(); -#endif + // THIS IS OLD 3pole/24dB code, I may reintegrate it. Don't need it // right now. Should be toggled by LB_24_RES_TRICK at the moment. @@ -700,11 +697,8 @@ void Lb302Synth::initNote( Lb302Note *n) if(n->dead ==0){ // Swap next two blocks?? -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) vcf.loadRelaxed()->playNote(); -#else - vcf.load()->playNote(); -#endif + // Ensure envelope is recalculated vcf_envpos = ENVINC; diff --git a/plugins/SlewDistortion/SlewDistortionControlDialog.cpp b/plugins/SlewDistortion/SlewDistortionControlDialog.cpp index c57eaff6d..5358ab02d 100755 --- a/plugins/SlewDistortion/SlewDistortionControlDialog.cpp +++ b/plugins/SlewDistortion/SlewDistortionControlDialog.cpp @@ -474,10 +474,6 @@ QString SlewDistortionHelpView::s_helpText = tr( SlewDistortionHelpView::SlewDistortionHelpView() : QTextEdit(s_helpText) { -#if (QT_VERSION < QT_VERSION_CHECK(5,12,0)) - // Bug workaround: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - using ::operator|; -#endif setWindowTitle("Slew Distortion Help"); setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); getGUI()->mainWindow()->addWindowedWidget(this); diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index 014efbc7a..343db4ceb 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -922,17 +922,6 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume QWidget * _parent, VestigeInstrument * m_vi2 ) : InstrumentViewFixedSize( _instrument, _parent ) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; - -#endif - m_vi = m_vi2; m_vi->m_scrollArea = new QScrollArea( this ); widget = new QWidget(this); diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 2f38155f3..be8abb711 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -48,16 +48,6 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : m_plugin( nullptr ), tbLabel( nullptr ) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; -#endif - auto l = new QGridLayout(this); l->setContentsMargins( 10, 10, 10, 10 ); l->setVerticalSpacing( 2 ); diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index 2f31d75ee..277a285c5 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -315,19 +315,9 @@ namespace gui ManageVSTEffectView::ManageVSTEffectView( VstEffect * _eff, VstEffectControls * m_vi ) : m_effect( _eff ) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; -#endif - m_vi2 = m_vi; widget = new QWidget(); - m_vi->m_scrollArea = new QScrollArea( widget ); + m_vi->m_scrollArea = new QScrollArea(widget); l = new QGridLayout( widget ); m_vi->m_subWindow = getGUI()->mainWindow()->addWindowedWidget(nullptr, Qt::SubWindow | diff --git a/plugins/Xpressive/Xpressive.cpp b/plugins/Xpressive/Xpressive.cpp index 3cf97592b..e4b3d666d 100644 --- a/plugins/Xpressive/Xpressive.cpp +++ b/plugins/Xpressive/Xpressive.cpp @@ -861,18 +861,6 @@ QString XpressiveHelpView::s_helpText= XpressiveHelpView::XpressiveHelpView():QTextEdit(s_helpText) { - -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; - -#endif - setWindowTitle ( "Xpressive Help" ); setTextInteractionFlags ( Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse ); getGUI()->mainWindow()->addWindowedWidget( this ); diff --git a/src/core/AutomationClip.cpp b/src/core/AutomationClip.cpp index f766565bc..32739482b 100644 --- a/src/core/AutomationClip.cpp +++ b/src/core/AutomationClip.cpp @@ -47,9 +47,6 @@ const float AutomationClip::DEFAULT_MAX_VALUE = 1; AutomationClip::AutomationClip( AutomationTrack * _auto_track ) : Clip( _auto_track ), -#if (QT_VERSION < QT_VERSION_CHECK(5,14,0)) - m_clipMutex(QMutex::Recursive), -#endif m_autoTrack( _auto_track ), m_objects(), m_tension( 1.0 ), @@ -66,9 +63,6 @@ AutomationClip::AutomationClip( AutomationTrack * _auto_track ) : AutomationClip::AutomationClip( const AutomationClip & _clip_to_copy ) : Clip(_clip_to_copy), -#if (QT_VERSION < QT_VERSION_CHECK(5,14,0)) - m_clipMutex(QMutex::Recursive), -#endif m_autoTrack( _clip_to_copy.m_autoTrack ), m_objects( _clip_to_copy.m_objects ), m_tension( _clip_to_copy.m_tension ), diff --git a/src/core/PluginFactory.cpp b/src/core/PluginFactory.cpp index 38cd2dc58..b95a9be67 100644 --- a/src/core/PluginFactory.cpp +++ b/src/core/PluginFactory.cpp @@ -150,12 +150,8 @@ void PluginFactory::discoverPlugins() QSet files; for (const QString& searchPath : QDir::searchPaths("plugins")) { -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) auto discoveredPluginList = QDir(searchPath).entryInfoList(nameFilters); files.unite(QSet(discoveredPluginList.begin(), discoveredPluginList.end())); -#else - files.unite(QDir(searchPath).entryInfoList(nameFilters).toSet()); -#endif } // Apply any plugin filters from environment LMMS_EXCLUDE_PLUGINS diff --git a/src/core/RemotePlugin.cpp b/src/core/RemotePlugin.cpp index fd6ac6d45..3c3a7a1d1 100644 --- a/src/core/RemotePlugin.cpp +++ b/src/core/RemotePlugin.cpp @@ -139,9 +139,6 @@ RemotePlugin::RemotePlugin() : #endif m_failed( true ), m_watcher( this ), -#if (QT_VERSION < QT_VERSION_CHECK(5,14,0)) - m_commMutex(QMutex::Recursive), -#endif m_splitChannels( false ), m_audioBufferSize( 0 ), m_inputCount( DEFAULT_CHANNELS ), diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 441780d41..4de614d1c 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -1057,11 +1057,7 @@ void Song::loadProject( const QString & fileName ) { QTextStream(stderr) << tr("Can't load project: " "Project file contains local paths to plugins.") -#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) << Qt::endl; -#else - << endl; -#endif } } } @@ -1216,11 +1212,7 @@ void Song::loadProject( const QString & fileName ) } else { -#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) QTextStream(stderr) << Engine::getSong()->errorSummary() << Qt::endl; -#else - QTextStream(stderr) << Engine::getSong()->errorSummary() << endl; -#endif } } diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index e39166cfc..6b20d3f66 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -461,9 +461,6 @@ FileBrowserTreeWidget::FileBrowserTreeWidget(QWidget * parent ) : m_mousePressed( false ), m_pressPos(), m_previewPlayHandle( nullptr ) -#if (QT_VERSION < QT_VERSION_CHECK(5,14,0)) - ,m_pphMutex(QMutex::Recursive) -#endif { setColumnCount( 1 ); headerItem()->setHidden( true ); @@ -475,14 +472,6 @@ FileBrowserTreeWidget::FileBrowserTreeWidget(QWidget * parent ) : SLOT(updateDirectory(QTreeWidgetItem*))); connect( this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(updateDirectory(QTreeWidgetItem*))); - -#if QT_VERSION < QT_VERSION_CHECK(5, 12, 2) && defined LMMS_BUILD_WIN32 - // Set the font for the QTreeWidget to the Windows System font to make sure that - // truncated (elided) items use the same font as non-truncated items. - // This is a workaround for this qt bug, fixed in 5.12.2: https://bugreports.qt.io/browse/QTBUG-29232 - // TODO: remove this when all builds use a recent enough version of qt. - setFont( GuiApplication::getWin32SystemFont() ); -#endif } diff --git a/src/gui/MicrotunerConfig.cpp b/src/gui/MicrotunerConfig.cpp index fafe98b43..4dbb6064d 100644 --- a/src/gui/MicrotunerConfig.cpp +++ b/src/gui/MicrotunerConfig.cpp @@ -64,16 +64,6 @@ MicrotunerConfig::MicrotunerConfig() : m_baseKeyModel(DefaultBaseKey, 0, NumKeys - 1, nullptr, tr("Base key")), m_baseFreqModel(DefaultBaseFreq, 0.1f, 9999.999f, 0.001f, nullptr, tr("Base note frequency")) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; -#endif - setWindowIcon(embed::getIconPixmap("microtuner")); setWindowTitle(tr("Microtuner Configuration")); @@ -333,11 +323,7 @@ bool MicrotunerConfig::validateScaleForm() if (name.contains('\n')) {fail(tr("Scale name cannot contain a new-line character")); return false;} // check intervals - #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) - QStringList input = m_scaleTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); - #else - QStringList input = m_scaleTextEdit->toPlainText().split('\n', QString::SkipEmptyParts); - #endif + QStringList input = m_scaleTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); for (auto &line: input) { if (line.isEmpty()) {continue;} @@ -381,11 +367,7 @@ bool MicrotunerConfig::validateKeymapForm() if (name.contains('\n')) {fail(tr("Keymap name cannot contain a new-line character")); return false;} // check key mappings - #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) - QStringList input = m_keymapTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); - #else - QStringList input = m_keymapTextEdit->toPlainText().split('\n', QString::SkipEmptyParts); - #endif + QStringList input = m_keymapTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); for (auto &line: input) { if (line.isEmpty()) {continue;} @@ -415,11 +397,7 @@ bool MicrotunerConfig::applyScale() std::vector newIntervals; newIntervals.emplace_back(1, 1); -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) QStringList input = m_scaleTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); -#else - QStringList input = m_scaleTextEdit->toPlainText().split('\n', QString::SkipEmptyParts); -#endif for (auto &line: input) { if (line.isEmpty()) {continue;} @@ -461,11 +439,7 @@ bool MicrotunerConfig::applyKeymap() std::vector newMap; -#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) QStringList input = m_keymapTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts); -#else - QStringList input = m_keymapTextEdit->toPlainText().split('\n', QString::SkipEmptyParts); -#endif for (auto &line: input) { if (line.isEmpty()) {continue;} diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 54719b44e..299f1bff5 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -61,16 +61,6 @@ MixerView::MixerView(Mixer* mixer) : SerializingObjectHook(), m_mixer(mixer) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; -#endif - mixer->setHook(this); //QPalette pal = palette(); diff --git a/src/gui/ProjectNotes.cpp b/src/gui/ProjectNotes.cpp index ea9861012..8cbe18d87 100644 --- a/src/gui/ProjectNotes.cpp +++ b/src/gui/ProjectNotes.cpp @@ -148,13 +148,7 @@ void ProjectNotes::setupActions() QFontDatabase db; m_comboFont->addItems( db.families() ); - connect(m_comboFont, -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QOverload::of(&QComboBox::activated), -#else - &QComboBox::textActivated, -#endif - m_edit, &QTextEdit::setFontFamily); + connect(m_comboFont, &QComboBox::textActivated, m_edit, &QTextEdit::setFontFamily); m_comboFont->lineEdit()->setText( QApplication::font().family() ); @@ -167,13 +161,7 @@ void ProjectNotes::setupActions() m_comboSize->addItem( QString::number( *it ) ); } - connect(m_comboSize, -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QOverload::of(&QComboBox::activated), -#else - &QComboBox::textActivated, -#endif - this, &ProjectNotes::textSize); + connect(m_comboSize, &QComboBox::textActivated, this, &ProjectNotes::textSize); m_comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index 7b6e1d280..e0fea45ce 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -53,16 +53,6 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : m_track(tv->model()), m_stv(tv) { -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; -#endif - // init own layout + widgets setFocusPolicy(Qt::StrongFocus); auto vlayout = new QVBoxLayout(this); diff --git a/src/gui/clips/MidiClipView.cpp b/src/gui/clips/MidiClipView.cpp index cdbdb6187..2aa1c7f1d 100644 --- a/src/gui/clips/MidiClipView.cpp +++ b/src/gui/clips/MidiClipView.cpp @@ -495,13 +495,14 @@ void MidiClipView::mouseDoubleClickEvent(QMouseEvent *_me) void MidiClipView::wheelEvent(QWheelEvent * we) { + const auto pos = we->position().toPoint(); if(m_clip->m_clipType == MidiClip::Type::BeatClip && (fixedClips() || pixelsPerBar() >= 96) && - position(we).y() > height() - m_stepBtnOff.height()) + pos.y() > height() - m_stepBtnOff.height()) { // get the step number that was wheeled on and // do calculations in floats to prevent rounding errors... - float tmp = ((float(position(we).x()) - BORDER_WIDTH) * + float tmp = ((float(pos.x()) - BORDER_WIDTH) * float(m_clip -> m_steps)) / float(width() - BORDER_WIDTH*2); int step = int( tmp ); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 5036a233f..b25db0ed5 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1644,7 +1644,7 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) } x = qBound( 0, x, m_zoomingXModel.size() - 1 ); - int mouseX = (position( we ).x() - VALUES_WIDTH)* TimePos::ticksPerBar(); + int mouseX = (we->position().toPoint().x() - VALUES_WIDTH) * TimePos::ticksPerBar(); // ticks based on the mouse x-position where the scroll wheel was used int ticks = mouseX / m_ppb; // what would be the ticks in the new zoom level on the very same mouse x diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 145e8cc07..82590ad69 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3882,13 +3882,14 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) { we->accept(); // handle wheel events for note edit area - for editing note vol/pan with mousewheel - if(position(we).x() > noteEditLeft() && position(we).x() < noteEditRight() - && position(we).y() > noteEditTop() && position(we).y() < noteEditBottom()) + const auto pos = we->position().toPoint(); + if (pos.x() > noteEditLeft() && pos.x() < noteEditRight() + && pos.y() > noteEditTop() && pos.y() < noteEditBottom()) { if (!hasValidMidiClip()) {return;} // get values for going through notes int pixel_range = 8; - int x = position(we).x() - m_whiteKeyWidth; + int x = pos.x() - m_whiteKeyWidth; int ticks_start = ( x - pixel_range / 2 ) * TimePos::ticksPerBar() / m_ppb + m_currentPosition; int ticks_end = ( x + pixel_range / 2 ) * @@ -3925,7 +3926,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) { // show the volume hover-text only if all notes have the // same volume - showVolTextFloat(nv[0]->getVolume(), position(we), 1000); + showVolTextFloat(nv[0]->getVolume(), pos, 1000); } } else if( m_noteEditMode == NoteEditMode::Panning ) @@ -3944,7 +3945,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) { // show the pan hover-text only if all notes have the same // panning - showPanTextFloat( nv[0]->getPanning(), position( we ), 1000 ); + showPanTextFloat(nv[0]->getPanning(), pos, 1000); } } update(); @@ -3994,7 +3995,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) } z = qBound( 0, z, m_zoomingModel.size() - 1 ); - int x = (position(we).x() - m_whiteKeyWidth) * TimePos::ticksPerBar(); + int x = (pos.x() - m_whiteKeyWidth) * TimePos::ticksPerBar(); // ticks based on the mouse x-position where the scroll wheel was used int ticks = x / m_ppb; // what would be the ticks in the new zoom level on the very same mouse x diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index a5119373f..22dca6ab6 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -528,9 +528,10 @@ void SongEditor::adjustLeftRightScoll(int value) void SongEditor::wheelEvent( QWheelEvent * we ) { - if ((we->modifiers() & Qt::ControlModifier) && (position(we).x() > m_trackHeadWidth)) + const auto posX = we->position().toPoint().x(); + if ((we->modifiers() & Qt::ControlModifier) && (posX > m_trackHeadWidth)) { - int x = position(we).x() - m_trackHeadWidth; + int x = posX - m_trackHeadWidth; // tick based on the mouse x-position where the scroll wheel was used int tick = x / pixelsPerBar() * TimePos::ticksPerBar(); diff --git a/src/gui/embed.cpp b/src/gui/embed.cpp index bd08027dc..39bcdebec 100644 --- a/src/gui/embed.cpp +++ b/src/gui/embed.cpp @@ -125,11 +125,7 @@ auto getIconPixmap(std::string_view name, int width, int height, const char* con auto getText(std::string_view name) -> QString { const auto resource = QResource{":/" + QString::fromUtf8(name.data(), name.size())}; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QString::fromUtf8(resource.uncompressedData()); -#else - return QString::fromUtf8(reinterpret_cast(resource.data()), resource.size()); -#endif } } // namespace lmms::embed diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 0ee7c3eeb..7efe0e488 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -127,17 +127,6 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : basicControlsLayout->setVerticalSpacing(0); basicControlsLayout->setContentsMargins(0, 0, 0, 0); -#if QT_VERSION < 0x50C00 - // Workaround for a bug in Qt versions below 5.12, - // where argument-dependent-lookup fails for QFlags operators - // declared inside a namespace. - // This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h - // See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348 - - using ::operator|; - -#endif - QString labelStyleSheet = "font-size: 10px;"; Qt::Alignment labelAlignment = Qt::AlignHCenter | Qt::AlignTop; Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter; diff --git a/src/gui/modals/EffectSelectDialog.cpp b/src/gui/modals/EffectSelectDialog.cpp index 6e0bcb753..65604ee21 100644 --- a/src/gui/modals/EffectSelectDialog.cpp +++ b/src/gui/modals/EffectSelectDialog.cpp @@ -131,13 +131,8 @@ EffectSelectDialog::EffectSelectDialog(QWidget* parent) : mainLayout->addLayout(leftSectionLayout); m_filterEdit = new QLineEdit(this); - connect(m_filterEdit, &QLineEdit::textChanged, this, [this](const QString &text) { -// TODO: Cleanup when we don't support Qt5 anymore -#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) + connect(m_filterEdit, &QLineEdit::textChanged, this, [this](const QString& text) { m_model.setFilterRegularExpression(QRegularExpression(text, QRegularExpression::CaseInsensitiveOption)); -#else - m_model.setFilterRegExp(QRegExp(text, Qt::CaseInsensitive)); -#endif }); connect(m_filterEdit, &QLineEdit::textChanged, this, &EffectSelectDialog::updateSelection); m_filterEdit->setFocus(); diff --git a/src/gui/modals/FileDialog.cpp b/src/gui/modals/FileDialog.cpp index a6cf4827a..5895c5214 100644 --- a/src/gui/modals/FileDialog.cpp +++ b/src/gui/modals/FileDialog.cpp @@ -40,10 +40,7 @@ FileDialog::FileDialog( QWidget *parent, const QString &caption, const QString &directory, const QString &filter ) : QFileDialog( parent, caption, directory, filter ) { -#if QT_VERSION > 0x050200 setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - setOption( QFileDialog::DontUseNativeDialog ); #ifdef LMMS_BUILD_LINUX diff --git a/src/gui/modals/SetupDialog.cpp b/src/gui/modals/SetupDialog.cpp index 242b4f46c..d7e3dcf93 100644 --- a/src/gui/modals/SetupDialog.cpp +++ b/src/gui/modals/SetupDialog.cpp @@ -550,13 +550,7 @@ SetupDialog::SetupDialog(ConfigTab tab_to_open) : setCurrentIndex(m_audioInterfaces->findText(audioDevName)); m_audioIfaceSetupWidgets[audioDevName]->show(); - connect(m_audioInterfaces, -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QOverload::of(&QComboBox::activated), -#else - &QComboBox::textActivated, -#endif - this, &SetupDialog::audioInterfaceChanged); + connect(m_audioInterfaces, &QComboBox::textActivated, this, &SetupDialog::audioInterfaceChanged); // Advanced setting, hidden for now // // TODO Handle or remove. @@ -730,13 +724,7 @@ SetupDialog::SetupDialog(ConfigTab tab_to_open) : m_midiInterfaces->setCurrentIndex(m_midiInterfaces->findText(midiDevName)); m_midiIfaceSetupWidgets[midiDevName]->show(); - connect(m_midiInterfaces, -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QOverload::of(&QComboBox::activated), -#else - &QComboBox::textActivated, -#endif - this, &SetupDialog::midiInterfaceChanged); + connect(m_midiInterfaces, &QComboBox::textActivated, this, &SetupDialog::midiInterfaceChanged); // MIDI autoassign group QGroupBox * midiAutoAssignBox = new QGroupBox(tr("Automatically assign MIDI controller to selected track"), midi_w); diff --git a/src/gui/modals/VersionedSaveDialog.cpp b/src/gui/modals/VersionedSaveDialog.cpp index 2e883fe08..523f69357 100644 --- a/src/gui/modals/VersionedSaveDialog.cpp +++ b/src/gui/modals/VersionedSaveDialog.cpp @@ -54,8 +54,8 @@ VersionedSaveDialog::VersionedSaveDialog( QWidget *parent, plusButton->setToolTip( tr( "Increment version number" ) ); auto minusButton(new QPushButton("-", this)); minusButton->setToolTip( tr( "Decrement version number" ) ); - plusButton->setFixedWidth(horizontalAdvance(plusButton->fontMetrics(), "+") + 30); - minusButton->setFixedWidth(horizontalAdvance(minusButton->fontMetrics(), "+") + 30); + plusButton->setFixedWidth(plusButton->fontMetrics().horizontalAdvance("+") + 30); + minusButton->setFixedWidth(minusButton->fontMetrics().horizontalAdvance("+") + 30); // Add buttons to grid layout. For doing this, remove the lineEdit and // replace it with a HBox containing lineEdit and the buttons. diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index e9d127e7f..04a582b1d 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -35,12 +35,6 @@ #include "FontHelper.h" #include "DeprecationHelper.h" -#define QT_SUPPORTS_WIDGET_SCREEN (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) -#if !QT_SUPPORTS_WIDGET_SCREEN -#include -#include -#endif - namespace lmms::gui { const int CB_ARROW_BTN_WIDTH = 18; @@ -125,12 +119,7 @@ void ComboBox::mousePressEvent( QMouseEvent* event ) QPoint gpos = mapToGlobal(QPoint(0, height())); - #if (QT_SUPPORTS_WIDGET_SCREEN) bool const menuCanBeFullyShown = screen()->geometry().contains(QRect(gpos, m_menu.sizeHint())); - #else - bool const menuCanBeFullyShown = gpos.y() + m_menu.sizeHint().height() < qApp->desktop()->height(); - #endif - if (menuCanBeFullyShown) { m_menu.exec(gpos); diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 78a3db25f..e1a083c38 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -175,7 +175,7 @@ void Knob::updateFixedSize() if (m_knobPixmap) { // In legacy mode only the width of the label is taken into account while the height is not - const int labelWidth = horizontalAdvance(QFontMetrics(adjustedToPixelSize(font(), SMALL_FONT_SIZE)), m_label); + const int labelWidth = QFontMetrics(adjustedToPixelSize(font(), SMALL_FONT_SIZE)).horizontalAdvance(m_label); const int width = std::max(m_knobPixmap->width(), labelWidth); // Legacy mode assumes that the label will fit into 10 pixels plus some of the pixmap area @@ -196,7 +196,7 @@ void Knob::updateFixedSize() auto fm = QFontMetrics(font()); - const int width = std::max(pixmapSize.width(), horizontalAdvance(fm, m_label)); + const int width = std::max(pixmapSize.width(), fm.horizontalAdvance(m_label)); const int height = pixmapSize.height() + fm.height(); setFixedSize(width, height); @@ -491,7 +491,7 @@ void Knob::drawLabel(QPainter& p) p.setFont(adjustedToPixelSize(p.font(), SMALL_FONT_SIZE)); } auto fm = p.fontMetrics(); - const auto x = (width() - horizontalAdvance(fm, m_label)) / 2; + const auto x = (width() - fm.horizontalAdvance(m_label)) / 2; const auto descent = fixedFontSizeLabelRendering() ? 2 : fm.descent(); const auto y = height() - descent; diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index 98998a006..283cc69c5 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -192,7 +192,7 @@ void LcdFloatSpinBox::mouseReleaseEvent(QMouseEvent*) void LcdFloatSpinBox::wheelEvent(QWheelEvent *event) { // switch between integer and fractional step based on cursor position - if (position(event).x() < m_wholeDisplay.width()) { m_intStep = true; } + if (event->position().toPoint().x() < m_wholeDisplay.width()) { m_intStep = true; } else { m_intStep = false; } event->accept(); diff --git a/src/gui/widgets/LcdWidget.cpp b/src/gui/widgets/LcdWidget.cpp index 4b07af6f7..b37744e47 100644 --- a/src/gui/widgets/LcdWidget.cpp +++ b/src/gui/widgets/LcdWidget.cpp @@ -212,11 +212,11 @@ void LcdWidget::paintEvent( QPaintEvent* ) p.setFont(adjustedToPixelSize(p.font(), DEFAULT_FONT_SIZE)); p.setPen( textShadowColor() ); p.drawText(width() / 2 - - horizontalAdvance(p.fontMetrics(), m_label) / 2 + 1, + p.fontMetrics().horizontalAdvance(m_label) / 2 + 1, height(), m_label); p.setPen( textColor() ); p.drawText(width() / 2 - - horizontalAdvance(p.fontMetrics(), m_label) / 2, + p.fontMetrics().horizontalAdvance(m_label) / 2, height() - 1, m_label); } @@ -261,7 +261,7 @@ void LcdWidget::updateSize() setFixedSize( qMax( m_cellWidth * m_numDigits + marginX1 + marginX2, - horizontalAdvance(QFontMetrics(adjustedToPixelSize(font(), DEFAULT_FONT_SIZE)), m_label) + QFontMetrics(adjustedToPixelSize(font(), DEFAULT_FONT_SIZE)).horizontalAdvance(m_label) ), m_cellHeight + (2 * marginY) + 9 ); diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index 850393356..0f55f7af6 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -105,7 +105,7 @@ void LedCheckBox::onTextUpdated() { QFontMetrics const fm = fontMetrics(); - int const width = m_ledOffPixmap.width() + 5 + horizontalAdvance(fm, text()); + int const width = m_ledOffPixmap.width() + 5 + fm.horizontalAdvance(text()); int const height = m_legacyMode ? m_ledOffPixmap.height() : qMax(m_ledOffPixmap.height(), fm.height()); setFixedSize(width, height); diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 1990066f8..7dedc7cc6 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -79,7 +79,7 @@ void TabWidget::addTab(QWidget* w, const QString& name, const char* pixmap, int } // Tab's width when it is a text tab. This isn't correct for artwork tabs, but it's fixed later during the PaintEvent - int tab_width = horizontalAdvance(fontMetrics(), name) + 10; + int tab_width = fontMetrics().horizontalAdvance(name) + 10; // Register new tab widgetDesc d = {w, pixmap, name, tab_width}; @@ -128,7 +128,7 @@ int TabWidget::findTabAtPos(const QPoint& pos) if (pos.y() > 1 && pos.y() < m_tabbarHeight - 1) { - int cx = ((m_caption == "") ? 4 : 14) + horizontalAdvance(fontMetrics(), m_caption); + int cx = ((m_caption == "") ? 4 : 14) + fontMetrics().horizontalAdvance(m_caption); for (widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it) { @@ -233,7 +233,7 @@ void TabWidget::paintEvent(QPaintEvent* pe) } // Calculate the tabs' x (tabs are painted next to the caption) - int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + horizontalAdvance(fontMetrics(), m_caption); + int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().horizontalAdvance(m_caption); // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); @@ -296,7 +296,7 @@ void TabWidget::paintEvent(QPaintEvent* pe) // Switch between tabs with mouse wheel void TabWidget::wheelEvent(QWheelEvent* we) { - if (position(we).y() > m_tabheight) + if (we->position().toPoint().y() > m_tabheight) { return; }