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

replace QHashIterator with QMultiHash::cbegin/cend #4377

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

Be-ing
Copy link
Contributor

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

QMultiHash is not a subclass of QHash in Qt6:
https://doc.qt.io/qt-6/qtcore-changes-qt6.html#removal-of-qhash-insertmulti
so the
QHashIterator(const QHash<Key, T> &hash)
constructor cannot be used with QMultiHash.

QHashIterator<SoundDeviceId, AudioOutput> it(outputs);
while (it.hasNext()) {
it.next();
auto hash = config.getOutputs();
Copy link
Contributor

Choose a reason for hiding this comment

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

  • hash is not an appropriate variable name, how about outputDeviceMap?
  • const auto

QHashIterator<SoundDeviceId, AudioInput> it(inputs);
while (it.hasNext()) {
it.next();
auto hash = config.getInputs();
Copy link
Contributor

Choose a reason for hiding this comment

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

  • hash is not an appropriate variable name, how about inputDeviceMap?
  • const auto

QHashIterator<SoundDeviceId, AudioInput> it(inputs);
while (it.hasNext()) {
it.next();
const auto inputDeviceHash = config.getInputs();
Copy link
Contributor

@uklotzde uklotzde Oct 12, 2021

Choose a reason for hiding this comment

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

Conceptually this is still a key/value "map". It doesn't matter if it is a tree or a hash map. This is an implementation detail.

The term "hash" usually means hash code or value and not hash map when used standalone.

If we want to reference the underlying data structure in the naming then inputDeviceMap.

QMultiHash is not a subclass of QHash in Qt6:
https://doc.qt.io/qt-6/qtcore-changes-qt6.html#removal-of-qhash-insertmulti
so the
QHashIterator(const QHash<Key, T> &hash)
constructor cannot be used with QMultiHash.
Copy link
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 8049b96 into mixxxdj:main Oct 12, 2021
@Be-ing Be-ing deleted the qmultihash_iterator branch October 12, 2021 22:32
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