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. Split data to a groups in QTableView
Forum Updated to NodeBB v4.3 + New Features

Split data to a groups in QTableView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.3k 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.
  • Q Offline
    Q Offline
    qxoz
    wrote on last edited by
    #1

    Hi!
    In database i have a data which are belongs to different groups. And i want display them as in a image below:
    !http://s8.postimage.org/5hq66i62t/img.png(table)!

    Rows are sorted in groups. I have few suggestions about how to realise it:

    1. Use TreeView
    2. Some list or tree with tableview in items
    3. TableView with setSpan().

    How it should be done in right way?
    Thanks for advance.

    1 Reply Last reply
    1
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Here are two more alternatives:
      4. Use a more advanced data grid, like "qicsTable":http://www.ics.com/products/qt/qicstable/ or "QTitanDataGrid":http://www.devmachines.com/qtitandatagrid-overview.html
      5. Use QML, which supports grouping (but as of yet, no tables).

      There are many approaches, and I would not call the one better than the other for all cases. I'd probably avoid option 2 though, that looks like it could get messy rather soon.

      If you are willing to shell out a bit of cash for a more powerful component, then that can be worth doing. Otherwise, I think going for a tree instead would be my first choice. You can style the root items to look like group headers easily. Qxt has a "delegate":http://libqxt.bitbucket.org/doc/0.6/qxtitemdelegate.html that can help you do this, but it is not that hard to do yourself either.

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        Thank you Andre!
        QTitanDataGrid is a very good component but it's little bit expensive for my goals.
        I think Tree is a good choice. Is QTreeView has an option which makes all items expanded?

        1 Reply Last reply
        1
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Yes, it does. There are several expansion related slots available. Try the documentation...

          1 Reply Last reply
          1

          • Login

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