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. Table cross
Forum Updated to NodeBB v4.3 + New Features

Table cross

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 484 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.
  • E Offline
    E Offline
    EagleWatch
    wrote on last edited by
    #1

    Hi guys,

    I'll provide you a picture to illustrate my question.

    0_1528725657570_Sans titre.png

    So when I say "table" I mean table from a database.

    The question is : Is it possible to get a view like that ?
    Of course, I know that getting assets classified by profils is tricky, so if this isn't possible, I can change cell colors instead of having profils names.

    The goal here, is populate the first row and column from different tables of a database and let the user check if there is a link between an asset and a process.
    Of course, that would be great to populate a third table with the cross information.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2
      • create a QStandardItemModel
      • select the "process" table, iterate over it and call QStandardItemModel::insertColumn + QStandardItemModel::setHeaderData to insert a column and set its value
      • select from the asset table sorting by Profil, iterate over the results
        • check if profil changes from one to the next, if it does use QStandardItemModel::insertRow + QStandardItemModel::setHeaderData + QStandardItemModel::setData(,,Qt::BackgroundRole) + QStandardItemModel::item()->setFlag to add a row that can't be interacted with
        • if it doesn't change use QStandardItemModel::insertRow + QStandardItemModel::setHeaderData to add an asset row and use QStandardItemModel::item()->setFlag + QStandardItemModel::setData(,Qt::Unchecked,Qt::CheckStateRole) to allow checking/unchecking
      • iterate over the table and use QStandardItemModel::data(,Qt::CheckStateRole).toInt() to check if the cell is checked or not and save that information whenever you want

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      5
      • E Offline
        E Offline
        EagleWatch
        wrote on last edited by
        #3

        @VRonin Thank you, that's what I was looking for !

        1 Reply Last reply
        0

        • Login

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