Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Deprecation warnings with Qt 5.15 (and 5.14) #5616

Merged
merged 1 commit into from Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion audio/midi/fluid/sfont.cpp
Expand Up @@ -824,7 +824,7 @@ bool SFont::load()
}
f.close();
/* sort preset list by bank, preset # */
qSort(presets.begin(), presets.end(), preset_compare);
std::sort(presets.begin(), presets.end(), preset_compare);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion audio/midi/midifile.cpp
Expand Up @@ -914,7 +914,7 @@ void MidiFile::separateChannel()
if (nn <= 1) {
continue;
}
qSort(channel);
std::sort(channel.begin(), channel.end());
// -- split --
// insert additional tracks, assign to them found channels
for (int ii = 1; ii < nn; ++ii) {
Expand Down
2 changes: 1 addition & 1 deletion avsomr/ui/recognitionproccessdialog.h
Expand Up @@ -53,7 +53,7 @@ class RecognitionProccessDialog : private QProgressDialog
IAvsOmrRecognizer::Step _lastStep;

QTimer _updater;
QTime _time;
QElapsedTimer _time;
QPushButton* _closeBtn{ nullptr };
TaskbarProgress* _taskbarProgress{ nullptr };
};
Expand Down
2 changes: 1 addition & 1 deletion awl/aslider.cpp
Expand Up @@ -128,7 +128,7 @@ void AbstractSlider::wheelEvent(QWheelEvent* ev)
if (ev->modifiers() & Qt::ShiftModifier) {
div = 15;
}
_value += (ev->delta() * lineStep()) / div;
_value += (ev->angleDelta().y() * lineStep()) / div;
if (_value < _minValue) {
_value = _minValue;
} else if (_value > _maxValue) {
Expand Down
7 changes: 6 additions & 1 deletion awl/pitchlabel.cpp
Expand Up @@ -57,8 +57,13 @@ QSize PitchLabel::sizeHint() const
QFontMetrics fm(font());
int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
int h = fm.height() + fw * 2;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// int w = 2 + fm.horizontalAdvance(QString("A#8")) + fw * 4;
int w = 2 + fm.horizontalAdvance(QString("-9999")) + fw * 4; // must display 14Bit controller values
#else
// int w = 2 + fm.width(QString("A#8")) + fw * 4;
int w = 2 + fm.width(QString("-9999")) + fw * 4; // must display 14Bit controller values
#endif
return QSize(w, h).expandedTo(QApplication::globalStrut());
}

Expand All @@ -76,7 +81,7 @@ void PitchLabel::setValue(int val)
if (_pitchMode) {
s = pitch2string(_value);
} else {
s.sprintf("%d", _value);
s = QString::asprintf("%d", _value);
}
setText(s);
}
Expand Down
12 changes: 10 additions & 2 deletions awl/poslabel.cpp
Expand Up @@ -68,11 +68,19 @@ QSize PosLabel::sizeHint() const
int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
int h = fm.height() + fw * 2;
int w;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
if (_smpte) {
w = 2 + fm.horizontalAdvance('9') * 9 + fm.horizontalAdvance(':') * 3 + fw * 4;
} else {
w = 2 + fm.horizontalAdvance('9') * 9 + fm.horizontalAdvance('.') * 2 + fw * 4;
}
#else
if (_smpte) {
w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4;
} else {
w = 2 + fm.width('9') * 9 + fm.width('.') * 2 + fw * 4;
}
#endif
return QSize(w, h).expandedTo(QApplication::globalStrut());
}

Expand All @@ -89,11 +97,11 @@ void PosLabel::updateValue()
if (_smpte) {
int min, sec, frame, subframe;
pos.msf(&min, &sec, &frame, &subframe);
s.sprintf("%03d:%02d:%02d:%02d", min, sec, frame, subframe);
s = QString::asprintf("%03d:%02d:%02d:%02d", min, sec, frame, subframe);
} else {
int measure, beat, tick;
pos.mbt(&measure, &beat, &tick);
s.sprintf("%04d.%02d.%03u", measure + 1, beat + 1, tick);
s = QString::asprintf("%04d.%02d.%03u", measure + 1, beat + 1, tick);
}
setText(s);
}
Expand Down
2 changes: 1 addition & 1 deletion awl/utils.cpp
Expand Up @@ -60,7 +60,7 @@ QString pitch2string(int v)
}
int octave = (v / 12) - 1;
QString o;
o.sprintf("%d", octave);
o = QString::asprintf("%d", octave);
int i = v % 12;
return qApp->translate("awlutils", octave < 0 ? valu[i] : vall[i]) + o;
}
Expand Down
2 changes: 1 addition & 1 deletion framework/telemetry/CMakeLists.txt
Expand Up @@ -43,6 +43,6 @@ target_link_libraries(${MODULE} global google_analytics)

