Results 1 to 3 of 3

Thread: Index (position) changed on saving with QTableView

  1. #1
    Join Date
    Jul 2008
    Location
    Spain
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Index (position) changed on saving with QTableView

    I have a QSqlRelationalTableModel with one QTableView of it.

    After you change data on a row... visually the table goes to the top, difficulting the entry of sequencial data with tabulations or clicking on another position.
    Auryn
    Starting to learn the world of Qt

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Index (position) changed on saving with QTableView

    How do you change that data? Do you call select() somewhere?
    J-P Nurmi

  3. #3
    Join Date
    Jul 2008
    Location
    Spain
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Index (position) changed on saving with QTableView

    When using
    Qt Code:
    1. my_model.setEditStrategy(QSqlTableModel::OnManualSubmit);
    To copy to clipboard, switch view to plain text mode 
    I save with
    Qt Code:
    1. my_model.submitAll();
    To copy to clipboard, switch view to plain text mode 

    When using
    Qt Code:
    1. my_model.setEditStrategy(QSqlTableModel::OnRowChange);
    To copy to clipboard, switch view to plain text mode 
    I don't save manually.

    After saving, occurs a "reselect" and the table position goes to the beginning.

    The position must go to next field when ending an edition with tab key. And when clicking on another position while we are in edit mode must go to that position, not to the beginning.

    Thank you
    Auryn
    Starting to learn the world of Qt

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