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. QTreeWidget
Forum Updated to NodeBB v4.3 + New Features

QTreeWidget

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

    How can I obtain the number of the tol level items?

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      You could do the children() option, that would give the direct children of the TreeWidget, not the children of the children.
      Or Iterate over the TreeWidget and store all the items in a separate list?
      What do you want to achieve?? What do you really need to do? We might come up with other options.
      Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0
      • mrdebugM Offline
        mrdebugM Offline
        mrdebug
        wrote on last edited by
        #3

        Hi, I have more than one thing to do. My situation is a QTreeWidget with 22 item. Some items have subitems some others not.

        1. I have to get the number of top level items.
        2. Clicking on a PushButton I have to exchange the current item with the item before or after.

        Do you know how I can do it?

        Need programmers to hire?
        www.labcsp.com
        www.denisgottardello.it
        GMT+1
        Skype: mrdebug

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Like I mentioned, use the children() option or to make it really easy: RTFM:

          @
          int topLevelItemCount() const
          @
          It is there in the docs................
          Then to switch the two toplevel items when the button is pressed, check out this function:
          @
          QTreeWidgetItem * takeTopLevelItem(int index)
          @

          Greetz, Jeroen

          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