Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Use QTableWidget in c++ visual studio to display sqlite database contents



  • Hello every one, I am new here and to Qt.
    I need to use qt in visual studio, i have added Qtaddon in VS, but it only creates ui file, I want to access sqlite db and display contents of db in a QTable widget form. I am very confused here.
    If i use Qt creator, how would i link it with my VS project, and in VS how can i access sqlite using qtablewidget or qtableview.
    Any one please get me out of this confusion please.


  • Lifetime Qt Champion

    Hi and welcome to the forums.
    You can use the
    http://doc.qt.io/qt-5/qsqltablemodel.html#details
    There is sample in the docs of how to hook up the model to the view.
    There are also other models if showing a table is not what you want.
    The http://doc.qt.io/qt-5/qsqlquerymodel.html
    allows to use SQL to select the data.

    Im not sure what Qtaddon can create regarding UI files.
    QtCreator can both create a stand alone UI and one that has .h and .cpp also.
    I assumed its the same with the addon but i have no VS to test it.
    Does addon offer more than one option for UI file ?


Log in to reply