Results 1 to 4 of 4

Thread: QTableView inside QTabWidget does not update UI after model data changes until user c

  1. #1
    Join Date
    Jun 2014
    Posts
    30
    Thanks
    4
    Qt products
    Qt5

    Default QTableView inside QTabWidget does not update UI after model data changes until user c

    I have a form with a QTabWidget and a QPushButton.

    Inside the QTabWidget I have a QWidget with a QTableView.

    Clicking the QPushButton updates the values in the table model.

    The problem is that after clicking the button, the table UI does not show any changes. Once you click anywhere inside the QTabWidget, that's when the table updates its display to show the new values. So in other words, the changes in the model are happening but they are not shown in the UI untill the user clicks somewhere inside the QTabWidget.

    I have tried using setFocus() on the QTabWidget and its child tab QWidget but neither have worked.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView inside QTabWidget does not update UI after model data changes until us

    Does the model emit the dataChanged() signal?

    Cheers,
    _

  3. #3
    Join Date
    Jun 2014
    Posts
    30
    Thanks
    4
    Qt products
    Qt5

    Default Re: QTableView inside QTabWidget does not update UI after model data changes until us

    Yes it does

  4. #4
    Join Date
    Jun 2014
    Posts
    30
    Thanks
    4
    Qt products
    Qt5

    Default Re: QTableView inside QTabWidget does not update UI after model data changes until us

    I had to call QTableView::repaint() to solve the problem.

Similar Threads

  1. Replies: 4
    Last Post: 21st October 2013, 22:24
  2. Update changes in QTableView to sqlite data base
    By nagabathula in forum Qt Programming
    Replies: 2
    Last Post: 12th November 2011, 02:18
  3. Replies: 1
    Last Post: 24th February 2011, 06:54
  4. Resizing QTableView inside a QTabWidget
    By Aslan in forum Newbie
    Replies: 2
    Last Post: 29th May 2010, 15:50
  5. Replies: 9
    Last Post: 7th November 2006, 16:10

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.