Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QHashIterator with QMultiHash
Forum Updated to NodeBB v4.3 + New Features

QHashIterator with QMultiHash

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 280 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by beecksche
    #1

    Hi,
    in Qt 6.5, MSVC2019, 64bit (Qt 5.15 works by the way)

    QMultiHash<QString, QString> multiHash;
    QHashIterator<QString, QString> it(multiHash); // compile error: C2664
    

    No matching constructor for initialization of 'QHashIterator<QString, QString>'
    note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHashIterator<QString, QString>' for 1st argument
    note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'QHashIterator<QString, QString>' for 1st argument
    note: candidate constructor not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHash<QString, QString>' for 1st argument

    Christian EhrlicherC 1 Reply Last reply
    0
    • beeckscheB beecksche

      Hi,
      in Qt 6.5, MSVC2019, 64bit (Qt 5.15 works by the way)

      QMultiHash<QString, QString> multiHash;
      QHashIterator<QString, QString> it(multiHash); // compile error: C2664
      

      No matching constructor for initialization of 'QHashIterator<QString, QString>'
      note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHashIterator<QString, QString>' for 1st argument
      note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'QHashIterator<QString, QString>' for 1st argument
      note: candidate constructor not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHash<QString, QString>' for 1st argument

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      Looks like a documentation error which was not adjusted from Qt5 to Qt6 as QMultiHash no longer derives from QHash. You have to use QMultiHashIterator now or use c++ style iterators / range-based for loop.
      I wonder why these iterators were not removed in Qt6 though...

      /edit: https://bugreports.qt.io/browse/QTBUG-119461

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • beeckscheB beecksche has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved