Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15027

Incorrectly partially checked root item (QTreeWIdgetItem)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.7.0
    • Widgets: Itemviews
    • None
    • Windows XP

    Description

      If one or more, but not all, of the children of the root item of a QTreeWidget are checked, the root item is shown as partially checked, and checkState returns Qt::PartiallyChecked, which is good so far. And when one programmatically sets the root item to Qt::Unchecked, all its children will be unchecked, and checkState on the root item returns Qt::Unchecked, but the root item in the QTreeWidget is still shown as partially checked, which is wrong. I attached a small example to demonstrate this.

      1. Start example
      2. During the first 3 seconds check one of the child items
      3. Wait for time out
      4. All children will be unchecked, checkState of rootItem will return 0 (=Qt::Unchecked), but it will be shown as partially checked

      I have also included a workaround in this example, which unchecks all children, then the parent item will be shown correctly unchecked (Just uncomment the corresponding lines (38-40) in the timeUp slot). With this workaround, it is not necessary anymore to change the state of the parent item (line 42 can be commented).

      Attachments

        1. checkState.zip
          1 kB
          Martin Wiesmann (closed Nokia identity)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mawiesma Martin Wiesmann (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes