Results 1 to 5 of 5

Thread: Issue with QDataWidgetMapper and QSQLite database

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Issue with QDataWidgetMapper and QSQLite database

    Hmm. Have you tried without the mapper->setItemDelegate() call?

    Cheers,
    _

  2. #2
    Join Date
    Apr 2015
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Issue with QDataWidgetMapper and QSQLite database

    Well I just did it, same result: currentIndex shows -1... Maybe it's the mapper->setModel(model) call which causes the issue, but in this case I don't see what I did wrong.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Issue with QDataWidgetMapper and QSQLite database

    It looks ok.
    Maybe you can reproduce the problem with a small example that you can post?

    Cheers,
    _

  4. #4
    Join Date
    Apr 2015
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Issue with QDataWidgetMapper and QSQLite database

    Eh, so while doing what you asked for I found the issue, but I don't get why. The problem was with my model apparently, because doing:
    Qt Code:
    1. model->fieldIndex("idStock")
    To copy to clipboard, switch view to plain text mode 
    displayed -1 (other calls to fieldIndex displayed also the same value). I replaced its call in
    Qt Code:
    1. QSqlTableModel *platsRelModel = model->relationModel(model->fieldIndex("idStock"))
    To copy to clipboard, switch view to plain text mode 
    by its value ('2') and it worked. Now my question is why the fieldIndex calls displayed -1 . Here you'll find the small example you asked for (in ZIP format) (and thank you again)
    testDataWidgetMapper.zip

Similar Threads

  1. QSQLITE database changes not showing up in database
    By Cyrebo in forum Qt Programming
    Replies: 6
    Last Post: 14th April 2013, 23:18
  2. Replies: 3
    Last Post: 4th August 2010, 18:51
  3. QSqlite, multiple connections to in memory database.
    By adzajac in forum Qt Programming
    Replies: 9
    Last Post: 10th March 2010, 22:35
  4. QSQLITE database can't exec queries
    By mcwar in forum Qt Programming
    Replies: 5
    Last Post: 12th January 2010, 23:47
  5. QSqlite database lock + Delegate + QSqlQueryModel
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2009, 11:52

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.