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. Updating RelationalTableModel with QDataWidgetMapper

Updating RelationalTableModel with QDataWidgetMapper

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.3k 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.
  • O Offline
    O Offline
    onezeno
    wrote on last edited by
    #1

    I'm using QDataWidgetMapper in a simple fashion similar to the example in the "documentation":http://harmattan-dev.nokia.com/docs/library/html/qt4/qdatawidgetmapper.html.

    In my use, I have a TableView backed by a RelationalTableModel. When I double-click one of the records, a form pops up that is properly populated using QDataWidgetMapper. However, changes to values in the form are not registered in the model. I am giving my mapper a ManualSubmit policy, and submitting when the user clicks 'Ok' in the modal popup form.

    Edit: Actually my model does update. It's table view that doesn't display it, and must be refreshed somehow.

    New question then: should my TableView be updating automatically when the underlying model change? Do I need to perform a manual refresh?

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

      did you subclass the model? If so you have to care that the right signals are sent on data update to inform the view about the changes.

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

        You're right. It turns out I don't need to subclass the model any more, so now everything works well. Question, why do I have to manage the signals if I subclass the model? Are those not inherited?

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

          you have to take care of the signals whenever you do the data handling by yourself in the model. There is no automatic way for doing this, since you are the only one who knows how the data implemented.

          --- 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
          • O Offline
            O Offline
            onezeno
            wrote on last edited by
            #5

            Ah, it makes sense now. Thanks for the response!

            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