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. Why does QMap together with QtConcurrent::blockingMapped() not works?
Forum Updated to NodeBB v4.3 + New Features

Why does QMap together with QtConcurrent::blockingMapped() not works?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 586 Views
  • 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.
  • PowerNowP Offline
    PowerNowP Offline
    PowerNow
    wrote on last edited by PowerNow
    #1

    I want to use QMap together with QtConcurrent::blockingMapped(). Unfortunately I get an error.

    "main.cpp:490: error: no match for 'operator=' (operand types are 'QList<QList<Place>>..."

    QMap<QString, QList<Place>> m_plcs;
    
    QList<Place> setAlt(QList<Place> places);
    ...
    QList<QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
    

    tried also

    QMap<QString, QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
    

    What I'm doing wrong or is QMap not supported?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What's the type of 'Place'?
      Also show the complete error message.

      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
      1
      • PowerNowP Offline
        PowerNowP Offline
        PowerNow
        wrote on last edited by PowerNow
        #3

        Hi it's an 'stuct', but seems not to be the problem because it worked with

        QList<Place> m_plcs;
        
        Place setAlt(QList<Place> places);
        ...
        QList<Place> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
        

        Here the complete error message

        main.cpp:490: error: no match for 'operator=' (operand types are 'QList<QList<Place> >' and 'QtPrivate::MapResultType<QMap<QString, QList<Place> >, QList<Place> (*)(QList<Place>)>::ResultType {aka void}')
             m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          So as you can see the return value of QtConcurrent::blockingMapped(m_plcs, setAlt); is QMap<QString, QList<Place>

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

          PowerNowP 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            So as you can see the return value of QtConcurrent::blockingMapped(m_plcs, setAlt); is QMap<QString, QList<Place>

            PowerNowP Offline
            PowerNowP Offline
            PowerNow
            wrote on last edited by PowerNow
            #5

            @Christian-Ehrlicher Yea, but as I wrote before I tried aready

            QMap<QString, QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
            

            Then I get

            main.cpp:490: error: no match for 'operator=' (operand types are 'QMap<QString, QList<Place> >' and 'QtPrivate::MapResultType<QMap<QString, QList<Place> >, QList<Place> (*)(QList<Place>)>::ResultType {aka void}')
                 m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
            

            I don't understand the error message. Whats going wrong here?

            1 Reply Last reply
            0
            • Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Sorry I did read something wrong.
              Please see the documentation:
              "The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector."

              QMap is no sequence.

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

              PowerNowP 1 Reply Last reply
              3
              • Christian EhrlicherC Christian Ehrlicher

                Sorry I did read something wrong.
                Please see the documentation:
                "The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector."

                QMap is no sequence.

                PowerNowP Offline
                PowerNowP Offline
                PowerNow
                wrote on last edited by
                #7

                @Christian-Ehrlicher Yea, it seems so that QMap is not a sequence. Thxs!

                1 Reply Last reply
                0

                • Login

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