if (MSVC)
set_target_properties (${MODULE} PROPERTIES
COMPILE_FLAGS "/wd4127"
COMPILE_FLAGS "/wd4127 /wd26439 /wd5999" # ToDo for Qt 5.15: "... /wd26444 /wd26451 /wd26495 /wd26498 /wd26812" ??
)
endif (MSVC)
1 change: 1 addition & 0 deletions framework/telemetry/widgets/telemetrypermissiondialog.cpp
Expand Up @@ -35,6 +35,7 @@ TelemetryPermissionDialog::TelemetryPermissionDialog(QQmlEngine* engine)

setFlags(Qt::Dialog | Qt::CustomizeWindowHint); ///@note Hidding a native frame with 'X' close button

// ToDo for Qt 5.15: QDesktopWidget::availableGeometry() vs. QGuiApplication::screens() ??
QRect desktopRect = QApplication::desktop()->availableGeometry();
QPoint center = desktopRect.center();

Expand Down
2 changes: 1 addition & 1 deletion global/gui/miconengine.cpp
Expand Up @@ -221,7 +221,7 @@ QPixmap MIconEngine::pixmap(const QSize& size, QIcon::Mode mode, QIcon::State st
QString pmckey(d->pmcKey(size, mode, state));
pmckey.prepend("Ms");

if (QPixmapCache::find(pmckey, pm)) {
if (QPixmapCache::find(pmckey, &pm)) {
return pm;
}

Expand Down
2 changes: 1 addition & 1 deletion importexport/bww/parser.cpp
Expand Up @@ -215,7 +215,7 @@ static void determineTimesig(QList<Bww::MeasureDescription> const& measures, int
QMap<int, int>::const_iterator i = map.constBegin();
while (i != map.constEnd())
{
qDebug() << "measureDurations:" << i.key() << i.value() << endl;
qDebug() << "measureDurations:" << i.key() << i.value();
if (i.value() > max) {
commonDur = i.key();
max = i.value();
Expand Down
4 changes: 4 additions & 0 deletions importexport/guitarpro/importgtp-gp6.cpp
Expand Up @@ -2378,7 +2378,11 @@ void GuitarPro6::readMasterBars(GPPartInfo* partInfo)
currentFermata = currentFermata.nextSibling();

// get the fermata information and construct a gpFermata from them
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList fermataComponents = fermata.split("/", Qt::SkipEmptyParts);
#else
QStringList fermataComponents = fermata.split("/", QString::SkipEmptyParts);
#endif
GPFermata gpFermata;
gpFermata.index = fermataComponents.at(0).toInt();
gpFermata.timeDivision = fermataComponents.at(1).toInt();
Expand Down
5 changes: 5 additions & 0 deletions importexport/guitarpro/importgtp.cpp
Expand Up @@ -876,8 +876,13 @@ void GuitarPro::readLyrics()
QString lyrics = readWordPascalString();
lyrics.replace(QRegExp("\n"), " ");
lyrics.replace(QRegExp("\r"), " ");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
auto sl = lyrics.split(" ", Qt::KeepEmptyParts);
//gpLyrics.lyrics = lyrics.split(" ", Qt::KeepEmptyParts);
#else
auto sl = lyrics.split(" ", QString::KeepEmptyParts);
//gpLyrics.lyrics = lyrics.split(" ", QString::KeepEmptyParts);
#endif
for (auto& str : sl) {
/*while (str[0] == '-')
{
Expand Down
8 changes: 4 additions & 4 deletions importexport/midiimport/importmidi_chord.cpp
Expand Up @@ -108,9 +108,9 @@ ReducedFraction maxNoteLen(const std::pair<const ReducedFraction, MidiChord>& ch

void removeOverlappingNotes(QList<MidiNote>& notes)
{
QLinkedList<MidiNote> tempNotes;
std::list<MidiNote> tempNotes;
for (const auto& note: notes) {
tempNotes.append(note);
tempNotes.push_back(note);
}

for (auto noteIt1 = tempNotes.begin(); noteIt1 != tempNotes.end(); ++noteIt1) {
Expand Down Expand Up @@ -430,7 +430,7 @@ void sortNotesByPitch(std::multimap<ReducedFraction, MidiChord>& chords)
for (auto& chordEvent: chords) {
// in each chord sort notes by pitches
auto& notes = chordEvent.second.notes;
qSort(notes.begin(), notes.end(), pitchSort);
std::sort(notes.begin(), notes.end(), pitchSort);
}
}

Expand All @@ -446,7 +446,7 @@ void sortNotesByLength(std::multimap<ReducedFraction, MidiChord>& chords)
for (auto& chordEvent: chords) {
// in each chord sort notes by lengths
auto& notes = chordEvent.second.notes;
qSort(notes.begin(), notes.end(), lenSort);
std::sort(notes.begin(), notes.end(), lenSort);
}
}

Expand Down
2 changes: 1 addition & 1 deletion importexport/midiimport/importmidi_model.cpp
Expand Up @@ -1124,7 +1124,7 @@ Qt::ItemFlags TracksModel::editableFlags(int row, int col) const
Qt::ItemFlags TracksModel::flags(const QModelIndex& index) const
{
if (!index.isValid()) {
return 0;
return {};
}

Qt::ItemFlags flags = Qt::ItemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
Expand Down
4 changes: 4 additions & 0 deletions importexport/musedata/musedata.cpp
Expand Up @@ -47,7 +47,11 @@ namespace Ms {

void MuseData::musicalAttribute(QString s, Part* part)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList al = s.mid(3).split(" ", Qt::SkipEmptyParts);
#else
QStringList al = s.mid(3).split(" ", QString::SkipEmptyParts);
#endif
foreach (QString item, al) {
if (item.startsWith("K:")) {
int key = item.mid(2).toInt();
Expand Down
6 changes: 5 additions & 1 deletion importexport/musicxml/importmxmlpass2.cpp
Expand Up @@ -932,7 +932,7 @@ static void handleTupletStop(Tuplet*& tuplet, const int normalNotes)
//---------------------------------------------------------

static void setElementPropertyFlags(ScoreElement* element, const Pid propertyId,
const QString value1, const QString value2 = QString::null)
const QString value1, const QString value2 = QString())
{
if (value1.isEmpty()) { // Set as an implicit value
element->setPropertyFlags(propertyId, PropertyFlags::STYLED);
Expand Down Expand Up @@ -3389,7 +3389,11 @@ void MusicXMLParserPass2::doEnding(const QString& partId, Measure* measure,
} else if (type.isEmpty()) {
_logger->logError("empty ending type", &_e);
} else {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = number.split(",", Qt::SkipEmptyParts);
#else
QStringList sl = number.split(",", QString::SkipEmptyParts);
#endif
QList<int> iEndingNumbers;
bool unsupported = false;
foreach (const QString& s, sl) {
Expand Down
4 changes: 2 additions & 2 deletions importexport/musicxml/importxml.cpp
Expand Up @@ -183,8 +183,8 @@ static bool extractRootfile(QFile* qf, QByteArray& data)

static Score::FileError doValidate(const QString& name, QIODevice* dev)
{
QTime t;
t.start();
//QElapsedTimer t;
//t.start();

// initialize the schema
ValidatorMessageHandler messageHandler;
Expand Down
10 changes: 9 additions & 1 deletion importexport/ove/ove.cpp
Expand Up @@ -3589,7 +3589,11 @@ QString NumericEnding::getText() const
QList<int> NumericEnding::getNumbers() const
{
int i;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList strs = text_.split(",", Qt::SkipEmptyParts);
#else
QStringList strs = text_.split(",", QString::SkipEmptyParts);
#endif
QList<int> endings;

for (i = 0; i < strs.size(); ++i) {
Expand Down Expand Up @@ -9487,7 +9491,11 @@ void LyricChunkParse::processLyricInfo(const LyricInfo& info)
bool changeMeasure = true;
MeasureData* measureData = 0;
int trackMeasureCount = ove_->getTrackBarCount();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList words = info.lyric_.split(" ", Qt::SkipEmptyParts);
#else
QStringList words = info.lyric_.split(" ", QString::SkipEmptyParts);
#endif

while (index < words.size() && measureId + 1 < trackMeasureCount) {
if (changeMeasure) {
Expand Down Expand Up @@ -9881,7 +9889,7 @@ void OveOrganizer::organizeContainers(int /*part*/, int /*track*/,
}

// shift voices
qSort(voices.begin(), voices.end());
std::sort(voices.begin(), voices.end());

for (i = 0; i < voices.size(); ++i) {
int voice = voices[i];
Expand Down
1 change: 1 addition & 0 deletions inspectors/models/inspectorlistmodel.cpp
Expand Up @@ -119,6 +119,7 @@ void InspectorListModel::removeUnusedModels(const QSet<Ms::ElementType>& newElem
continue;
}

// ToDo for Qt 5.15: QListMs::ElementType::toSet vs. QSet(list.begin(), list.end())
QSet<Ms::ElementType> supportedElementTypes = AbstractInspectorModel::supportedElementTypesBySectionType(model->sectionType()).toSet();

supportedElementTypes.intersect(newElementTypeSet);
Expand Down
4 changes: 4 additions & 0 deletions inspectors/utils/doubleinputvalidator.cpp
Expand Up @@ -22,7 +22,11 @@ void DoubleInputValidator::fixup(QString& string) const
if (string.endsWith("."))
string.append(zeros(m_decimal));

#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList strList = string.split(".", Qt::SkipEmptyParts);
#else
QStringList strList = string.split(".", QString::SkipEmptyParts);
#endif

QString intPart = strList.at(0);
QString floatPart = strList.at(1);
Expand Down
4 changes: 4 additions & 0 deletions inspectors/view/ui/inspectorBase.cpp
Expand Up @@ -124,7 +124,11 @@ QVariant InspectorBase::getValue(const InspectorItem& ii) const
v = QVariant::fromValue<Direction>(Direction(v.toInt()));
break;
case P_TYPE::INT_LIST: {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = v.toString().split(",", Qt::SkipEmptyParts);
#else
QStringList sl = v.toString().split(",", QString::SkipEmptyParts);
#endif
QList<int> il;
for (const QString& l : sl) {
int i = l.simplified().toInt();
Expand Down
32 changes: 0 additions & 32 deletions inspectors/view/ui/inspector_ambitus.ui
Expand Up @@ -878,22 +878,6 @@
</tabstops>
<resources/>
<connections>
<connection>
<sender>hasLine</sender>
<signal>toggled(bool)</signal>
<receiver>label_10</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>44</x>
<y>137</y>
</hint>
<hint type="destinationlabel">
<x>50</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>hasLine</sender>
<signal>toggled(bool)</signal>
Expand All @@ -910,21 +894,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>hasLine</sender>
<signal>toggled(bool)</signal>
<receiver>resetLineWidth</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>163</x>
<y>134</y>
</hint>
<hint type="destinationlabel">
<x>242</x>
<y>152</y>
</hint>
</hints>
</connection>
</connections>
</ui>
32 changes: 0 additions & 32 deletions inspectors/view/ui/inspector_fermata.ui
Expand Up @@ -208,22 +208,6 @@
</tabstops>
<resources/>
<connections>
<connection>
<sender>playArticulation</sender>
<signal>toggled(bool)</signal>
<receiver>label_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>40</x>
<y>91</y>
</hint>
<hint type="destinationlabel">
<x>44</x>
<y>108</y>
</hint>
</hints>
</connection>
<connection>
<sender>playArticulation</sender>
<signal>toggled(bool)</signal>
Expand All @@ -240,21 +224,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>playArticulation</sender>
<signal>toggled(bool)</signal>
<receiver>resetTimeStretch</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>157</x>
<y>89</y>
</hint>
<hint type="destinationlabel">
<x>178</x>
<y>106</y>
</hint>
</hints>
</connection>
</connections>
</ui>