c++ - Auto-refresh QSqlTableModel/QTableView when the underlying SQL table is changed from outside of my application -
i utilize qsqltablemodel
, qtableview
display table underlying sqlite database. @ same time, table can changed outside of application. when happens, need observe , refresh qsqltablemodel
, qtableview
.
currently, qsqltablemodel
, qtableview
not observe changes @ all, until user action forces refresh, such editing field. how can implement this?
right i'm thinking polling, i'm not sure poll changes, , how minimum overhead. run count
sql query? if element has been added removed? i'd rather not force-refresh if there no changes table.
so best way?
sqlite has no mechanism allows multiple processes communicate in real time.
the easiest way observe changes in database file file alter counter.
however, if can applications cooperate, should utilize other mechanism send notifications.
c++ sql qt sqlite
No comments:
Post a Comment