Results 1 to 7 of 7

Thread: QAbstractItemModel / QStyledItemDelegate howto update data on value changed?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Location
    Germany, Munich
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QAbstractItemModel / QStyledItemDelegate howto update data on value changed?

    Ups, some post get lost somewhere ???
    Thanks Santosh, but I dosn`t connect anything it goes autmaticaly by
    Qt Code:
    1. mapper_r1.addMapping
    To copy to clipboard, switch view to plain text mode 
    Maybe I have to derive QTableView and QDataWidgetMapper to force some signals

  2. #2
    Join Date
    Jun 2010
    Location
    Germany, Munich
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QAbstractItemModel / QStyledItemDelegate howto update data on value changed?

    I improved the code to

    Qt Code:
    1. mapper_r2 = QtGui.QDataWidgetMapper(this)
    2. mapper_r2.setModel(otpmodel)
    3. mapper_r2.addMapping(label_row2, 0, "text")
    4. mapper_r2.addMapping(spinbox_row2, 1)
    5. mapper_r2.setCurrentIndex(1)
    6. connect(
    7. spinbox_row2, SIGNAL(valueChanged(), otpmodel, SLOT(dataChanged()))
    8. )
    9. mapper_r2.setSubmitPolicy(QtGui.QDataWidgetMapper.AutoSubmit)
    To copy to clipboard, switch view to plain text mode 

    But as expected, the value isn`t set to the model already , so an dataChanged() isn`t enough

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QAbstractItemModel / QStyledItemDelegate howto update data on value changed?

    There is no such SLOT in QAbstractItemModel

Similar Threads

  1. Replies: 2
    Last Post: 9th August 2010, 17:53
  2. Replies: 12
    Last Post: 24th July 2010, 08:12
  3. Update to 4.4.2: cornerWidget functionality changed
    By mclark in forum Qt Programming
    Replies: 5
    Last Post: 21st November 2008, 01:14
  4. update custom QStyledItemDelegate after drag
    By dano in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2008, 18:29
  5. Informing a model its data has changed
    By saknopper in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 19:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.