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. Fill QMap using qFill
Qt 6.11 is out! See what's new in the release blog

Fill QMap using qFill

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.4k 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.
  • H Offline
    H Offline
    harshilsharma63
    wrote on last edited by
    #1

    Hi. How can we fill a QMap using qFill()? How are we supposed to supply the values to be filled?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      easiest way:
      @
      QMap<...> map;
      qFill(map, val);
      @

      Make sure that your container class (QMap in this case) has already inserted/allocated.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • H Offline
        H Offline
        harshilsharma63
        wrote on last edited by
        #3

        Sorry for the late reply, but how exactly are we supposed to provide the value? Is it a QMap object? I will be helpful if you could provide a code snippet.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          for example:
          @
          QMap<int,int> map;
          map.insert(0, 1);
          ...
          qFill(map, 0);
          @

          in case of QMap - and other containers which do not preallocate items - this only works on already inserted items.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          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