Make Qt 5.15.0 the minimum requirement

and remove all conditions checking for Qt versions
This commit is contained in:
Joachim Schmitz 2020-10-03 16:44:02 +02:00 committed by Igor Korsukov
parent 8da9191281
commit 484f8dce06
53 changed files with 53 additions and 347 deletions

View file

@ -80,11 +80,7 @@ endif (BUILD_WEBENGINE)
set(SCRIPT_INTERFACE TRUE)
# Look for Qt5
if (SCRIPT_INTERFACE)
SET(QT_MIN_VERSION "5.8.0")
else (SCRIPT_INTERFACE)
SET(QT_MIN_VERSION "5.7.0")
endif (SCRIPT_INTERFACE)
SET(QT_MIN_VERSION "5.15.0")
# Include modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build" ${CMAKE_MODULE_PATH})
include (FindQt5)

View file

@ -57,13 +57,8 @@ 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());
}

View file

@ -68,19 +68,11 @@ 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());
}

View file

@ -63,11 +63,7 @@ void QmlDialog::componentComplete()
if (m_content) {
QQmlEngine* engine = nullptr;
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
engine = framework::ioc()->resolve<framework::IUiEngine>("appshell")->qmlEngine();
#else
engine = m_content->engine();
#endif
m_view = new QQuickView(engine, nullptr);
m_view->setResizeMode(QQuickView::SizeRootObjectToView);

View file

@ -27,11 +27,7 @@ void DoubleInputValidator::fixup(QString& string) const
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);

View file

