Results 1 to 3 of 3

Thread: Accept data in a editing widget

  1. #1
    Join Date
    Mar 2010
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Accept data in a editing widget

    Hi there

    I'm making a small application that represents a to-do list. The list is stored in a cusom model (derived from QAbstractItemModel) and is displayed in a QTableView.

    I have also a custom widget (TaskDialog) that is used to browse and edit tasks from the list. The children of the TaskDialog are mapped to the model with a QDataWidgetMMapper. On the task dialog I have also buttons that allow browsing through all the tasks in my to-do list (QDataWidgetMapper::toPrevious() ...).

    The problem is that if I'm editing a task in the TaskDialog (e.g. the tasks name) and then browse to another task, the new edited enty isn't set in the model. But if I edit something in the TaskDialog, then first change the focus to an other child widget of the TaskDialog and then press one of the browsing button, than the changes are written to the model.

    How can I achive that widgets that are in a editing mode are accepted and written to the model.

    I also tried the example of QDataWidgetMapper from Nokia. There it works perfectly. But they use a QStandardItemModel.

    Best regards Luke
    Using Qt 4.7
    Developping on Win 7 and XP
    Using Qt Creator, Eclipse and Visual Studio
    Target Platforms Win, Linux and soon OS X

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Accept data in a editing widget

    I'd have to see the code but it seems the behaviour is related to submit policy of the widget mapper. You should make sure accepting the dialog submits the data to the mapper and prior to doing that set the mapper's submit policy to Manual.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Accept data in a editing widget

    Thank you very much!

    It seems to work!!!
    Using Qt 4.7
    Developping on Win 7 and XP
    Using Qt Creator, Eclipse and Visual Studio
    Target Platforms Win, Linux and soon OS X

Similar Threads

  1. QT Tree Widget - Issues editing items
    By epsilonorion in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2011, 16:19
  2. Problem: Reading and editing text file data
    By dipeshtech in forum Newbie
    Replies: 2
    Last Post: 3rd May 2011, 00:47
  3. Reusing the editing widget with QtItemDelegate
    By bcollie in forum Qt Programming
    Replies: 9
    Last Post: 1st June 2010, 15:52
  4. Midi editing widget
    By dentist in forum Newbie
    Replies: 1
    Last Post: 25th March 2010, 00:07
  5. Widget for data plotting
    By Benjamin in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2009, 16:38

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.