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. QAbstractItemModel::multiData() ?
Forum Updated to NodeBB v4.3 + New Features

QAbstractItemModel::multiData() ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 593 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.
  • B Offline
    B Offline
    BVladimir
    wrote on last edited by
    #1

    I read about the QAbstractItemModel::multiData() method with an example. But I didn't understand when it is called from QML? Or just as a wrapper for data() ?

    Christian EhrlicherC 1 Reply Last reply
    0
    • B BVladimir

      I read about the QAbstractItemModel::multiData() method with an example. But I didn't understand when it is called from QML? Or just as a wrapper for data() ?

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

      @BVladimir said in QAbstractItemModel::multiData() ?:

      But I didn't understand when it is called from QML? Or just as a wrapper for data() ?

      Where do you directl call data() from QML?

      QAIM::multiData() can be called when you need more than one role for a specific index so you don't have to call QAIM::data() with the same index more than once.

      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
      0
      • B Offline
        B Offline
        BVladimir
        wrote on last edited by
        #3

        ...
        delegate: myHeader_column {
        init_width: col_width
        txt: col_name
        }

        col_width and col_name are role's names in my model. Direct call for data() for each role name. What with multiData ?

        Christian EhrlicherC 1 Reply Last reply
        0
        • B BVladimir

          ...
          delegate: myHeader_column {
          init_width: col_width
          txt: col_name
          }

          col_width and col_name are role's names in my model. Direct call for data() for each role name. What with multiData ?

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

          @BVladimir said in QAbstractItemModel::multiData() ?:

          Direct call for data() for each role name.

          How do you know? I don't see a call here and don't know what's done under the hood. But you're right - since those are two different properties to fill those are two calls

          What with multiData ?

          I don't see how you can use it here.

          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
          0
          • B Offline
            B Offline
            BVladimir
            wrote on last edited by
            #5

            @Christian-Ehrlicher said in QAbstractItemModel::multiData() ?:

            I don't see how you can use it here.

            So how exactly to use multiData ?

            Christian EhrlicherC 1 Reply Last reply
            0
            • B BVladimir

              @Christian-Ehrlicher said in QAbstractItemModel::multiData() ?:

              I don't see how you can use it here.

              So how exactly to use multiData ?

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

              @BVladimir said in QAbstractItemModel::multiData() ?:

              So how exactly to use multiData ?

              With c++ - don't know how/if/where it's exposed to QML - never used it.

              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
              0

              • Login

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