PDA

View Full Version : QTableView inside QTabWidget does not update UI after model data changes until user c



jmalicke
27th January 2015, 02:31
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.

anda_skoa
27th January 2015, 07:59
Does the model emit the dataChanged() signal?

Cheers,
_

jmalicke
27th January 2015, 17:34
Yes it does

jmalicke
28th January 2015, 00:09
I had to call QTableView::repaint() to solve the problem.