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. Treemodel and Treeview
Forum Updated to NodeBB v4.3 + New Features

Treemodel and Treeview

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 390 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.
  • NevezN Offline
    NevezN Offline
    Nevez
    wrote on last edited by
    #1

    dd897caf-f301-429d-adde-3fdf12045726-image.png

    Hello, I have a treemodel created according to certain rules according to the data I received from the Db.
    This treemodel is available in the photo.
    However, this is not exactly the look I want. In TreeView, children open vertically, but I want them to open horizontally like this photo.
    fd53f37c-32f3-410a-8bfd-a9cbca2a3347-image.png

    I was told that for this I need to create my own view using QAbstractItemView.
    But I have no idea what exactly I should do from this base class. Can you give any examples, advice, etc.?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From this base class you need to implement the painting of the model data as well as the interactions with the mouse.

      For custom painting you have an example linked in the details of the QAbstractItemView class.

      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
      0
      • NevezN Offline
        NevezN Offline
        Nevez
        wrote on last edited by
        #3

        The link you provided has documentation on Qabstractitemview, but I still don't see a coded example.
        Can you give an explanatory example as I am unfamiliar with this subject?

        jsulmJ 1 Reply Last reply
        0
        • NevezN Nevez

          The link you provided has documentation on Qabstractitemview, but I still don't see a coded example.
          Can you give an explanatory example as I am unfamiliar with this subject?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Nevez In the link provided by @SGaist there is a link to an example application: https://doc.qt.io/qt-6/qtwidgets-itemviews-chart-example.html

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          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