Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLite integration with Qt Widgets
Forum Updated to NodeBB v4.3 + New Features

SQLite integration with Qt Widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 393 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Swati777999S Offline
    Swati777999S Offline
    Swati777999
    wrote on last edited by
    #1

    Hi All,

    Hope you're doing well.

    I want to integrate SQLite in one of my Qt projects where the result of SQLite should appear as the central widget of the main window. Is it possible to do so, if yes, how? I just don't simply want to display the solution of my query in Qt Creator's console but I want the output of the SQLite interface should occupy the central Widget of the MainWindow.

    Any help will be highly appreciated!

    Thanks.

    “ In order to be irreplaceable, one must always be different” – Coco Chanel

    JonBJ Pl45m4P 2 Replies Last reply
    0
    • Swati777999S Swati777999

      Hi All,

      Hope you're doing well.

      I want to integrate SQLite in one of my Qt projects where the result of SQLite should appear as the central widget of the main window. Is it possible to do so, if yes, how? I just don't simply want to display the solution of my query in Qt Creator's console but I want the output of the SQLite interface should occupy the central Widget of the MainWindow.

      Any help will be highly appreciated!

      Thanks.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Swati777999
      If you want no more than what console output would show (i.e. some text for the rows & columns) but visible in a widget, just create, say, a QPlainTextEdit (or even just a QLabel) as the central widget and put the textual representation of the result set returned from the query there.

      If you want something a bit "nicer", say a table with rows & columns from the query, then create a QTableView as the central widget and bind it to the SQLite model you are using.

      1 Reply Last reply
      2
      • Swati777999S Swati777999

        Hi All,

        Hope you're doing well.

        I want to integrate SQLite in one of my Qt projects where the result of SQLite should appear as the central widget of the main window. Is it possible to do so, if yes, how? I just don't simply want to display the solution of my query in Qt Creator's console but I want the output of the SQLite interface should occupy the central Widget of the MainWindow.

        Any help will be highly appreciated!

        Thanks.

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #3

        @Swati777999

        To extend @JonB answer:

        Depends on what you really want to display and how your data / database looks like.
        If you have a single and more or less simple database table, have a look at QSqlTableModel

        • https://doc.qt.io/qt-5/qsqltablemodel.html#details

        or even QSqlQueryModel, for even more simple, read-only SQL database access queries.

        • https://doc.qt.io/qt-5/qsqlquerymodel.html#details

        For anything further than that, you probably need to write your own database model + view (to change/insert data using your graphical representation of your data).


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        3

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved