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. Threading and Showing db tables with extra info
QtWS25 Last Chance

Threading and Showing db tables with extra info

Scheduled Pinned Locked Moved Unsolved General and Desktop
threadqsqlquerymodelqtableviewqtablemodel
2 Posts 2 Posters 958 Views
  • 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.
  • S Offline
    S Offline
    Sanchezy
    wrote on 29 Apr 2017, 11:00 last edited by
    #1

    Hey guys, I am currently studing for master in electronics and computer engineering, and I'm currently developing an application, for "software engineering" course.

    Application: The purposed application has an tcp server able to handle several connections with the robots.
    I choosed to work with database/ no files, so i'm using a sqlite db to save information about the robots and their full history, models of robots, tasks, etc...
    The robots send us several data like odometry, tasks information, and so on...

    I create a thread for every new robot's connection to handle the messages and update the informations of the robots on the database. Now lets start talk about my problems:

    The application got to show information about the robots in realtime, and I was thinking about using QSqlQueryModel, set the right query and the show it on a QTableView but then I got to some problems/ solutions to think about:

    Problem number 1: There are informations to show on the QTableView that are not on the database: I have the current consumption on the database and the actual charge on the database in capacity, but I want to show also on my table the remaining battery time, how can I add that column with the right behaviour (math implemented) in my TableView.

    Problem number 2: I will be receiving messages each second for each robot, so, updating the db and the the gui(loading the query) may not be the best solution when I have a big number of robots connected? Is it better to update the table, and only update the db each minute or something like this? If I use this method I cant work with the table with the QSqlQueryModel to update the tables, so what is the approach that you recommend me to use?

    Thanks
    SancheZ

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 Apr 2017, 21:50 last edited by SGaist
      #2

      Hi and welcome to devnet,

      1. You can use a proxy model that adds the columns you want/need.

      2. You can keep updating the DB content and trigger the GUI update at some known interval or when a certains amount of changed happened to the database.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      1/2

      29 Apr 2017, 11:00

      • Login

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