Update QSQLTableModel in QT C++ -


i created 1 dialog used bindvalues in sql database, , can save every new record sucessfully. problem i've got dialog qsqltablemodel shows information database. every time make new record must close program , run again see changes in showinformationdialog(). know way such don't need close program update information in showinformationdialog()?

you can use select() method of qsqltablemodel class repopulate model data database. bound views updated automatically. suggest connecting signal wherever update data in database (i.e. dialog updating sql database) custom slot in showinformationdialog() calls select() of qsqltablemodel object. assume have qmainwindow object parent of both dialogues best place establish connection.

also since showinformationdialog()'s model used viewing data consider using qsqlquerymodel. if used setquery() method should used instead of select() otherwise (the connection of signal showinformationdialog()'s slot) same.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -