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

selectionChanged() in QTreeView not called when underlying SQL model calls select()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.4.1, 5.4.2, 5.5.0
    • Widgets: Itemviews
    • None
    • Windows/Linux + Qt 5.4.1/5.4.2/Qt 5.5

    Description

      Let's have this application:

      • itemview (QTreeView)
      • model (QSqlTableModel)

      Attach model to view and reimplement QTreeView::selectionChanged(...) method. Place breakpoint in it.

      Now do this scenario:

      1. Load some data into model via select().
      2. Select some items in displayed data via itemview.
      3. Force reloading of the model via select() again.

      Expected behavior: Breakpoint is hit after each action 2, 3.
      Real behavior: No breakpoint is hit after action 3. It is hit only after action 2, which is obvious. But after action 3, selection was indeed changed, because model was repopulated with new data and after that, there is no new visible selection, thus selection is really changed.

      FACT: This bug was not present in Qt 4.x.

      Real-world bug reproduction: https://bitbucket.org/skunkos/rssguard/src/b8a056fff161c137531ff5558f178781b54be804/src/gui/messagesview.cpp?at=master#cl-248

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            skunkos Martin Rotter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes