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. QItemSelectionModel signal selectionChanged not called
Forum Updated to NodeBB v4.3 + New Features

QItemSelectionModel signal selectionChanged not called

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.1k 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.
  • D Offline
    D Offline
    deepakkakkeel
    wrote on last edited by
    #1

    Hi ,

    I have a QSqlQueryModel , I set that model to QItemSelectionModel.
    QSqlQueryModel *model;
    QItemSelectionModel *selectionModel = new QItemSelectionModel(model);
    connect(selectionModel,SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),this,SLOT(update1(const QItemSelection &, const QItemSelection &)));

    But the selectionChanged doesnot call update1(). May i know why is it not executing?

    Deepak

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

      you also have to "set the selection model to the view":http://qt-project.org/doc/qt-5.0/qtwidgets/qabstractitemview.html#setSelectionModel. The view triggers then the changes in the selection model.
      The data model doesn't do anything on the selection model.

      --- 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
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Why do you create a new item selection model at all? Item selection is a concern of the view, so an item selection model belongs to the view, and the view will provide a pointer to the selection model it is using.

        Use the model as provided by the view, and you're in business.

        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