@ -29,11 +29,7 @@ HChord::HChord(const QString& str)
{ "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" }
};
keys = 0;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = str.split(" ", Qt::SkipEmptyParts);
#else
QStringList sl = str.split(" ", QString::SkipEmptyParts);
#endif
for (const QString& s : sl) {
for (int i = 0; i < 12; ++i) {
if (s == scaleNames[0][i] || s == scaleNames[1][i]) {
@ -320,18 +316,10 @@ void HChord::add(const QList<HDegree>& degreeList)
static void readRenderList(QString val, QList<RenderAction>& renderList)
{
renderList.clear();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = val.split(" ", Qt::SkipEmptyParts);
#else
QStringList sl = val.split(" ", QString::SkipEmptyParts);
#endif
for (const QString& s : sl) {
if (s.startsWith("m:")) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList ssl = s.split(":", Qt::SkipEmptyParts);
#else
QStringList ssl = s.split(":", QString::SkipEmptyParts);
#endif
if (ssl.size() == 3) {
// m:x:y
RenderAction a;

View file

@ -1389,11 +1389,7 @@ void FiguredBass::endEdit(EditData& ed)
}
// split text into lines and create an item for each line
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList list = txt.split("\n", Qt::SkipEmptyParts);
#else
QStringList list = txt.split('\n', QString::SkipEmptyParts);
#endif
qDeleteAll(items);
items.clear();
QString normalizedText = QString();

View file

@ -2103,11 +2103,7 @@ QString Harmony::generateScreenReaderInfo() const
aux = aux.replace("#", QObject::tr("")).replace("<", "");
QString extension = "";
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
for (QString s : aux.split(">", Qt::SkipEmptyParts)) {
#else
for (QString s : aux.split(">", QString::SkipEmptyParts)) {
#endif
if (!s.contains("blues")) {
s.replace("b", QObject::tr(""));
}

View file

@ -402,11 +402,7 @@ void Lyrics::paste(EditData& ed)
#endif
QString txt = QApplication::clipboard()->text(mode);
QString regex = QString("[^\\S") + QChar(0xa0) + QChar(0x202F) + "]+";
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = txt.split(QRegExp(regex), Qt::SkipEmptyParts);
#else
QStringList sl = txt.split(QRegExp(regex), QString::SkipEmptyParts);
#endif
if (sl.empty()) {
return;
}

View file

@ -396,20 +396,6 @@ void MScore::init()
}
}
#endif
// Workaround for QTBUG-73241 (solved in Qt 5.12.2) in Windows 10, see https://musescore.org/en/node/280244
#if defined(Q_OS_WIN) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
if (QOperatingSystemVersion::current().majorVersion() >= 10) {
const QDir additionalFontsDir(QString("%1/Microsoft/Windows/Fonts").arg(QStandardPaths::writableLocation(QStandardPaths::
GenericDataLocation)));
if (additionalFontsDir.exists()) {
QFileInfoList fileList = additionalFontsDir.entryInfoList();
for (int i = 0; i < fileList.size(); ++i) {
QFileInfo fileInfo = fileList.at(i);
QFontDatabase::addApplicationFont(fileInfo.filePath());
}
}
}
#endif
initScoreFonts();
StaffType::initStaffTypes();

View file

@ -356,17 +356,10 @@ QString Page::replaceTextMacros(const QString& s) const
case 'D':
{
QString creationDate = score()->metaTag("creationDate");
if (creationDate.isNull())
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
{ // ToDo for Qt 5.15: Qt::DefaultLocaleShortDate vs. QLocale ??
if (creationDate.isNull()) {
// ToDo for Qt 5.15: Qt::DefaultLocaleShortDate vs. QLocale ??
d += masterScore()->fileInfo()->birthTime().date().toString(Qt::DefaultLocaleShortDate);
}
#else
{
d += masterScore()->fileInfo()->created().date().toString(Qt::DefaultLocaleShortDate);
}
#endif
else {
} else {
// ToDo for Qt 5.15: Qt::DefaultLocaleShortDate vs. QLocale ??
d += QDate::fromString(creationDate, Qt::ISODate).toString(Qt::DefaultLocaleShortDate);
}

View file

@ -1303,11 +1303,7 @@ static void readVolta114(XmlReader& e, Volta* volta)
const QStringRef& tag(e.name());
if (tag == "endings") {
QString s = e.readElementText();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = s.split(",", Qt::SkipEmptyParts);
#else
QStringList sl = s.split(",", QString::SkipEmptyParts);
#endif
volta->endings().clear();
for (const QString& l : sl) {
int i = l.simplified().toInt();

View file

@ -2435,11 +2435,7 @@ static void readVolta206(XmlReader& e, Volta* volta)
const QStringRef& tag(e.name());
if (tag == "endings") {
QString s = e.readElementText();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = s.split(",", Qt::SkipEmptyParts);
#else
QStringList sl = s.split(",", QString::SkipEmptyParts);
#endif
volta->endings().clear();
for (const QString& l : sl) {
int i = l.simplified().toInt();

View file

@ -127,17 +127,10 @@ std::vector<TextDiff> MscxModeDiff::lineModeDiff(const QString& s1, const QStrin
typedef std::pair<elem, dtl::elemInfo> sesElem;
typedef std::vector<sesElem> sesElemVec;
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
const QVector<QStringRef> linesVec1 = s1.splitRef('\n');
std::vector<QStringRef> lines1(linesVec1.begin(), linesVec1.end());
const QVector<QStringRef> linesVec2 = s2.splitRef('\n');
std::vector<QStringRef> lines2(linesVec2.begin(), linesVec2.end());
#else
// QVector does not contain range constructor used inside dtl
// so we have to convert to std::vector.
std::vector<QStringRef> lines1 = s1.splitRef('\n').toStdVector();
std::vector<QStringRef> lines2 = s2.splitRef('\n').toStdVector();
#endif
dtl::Diff<QStringRef, std::vector<QStringRef> > diff(lines1, lines2);
diff.compose();

View file

@ -157,11 +157,7 @@ void Staff::swapBracket(int oldIdx, int newIdx)
fillBrackets(idx);
_brackets[oldIdx]->setColumn(newIdx);
_brackets[newIdx]->setColumn(oldIdx);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
_brackets.swapItemsAt(oldIdx, newIdx);
#else
_brackets.swap(oldIdx, newIdx);
#endif
cleanBrackets();
}
@ -179,11 +175,7 @@ void Staff::changeBracketColumn(int oldColumn, int newColumn)
int newIdx = i + step;
_brackets[oldIdx]->setColumn(newIdx);
_brackets[newIdx]->setColumn(oldIdx);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
_brackets.swapItemsAt(oldIdx, newIdx);
#else
_brackets.swap(oldIdx, newIdx);
#endif
}
cleanBrackets();
}

View file

@ -2067,11 +2067,7 @@ void RemoveExcerpt::redo(EditData*)
void SwapExcerpt::flip(EditData*)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
score->excerpts().swapItemsAt(pos1, pos2);
#else
score->excerpts().swap(pos1, pos2);
#endif
score->setExcerptsChanged(true);
}

View file

@ -145,11 +145,7 @@ void Volta::read(XmlReader& e)
const QStringRef& tag(e.name());
if (tag == "endings") {
QString s = e.readElementText();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList sl = s.split(",", Qt::SkipEmptyParts);
#else
QStringList sl = s.split(",", QString::SkipEmptyParts);
#endif
_endings.clear();
for (const QString& l : sl) {
int i = l.simplified().toInt();

View file

@ -14,11 +14,6 @@
#include "property.h"
#include "scoreElement.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
#define endl Qt::endl
#define dec Qt::dec
#endif
namespace Ms {
//---------------------------------------------------------
// Xml
@ -78,7 +73,7 @@ void XmlWriter::header()
void XmlWriter::stag(const QString& s)
{
putLevel();
*this << '<' << s << '>' << endl;
*this << '<' << s << '>' << Qt::endl;
stack.append(s.split(' ')[0]);
}
@ -104,7 +99,7 @@ void XmlWriter::stag(const QString& name, const ScoreElement* se, const QString&
if (!attributes.isEmpty()) {
*this << ' ' << attributes;
}
*this << '>' << endl;
*this << '>' << Qt::endl;
stack.append(name);
if (_recordElements) {
@ -120,7 +115,7 @@ void XmlWriter::stag(const QString& name, const ScoreElement* se, const QString&
void XmlWriter::etag()
{
putLevel();
*this << "</" << stack.takeLast() << '>' << endl;
*this << "</" << stack.takeLast() << '>' << Qt::endl;
}
//---------------------------------------------------------
@ -138,7 +133,7 @@ void XmlWriter::tagE(const char* format, ...)
vsnprintf(buffer, BS, format, args);
*this << buffer;
va_end(args);
*this << "/>" << endl;
*this << "/>" << Qt::endl;
}
//---------------------------------------------------------
@ -169,7 +164,7 @@ void XmlWriter::ntag(const char* name)
void XmlWriter::netag(const char* s)
{
*this << "</" << s << '>' << endl;
*this << "</" << s << '>' << Qt::endl;
}
//---------------------------------------------------------
@ -325,7 +320,7 @@ void XmlWriter::tag(const char* name, const QWidget* g)
void XmlWriter::comment(const QString& text)
{
putLevel();
*this << "<!-- " << text << " -->" << endl;
*this << "<!-- " << text << " -->" << Qt::endl;
}
//---------------------------------------------------------
@ -381,7 +376,7 @@ void XmlWriter::dump(int len, const unsigned char* p)
for (int i = 0; i < len; ++i, ++col) {
if (col >= 16) {
setFieldWidth(0);
*this << endl;
*this << Qt::endl;
col = 0;
putLevel();
setFieldWidth(5);
@ -389,7 +384,7 @@ void XmlWriter::dump(int len, const unsigned char* p)
*this << (p[i] & 0xff);
}
if (col) {
*this << endl << dec;
*this << Qt::endl << Qt::dec;
}
setFieldWidth(0);
setIntegerBase(10);

View file

@ -415,17 +415,8 @@ void ChordView::wheelEvent(QWheelEvent* event)
emit xposChanged(xpos);
}
} else if (event->modifiers() == Qt::ShiftModifier) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
QWheelEvent we(event->position(), event->globalPosition(), event->pixelDelta(), event->angleDelta(),
event->buttons(), event->modifiers(), event->phase(), event->inverted(), event->source());
# else
QWheelEvent we(event->pos(), event->globalPos(), event->pixelDelta(), event->angleDelta(), event->buttons(),
event->modifiers(), event->phase(), event->inverted(), event->source());
# endif
#else
QWheelEvent we(event->pos(), event->delta(), event->buttons(), 0, Qt::Horizontal);
#endif
QGraphicsView::wheelEvent(&we);
} else if (event->modifiers() == 0) {
QGraphicsView::wheelEvent(event);

View file

@ -101,11 +101,7 @@ void UploadScoreDialog::upload(int nid)
{
Score* score = mscore->currentScore()->masterScore();
const QString scoreTitle = title->text().trimmed().isEmpty() ? score->title() : title->text();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QString path = QDir::tempPath() + QString("/temp_%1.mscz").arg(QRandomGenerator::global()->generate() % 100000);
#else
QString path = QDir::tempPath() + QString("/temp_%1.mscz").arg(qrand() % 100000);
#endif
if (mscore->saveAs(score, true, path, "mscz")) {
_nid = nid;
_loginManager->upload(path, nid, scoreTitle);

View file

@ -1873,11 +1873,7 @@ QSize DoubleLabel::sizeHint() const
QFontMetrics fm = fontMetrics();
int h = fm.height() + 4;
int n = 3 + 3;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int w = fm.horizontalAdvance(QString("-0.")) + fm.horizontalAdvance('0') * n + 6;
#else
int w = fm.width(QString("-0.")) + fm.width('0') * n + 6;
#endif
return QSize(w, h);
}

View file

@ -417,17 +417,8 @@ void DrumView::wheelEvent(QWheelEvent* event)
emit xposChanged(xpos);
}
} else if (event->modifiers() == Qt::ShiftModifier) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
QWheelEvent we(event->position(), event->globalPosition(), event->pixelDelta(), event->angleDelta(),
event->buttons(), event->modifiers(), event->phase(), event->inverted(), event->source());
# else
QWheelEvent we(event->pos(), event->globalPos(), event->pixelDelta(), event->angleDelta(), event->buttons(),
event->modifiers(), event->phase(), event->inverted(), event->source());
# endif
#else
QWheelEvent we(event->pos(), event->delta(), event->buttons(), 0, Qt::Horizontal);
#endif
QGraphicsView::wheelEvent(&we);
} else if (event->modifiers() == 0) {
QGraphicsView::wheelEvent(event);

View file

@ -179,11 +179,7 @@ void ScoreView::wheelEvent(QWheelEvent* event)
if (event->modifiers() & Qt::ControlModifier) { // Windows touch pad pinches also execute this
QApplication::sendPostedEvents(this, 0);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
zoomStep(nReal, event->position().toPoint());
#else
zoomStep(nReal, event->pos());
#endif
return;
}

View file

@ -378,10 +378,8 @@ void ScoreView::fotoContextPopup(QContextMenuEvent* ev)
tr("Set output resolution for PNG"),
preferences.getDouble(PREF_EXPORT_PNG_RESOLUTION),
16.0, 2400.0, 1,
&ok
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
, {}, 1.0
#endif
&ok,
{}, 1.0
);
if (ok) {
preferences.setPreference(PREF_EXPORT_PNG_RESOLUTION, resolution);

View file

@ -298,11 +298,7 @@ void OperationsDelegate::drawArrow(
const int height = 4;
const int width = 8;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
const int textWidth = fm.horizontalAdvance(index.data(Qt::DisplayRole).toString());
#else
const int textWidth = fm.width(index.data(Qt::DisplayRole).toString());
#endif
const int x = rightArrowAlign
? option.rect.right() - width - gap
: option.rect.left() + textWidth + gap;

View file

@ -156,11 +156,7 @@ void ImportMidiPanel::fillCharsetList()
if (charset == MidiCharset::defaultCharset()) {
_ui->comboBoxCharset->setCurrentIndex(idx);
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int newWidth = fm.horizontalAdvance(charset);
#else
int newWidth = fm.width(charset);
#endif
if (newWidth > maxWidth) {
maxWidth = newWidth;
}

View file

@ -191,10 +191,6 @@ Q_LOGGING_CATEGORY(undoRedo, "undoRedo", QtCriticalMsg);
#include "telemetrymanager.h"
#include "global/context/scorestateobserver.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
# define endl Qt::endl
#endif
namespace Ms {
MuseScore* mscore;
MasterSynthesizer* synti;
@ -3643,10 +3639,10 @@ bool MuseScore::runTestScripts(const QStringList& scriptFiles)
while (!scores().empty()) {
closeScore(scores().back());
}
QTextStream(stdout) << "Start test: " << scriptFile << endl;
QTextStream(stdout) << "Start test: " << scriptFile << Qt::endl;
std::unique_ptr<Script> script = Script::fromFile(scriptFile);
const bool pass = script->execute(ctx);
QTextStream(stdout) << "Test " << scriptFile << (pass ? " PASS" : " FAIL") << endl;
QTextStream(stdout) << "Test " << scriptFile << (pass ? " PASS" : " FAIL") << Qt::endl;
++total;
if (pass) {
++passed;
@ -3654,7 +3650,7 @@ bool MuseScore::runTestScripts(const QStringList& scriptFiles)
allPassed = false;
}
}
QTextStream(stdout) << "Test scripts: total: " << total << ", passed: " << passed << endl;
QTextStream(stdout) << "Test scripts: total: " << total << ", passed: " << passed << Qt::endl;
return allPassed;
}
@ -4204,10 +4200,10 @@ static bool processNonGui(const QStringList& argv)
ScoreDiff diff(s1, s2, /* textDiffOnly */ !diffMode);
if (rawDiffMode) {
QTextStream(stdout) << diff.rawDiff() << endl;
QTextStream(stdout) << diff.rawDiff() << Qt::endl;
}
if (diffMode) {
QTextStream(stdout) << diff.userDiff() << endl;
QTextStream(stdout) << diff.userDiff() << Qt::endl;
}
delete s1;
@ -4234,23 +4230,23 @@ static void mscoreMessageHandler(QtMsgType type, const QMessageLogContext& conte
switch (type) {
case QtInfoMsg:
err << "Info: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", "
<< context.function << ")" << endl;
<< context.function << ")" << Qt::endl;
break;
case QtDebugMsg:
err << "Debug: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", "
<< context.function << ")" << endl;
<< context.function << ")" << Qt::endl;
break;
case QtWarningMsg:
err << "Warning: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", "
<< context.function << ")" << endl;
<< context.function << ")" << Qt::endl;
break;
case QtCriticalMsg: // same as QtSystemMsg
err << "Critical: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", "
<< context.function << ")" << endl;
<< context.function << ")" << Qt::endl;
break;
case QtFatalMsg: // set your breakpoint here, if you want to catch the abort
err << "Fatal: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", "
<< context.function << ")" << endl;
<< context.function << ")" << Qt::endl;
abort();
}
}

View file

@ -365,11 +365,7 @@ void Navigator::paintEvent(QPaintEvent* ev)
QFont font("FreeSans", 4000);
QFontMetrics fm(font);
Page* firstPage = _score->pages()[0];
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
qreal factor = (firstPage->width() * 0.5) / fm.horizontalAdvance(QString::number(_score->pages().size()));
#else
qreal factor = (firstPage->width() * 0.5) / fm.width(QString::number(_score->pages().size()));
#endif
font.setPointSizeF(font.pointSizeF() * factor);
p.setTransform(matrix);

View file

@ -582,32 +582,15 @@ void PianoView::wheelEvent(QWheelEvent* event)
QGraphicsView::wheelEvent(event);
} else if (event->modifiers() == Qt::ShiftModifier) {
//Horizontal scroll
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
QWheelEvent we(event->position(), event->globalPosition(), event->pixelDelta(), event->angleDelta(),
event->buttons(), event->modifiers(), event->phase(), event->inverted(), event->source());
# else
QWheelEvent we(event->pos(), event->globalPos(), event->pixelDelta(), event->angleDelta(), event->buttons(),
event->modifiers(), event->phase(), event->inverted(), event->source());
# endif
#else
QWheelEvent we(event->pos(), event->delta(), event->buttons(), 0, Qt::Horizontal);
#endif
QGraphicsView::wheelEvent(&we);
} else if (event->modifiers() == Qt::ControlModifier) {
//Vertical zoom
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
zoomView(step, false, event->position().x(), event->position().y());
#else
zoomView(step, false, event->x(), event->y());
#endif
} else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
//Horizontal zoom
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 1)) //???
zoomView(step, true, event->position().x(), event->position().y());
#else
zoomView(step, true, event->x(), event->y());
#endif
}
}

View file

@ -283,11 +283,7 @@ QStringList JSHighlighter::keywords() const
void JSHighlighter::setKeywords(const QStringList& keywords)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
m_keywords = QSet<QString>(keywords.begin(), keywords.end());
#else
m_keywords = QSet<QString>::fromList(keywords);
#endif
rehighlight();
}

View file

@ -42,11 +42,7 @@ class QmlNativeMenu : public QQuickItem
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
QQmlListProperty<QObject> contentData() { return QQmlListProperty<QObject>(this, &_contentData); } // TODO: use different QQmlListProperty constructor?
#else
QQmlListProperty<QObject> contentData() { return QQmlListProperty<QObject>(this, _contentData); } // TODO: use different QQmlListProperty constructor?
#endif
QMenu* createMenu() const;
void showMenu(QPoint p);

View file

@ -298,17 +298,6 @@ void QmlDockWidget::changeEvent(QEvent* evt)
case QEvent::StyleChange:
setupStyle();
break;
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
case QEvent::LanguageChange:
// In the absence of QQmlEngine::retranslate() function, just
// reload the entire QML view. Qt 5.10 and above seem to
// handle retranslation in Qt Quick itself so no explicit
// retranslation is required.
if (_view) {
_view->setSource(_view->source());
}
break;
#endif
default:
break;
}

View file

@ -52,11 +52,7 @@ void ScorePreview::setScore(const ScoreInfo& si)
{
scoreInfo = si;
name->setText(si.completeBaseName());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
creationDate->setText(si.birthTime().toString());
#else
creationDate->setText(si.created().toString());
#endif
fileSize->setText(QString("%1 KiB").arg(si.size() / 1024));
name->setEnabled(true);
creationDate->setEnabled(true);

View file

@ -19,10 +19,6 @@
#include "libmscore/score.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
#define endl Qt::endl
#endif
namespace Ms {
//---------------------------------------------------------
// ScriptContext
@ -59,7 +55,7 @@ bool Script::execute(ScriptContext& ctx) const
for (const auto& e : _entries) {
if (e) {
if (!e->execute(ctx)) {
ctx.execLog() << "Script::execute: operation failed:" << e->serialize() << endl;
ctx.execLog() << "Script::execute: operation failed:" << e->serialize() << Qt::endl;
if (ctx.stopOnError()) {
return false;
}
@ -147,7 +143,7 @@ void ScriptRecorder::syncRecord()
return;
}
for (; _recorded < _script.nentries(); ++_recorded) {
_stream << _script.entry(_recorded).serialize() << endl;
_stream << _script.entry(_recorded).serialize() << Qt::endl;
}
}

View file

@ -17,10 +17,6 @@
#include "libmscore/scorediff.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
#define endl Qt::endl
#endif
namespace Ms {
//---------------------------------------------------------
// TestScriptEntry::deserialize
@ -84,20 +80,20 @@ bool ScoreTestScriptEntry::execute(ScriptContext& ctx) const
{
MasterScore* curScore = ctx.mscore()->currentScore()->masterScore();
if (!curScore) {
ctx.execLog() << "ScoreTestScriptEntry: no current score" << endl;
ctx.execLog() << "ScoreTestScriptEntry: no current score" << Qt::endl;
return false;
}
QString refFilePath = ctx.absoluteFilePath(_refPath);
std::unique_ptr<MasterScore> refScore(ctx.mscore()->readScore(refFilePath));
if (!refScore) {
ctx.execLog() << "reference score loaded with errors: " << refFilePath << endl;
ctx.execLog() << "reference score loaded with errors: " << refFilePath << Qt::endl;
return false;
}
ScoreDiff diff(curScore, refScore.get(), /* textDiffOnly */ true);
if (!diff.equal()) {
ctx.execLog() << "ScoreTestScriptEntry: fail\n" << diff.rawDiff() << endl;
ctx.execLog() << "ScoreTestScriptEntry: fail\n" << diff.rawDiff() << Qt::endl;
return false;
}
return true;

View file

@ -4681,11 +4681,7 @@ QKeySequence Shortcut::keySeqFromString(const QString& str, QKeySequence::Sequen
code[i] = 0;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList strList = str.split(QRegularExpression("(?<!\\\\),|(?<=\\\\\\\\),"), Qt::SkipEmptyParts);
#else
QStringList strList = str.split(QRegularExpression("(?<!\\\\),|(?<=\\\\\\\\),"), QString::SkipEmptyParts);
#endif
//split based on commas that are not preceded by a single slash; two is okay
//original regex: (?<!\\),|(?<=\\\\),

View file

@ -45,10 +45,6 @@
#include "libmscore/imageStore.h"
#include "libmscore/mscore.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
#define endl Qt::endl
#endif
///////////////////////////////////////////////////////////////////////////////
// FOR GRADIENT FUNCTIONALITY THAT IS NOT IMPLEMENTED (YET):
//
@ -397,7 +393,7 @@ public:
//
// str << QLatin1String("id=\"") << d_func()->generateGradientName() << QLatin1String("\">\n");
// saveGradientStops(str, g);
// str << QLatin1String("</linearGradient>") <<endl;
// str << QLatin1String("</linearGradient>") << Qt::endl;
// }
// void saveRadialGradientBrush(const QGradient *g)
// {
@ -414,7 +410,7 @@ public:
// }
// str << QLatin1String("xml:id=\"") <<d_func()->generateGradientName()<< QLatin1String("\">\n");
// saveGradientStops(str, g);
// str << QLatin1String("</radialGradient>") << endl;
// str << QLatin1String("</radialGradient>") << Qt::endl;
// }
// void saveConicalGradientBrush(const QGradient *)
// {
@ -689,7 +685,7 @@ public:
// "font-size=\"" << d->attributes.font_size << "\" "
// "font-weight=\"" << d->attributes.font_weight << "\" "
// "font-style=\"" << d->attributes.font_style << "\" "
// << endl;
// << Qt::endl;
// }
///////////////////////////////////////////////////////////////////////////////
};
@ -1048,7 +1044,7 @@ bool SvgPaintEngine::begin(QPaintDevice*)
// Stream the headers
d->stream = new QTextStream(&d->header);
stream() << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" << endl << SVG_BEGIN;
stream() << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" << Qt::endl << SVG_BEGIN;
if (d->viewBox.isValid()) {
// viewBox has floating point values, size width/height is integer
stream() << SVG_WIDTH << d->viewBox.width() << SVG_PX << SVG_QUOTE
@ -1057,16 +1053,16 @@ bool SvgPaintEngine::begin(QPaintDevice*)
stream() << SVG_VIEW_BOX << d->viewBox.left()
<< SVG_SPACE << d->viewBox.top()
<< SVG_SPACE << d->viewBox.width()
<< SVG_SPACE << d->viewBox.height() << SVG_QUOTE << endl;
<< SVG_SPACE << d->viewBox.height() << SVG_QUOTE << Qt::endl;
}
stream() << " xmlns=\"http://www.w3.org/2000/svg\""
" xmlns:xlink=\"http://www.w3.org/1999/xlink\""
" version=\"1.2\" baseProfile=\"tiny\">" << endl;
" version=\"1.2\" baseProfile=\"tiny\">" << Qt::endl;
if (!d->attributes.title.isEmpty()) {
stream() << SVG_TITLE_BEGIN << d->attributes.title.toHtmlEscaped() << SVG_TITLE_END << endl;
stream() << SVG_TITLE_BEGIN << d->attributes.title.toHtmlEscaped() << SVG_TITLE_END << Qt::endl;
}
if (!d->attributes.description.isEmpty()) {
stream() << SVG_DESC_BEGIN << d->attributes.description.toHtmlEscaped() << SVG_DESC_END << endl;
stream() << SVG_DESC_BEGIN << d->attributes.description.toHtmlEscaped() << SVG_DESC_END << Qt::endl;
}
// <defs> is currently empty. It's necessary for gradients.
@ -1097,7 +1093,7 @@ bool SvgPaintEngine::end()
stream() << d->header;
// stream() << d->defs;
stream() << d->body;
stream() << SVG_END << endl;
stream() << SVG_END << Qt::endl;
delete d->stream;
return true;
@ -1157,7 +1153,7 @@ void SvgPaintEngine::writeImage(const QRectF& r, const QByteArray& imageData, co
<< SVG_PRESERVE_ASPECT << SVG_NONE << SVG_QUOTE;
stream() << " xlink:href=\"data:" << mimeFormat << ";base64,"
<< imageData.toBase64() << SVG_QUOTE << SVG_ELEMENT_END << endl;
<< imageData.toBase64() << SVG_QUOTE << SVG_ELEMENT_END << Qt::endl;
}
void SvgPaintEngine::updateState(const QPaintEngineState& s)
@ -1257,7 +1253,7 @@ void SvgPaintEngine::drawPath(const QPainterPath& p)
stream() << SVG_SPACE;
}
}
stream() << SVG_QUOTE << SVG_ELEMENT_END << endl;
stream() << SVG_QUOTE << SVG_ELEMENT_END << Qt::endl;
}
void SvgPaintEngine::drawPolygon(const QPointF* points, int pointCount,
@ -1280,7 +1276,7 @@ void SvgPaintEngine::drawPolygon(const QPointF* points, int pointCount,
stream() << SVG_SPACE;
}
}
stream() << SVG_QUOTE << SVG_ELEMENT_END << endl;
stream() << SVG_QUOTE << SVG_ELEMENT_END << Qt::endl;
} else {
path.closeSubpath();
drawPath(path);

View file

@ -20,9 +20,7 @@
#include <QWebEngineCookieStore>
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#define qrand() QRandomGenerator::global()->generate()
#endif
namespace Ms {
extern QString dataPath;
@ -47,12 +45,10 @@ QString ApiInfo::apiInfoLocation()
QByteArray ApiInfo::genClientId()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
QByteArray qtGeneratedId(QSysInfo::machineUniqueId());
if (!qtGeneratedId.isEmpty()) {
return qtGeneratedId;
}
#endif
long long randId = qrand();
constexpr size_t randBytes = sizeof(decltype(qrand()));
qDebug() << "randBytes =" << randBytes << "sizeof(randId)" << sizeof(randId);

View file

@ -2378,11 +2378,7 @@ 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();

View file

@ -877,13 +877,8 @@ 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] == '-')
{

View file

@ -47,11 +47,7 @@ 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();

View file

@ -3398,11 +3398,7 @@ 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) {

View file

@ -3589,11 +3589,7 @@ 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) {
@ -9491,11 +9487,7 @@ 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) {

View file

@ -204,11 +204,7 @@ void InstrumentListModel::unselectInstrument(const QString& id)
void InstrumentListModel::swapSelectedInstruments(int firstIndex, int secondIndex)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
m_selectedInstruments.swapItemsAt(firstIndex, secondIndex);
#else
m_selectedInstruments.swap(firstIndex, secondIndex);
#endif
emit selectedInstrumentsChanged();
}

View file

@ -1088,22 +1088,4 @@ bool PaletteWorkspace::read(XmlReader& e)
return true;
}
//---------------------------------------------------------
// PaletteWorkspace::needsItemDestructionAccessibilityWorkaround
/// Checks whether workaround for palette search crash
/// with NVDA is needed, see issue #298899.
//---------------------------------------------------------
bool PaletteWorkspace::needsItemDestructionAccessibilityWorkaround() const
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// Qt switched to a new accessibility backend since 5.11
// and no crashes are reported for 5.12 so presumably
// the workaround is not needed since Qt 5.11.
return false;
#else
return QAccessible::isActive();
#endif
}
} // namespace Ms

View file

@ -250,8 +250,6 @@ public:
Q_INVOKABLE bool savePalette(const QModelIndex&);
Q_INVOKABLE bool loadPalette(const QModelIndex&);
Q_INVOKABLE bool needsItemDestructionAccessibilityWorkaround() const;
bool paletteChanged() const { return userPalette->paletteTreeChanged(); }
void setUserPaletteTree(std::unique_ptr<PaletteTree> tree);

View file

@ -350,8 +350,7 @@ ListView {
property var modelIndex: paletteTree.model.modelIndex(index, 0)
Component.onDestruction: {
if (paletteTree.paletteWorkspace.needsItemDestructionAccessibilityWorkaround())
Utils.setInvisibleRecursive(this);
Utils.setInvisibleRecursive(this);
}
onActiveFocusChanged: {
@ -700,8 +699,7 @@ ListView {
paletteEditingEnabled: model.editable
Component.onDestruction: {
if (paletteTree.paletteWorkspace.needsItemDestructionAccessibilityWorkaround())
Utils.setInvisibleRecursive(this);
Utils.setInvisibleRecursive(this);
}
onVisibleChanged: {

View file

@ -344,7 +344,6 @@ void PluginAPI::registerQmlTypes()
qmlRegisterType<ScoreView>("MuseScore", 3, 0, "ScoreView");
qmlRegisterType<Cursor>("MuseScore", 3, 0, "Cursor");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
qmlRegisterAnonymousType<ScoreElement>("MuseScore", 3);
qmlRegisterAnonymousType<Score>("MuseScore", 3);
qmlRegisterAnonymousType<Element>("MuseScore", 3);
@ -360,23 +359,6 @@ void PluginAPI::registerQmlTypes()
//qmlRegisterAnonymousType<Stem>("MuseScore", 3);
//qmlRegisterAnonymousType<StemSlash>("MuseScore", 3);
//qmlRegisterAnonymousType<Beam>("MuseScore", 3);
#else
qmlRegisterType<ScoreElement>();
qmlRegisterType<Score>();
qmlRegisterType<Element>();
qmlRegisterType<Chord>();
qmlRegisterType<Note>();
qmlRegisterType<Segment>();
qmlRegisterType<Measure>();
qmlRegisterType<Part>();
qmlRegisterType<Excerpt>();
qmlRegisterType<Selection>();
qmlRegisterType<Tie>();
//qmlRegisterType<Hook>();
//qmlRegisterType<Stem>();
//qmlRegisterType<StemSlash>();
//qmlRegisterType<Beam>();
#endif
qmlRegisterType<PlayEvent>("MuseScore", 3, 0, "PlayEvent");
#if 0
@ -408,11 +390,7 @@ void PluginAPI::registerQmlTypes()
qmlRegisterType<SlurTie>();
qmlRegisterType<Spanner>();
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
qmlRegisterAnonymousType<FractionWrapper>("MuseScore", 3);
#else
qmlRegisterType<FractionWrapper>();
#endif
qRegisterMetaType<FractionWrapper*>("FractionWrapper*");
qmlTypesRegistered = true;

View file

@ -123,11 +123,7 @@ public:
public slots:
//@ --
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) //???
Q_INVOKABLE void start(const QString& program) { QProcess::start(program, {}, ReadWrite); }
#else
Q_INVOKABLE void start(const QString& program) { QProcess::start(program); }
#endif
//@ --
Q_INVOKABLE bool waitForFinished(int msecs = 30000) { return QProcess::waitForFinished(msecs); }
//@ --

View file

@ -176,11 +176,7 @@ QStringList PluginsModel::categories() const
result << plugin.category;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) // ??
return result.values();
#else
return result.toList();
#endif
}
void PluginsModel::updatePlugin(const PluginInfo& plugin)

View file

@ -31,11 +31,7 @@ void TemplatesModel::load()
QStringList TemplatesModel::categoriesTitles() const
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) // ??
return m_visibleCategoriesTitles.values();
#else
return m_visibleCategoriesTitles.toList();
#endif
}
QString TemplatesModel::currentTemplatePath() const

View file

@ -247,11 +247,18 @@ QString GAnalytics::Private::getSystemInfo()
case QSysInfo::MV_10_11:
os = "Macintosh; Mac OS 10.11";
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
case QSysInfo::MV_10_12:
os = "Macintosh; Mac OS 10.12";
break;
#endif
case QSysInfo::MV_10_13:
os = "Macintosh; Mac OS 10.13";
break;
case QSysInfo::MV_10_14:
os = "Macintosh; Mac OS 10.14";
break;
case QSysInfo::MV_10_15:
os = "Macintosh; Mac OS 10.15";
break;
case QSysInfo::MV_Unknown:
os = "Macintosh; Mac OS unknown";
break;
@ -291,7 +298,6 @@ QString GAnalytics::Private::getSystemInfo()
case QSysInfo::MV_IOS_9_0:
os = "iPhone; iOS 9.0";
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
case QSysInfo::MV_IOS_9_1:
os = "iPhone; iOS 9.1";
break;
@ -304,7 +310,6 @@ QString GAnalytics::Private::getSystemInfo()
case QSysInfo::MV_IOS_10_0:
os = "iPhone; iOS 10.0";
break;
#endif
case QSysInfo::MV_IOS:
os = "iPhone; iOS unknown";
break;

View file

@ -118,7 +118,7 @@ bool QtLocalPeer::isClient()
return true;
bool res = server->listen(socketName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
#if defined(Q_OS_UNIX)
// ### Workaround
if (!res && server->serverError() == QAbstractSocket::AddressInUseError) {
QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);