Skip to content

use QString::mid instead of QString::midRef#4372

Merged
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qstring_midref
Oct 12, 2021
Merged

use QString::mid instead of QString::midRef#4372
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qstring_midref

Conversation

@Be-ing
Copy link
Copy Markdown
Contributor

@Be-ing Be-ing commented Oct 10, 2021

QString::midRef was removed in Qt 6.

@github-actions github-actions Bot added the ui label Oct 10, 2021
Comment thread src/dialog/dlgkeywheel.cpp Outdated
Comment thread src/dialog/dlgkeywheel.cpp Outdated
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
idView = idView.sliced(2, idView.size() - 2);
#else
idView = idView.mid(2);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this method is deprecated in Qt6. It is much more concise than the new sliced method in Qt6.

Comment thread src/dialog/dlgkeywheel.cpp Outdated
Comment thread src/dialog/dlgkeywheel.cpp Outdated
QDomText textNode = text.toText();
ChromaticKey key = static_cast<ChromaticKey>(id.midRef(2).toInt());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringView idView(id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the simplified expression I proposed? Didn't that work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I did not see the variant of QStringView::sliced that omits the second parameter.

Copy link
Copy Markdown
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM

@uklotzde uklotzde merged commit 2a0b951 into mixxxdj:main Oct 12, 2021
@Be-ing Be-ing deleted the qstring_midref branch October 12, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants