Results 1 to 2 of 2

Thread: refreshing QSqlRelationalDelegate data

  1. #1
    Join Date
    Jan 2007
    Posts
    68
    Thanks
    9
    Thanked 8 Times in 8 Posts

    Question refreshing QSqlRelationalDelegate data

    Hi,

    I'm using a QSqlRelationalTableModel with two QSqlRelationalDelegates, comparable to the qt example: link

    In this example if I add a new City or Country (in the database), how do I tell the QSqlRelationalDelegates to update their data (tell the combobox to refresh the data)?

    you can call something like

    m_tableView->itemDelegate() to get a pointer to the QAbstractItemView but there's no method like refresh() or update().


    Second question is:

    Is it more efficient to implement a search for a QSqlRelationalTableModel using model->setFilter();model->select(); or is more performant to use a QSortFilterProxyModel between the QSqlRelationalTableModel and the QTableView e.g.:

    Qt Code:
    1.  
    2. proxyModel->setSourceModel(model );
    3.  
    4. QTableView tableView = new QTableView();
    5. tableView->setModel(proxyModel );
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Nov 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: refreshing QSqlRelationalDelegate data

    After you add a city call the relationModel(int column) method of your QSqlRelationalTableModel to get a pointer to the model which stores data for delegate. Then call that model's select() method, e.g.
    Qt Code:
    1. yourModel.relationalModel(foreignKeyColumn)->select();
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53
  2. Replies: 16
    Last Post: 7th March 2006, 15:57

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.