From ffecc00f42f2e02f76cf616d03d179e8741f4fba Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 26 Oct 2020 07:27:47 -0700 Subject: cleanup: SkipEmptyParts syntax has changed Sadly, the new enum has only been available since Qt 5.14, so this is a rather ugly replacement. Signed-off-by: Dirk Hohndel --- desktop-widgets/simplewidgets.cpp | 8 +++++++- desktop-widgets/tagwidget.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 943da56c3..135326ecf 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -629,6 +629,12 @@ QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor) return stringMeetsOurUrlRequirements(maybeUrlStr) ? maybeUrlStr : QString(); } +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +#define SKIP_EMPTY Qt::SkipEmptyParts +#else +#define SKIP_EMPTY QString::SkipEmptyParts +#endif + QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards) { // fromCursorTilWhitespace calls cursor->movePosition repeatedly, while @@ -666,7 +672,7 @@ QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, b "mn.abcd." for the url (wrong). So we have to go to 'i', to capture "mn.abcd.edu " (with trailing space), and then clean it up. */ - QStringList list = grownText.split(QRegExp("\\s"), QString::SkipEmptyParts); + QStringList list = grownText.split(QRegExp("\\s"), SKIP_EMPTY); if (!list.isEmpty()) { result = list[0]; } diff --git a/desktop-widgets/tagwidget.cpp b/desktop-widgets/tagwidget.cpp index 5327b0a2c..01ddd15be 100644 --- a/desktop-widgets/tagwidget.cpp +++ b/desktop-widgets/tagwidget.cpp @@ -39,6 +39,12 @@ void TagWidget::setCompleter(QCompleter *completer) connect(m_completer, SIGNAL(highlighted(QString)), this, SLOT(completionHighlighted(QString))); } +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +#define SKIP_EMPTY Qt::SkipEmptyParts +#else +#define SKIP_EMPTY QString::SkipEmptyParts +#endif + QPair TagWidget::getCursorTagPosition() { int i = 0, start = 0, end = 0; @@ -71,7 +77,7 @@ void TagWidget::highlight() { removeAllBlocks(); int lastPos = 0; - const auto l = text().split(QChar(','), QString::SkipEmptyParts); + const auto l = text().split(QChar(','), SKIP_EMPTY); for (const QString &s: l) { QString trimmed = s.trimmed(); if (trimmed.isEmpty()) -- cgit v1.2.3-70-g09d2