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. New representation (View) of a QStandardItemModel

New representation (View) of a QStandardItemModel

Scheduled Pinned Locked Moved Solved General and Desktop
qstandarditemmoqabstractitemviqtreeview
5 Posts 2 Posters 2.0k 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.
  • martinheidelbergM Offline
    martinheidelbergM Offline
    martinheidelberg
    wrote on last edited by
    #1

    Hi,

    I´m currently developing a program for creating trees. This itself wouldn´t be a problem, BUT:

    I´m using the QStandardItemModel, that is totally enough for my needs.

    I would like to create a widget, displaying the tree like shown in this IMAGE

    As I understood the documentation, I have to reimlpement the QAbstractItemView. But is there any tutorial which methods to use for drawing the tree, getting signals when a node is clicked? With a simple example I could figure the rest out by myself. I just need a starting point.

    Is there anybody who has done something similar?

    Is it also possible to place widgets in nodes? Like:

    MyNode
    [Image/logo]
    Button
    ______________

    Thank you very much!
    Martin

    kshegunovK 1 Reply Last reply
    0
    • martinheidelbergM martinheidelberg

      Hi,

      I´m currently developing a program for creating trees. This itself wouldn´t be a problem, BUT:

      I´m using the QStandardItemModel, that is totally enough for my needs.

      I would like to create a widget, displaying the tree like shown in this IMAGE

      As I understood the documentation, I have to reimlpement the QAbstractItemView. But is there any tutorial which methods to use for drawing the tree, getting signals when a node is clicked? With a simple example I could figure the rest out by myself. I just need a starting point.

      Is there anybody who has done something similar?

      Is it also possible to place widgets in nodes? Like:

      MyNode
      [Image/logo]
      Button
      ______________

      Thank you very much!
      Martin

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2

      @martinheidelberg
      Hello Martin,
      You might be better off switching to the graphics scene framework, it looks to be better suited to your needs. For a startup you could look here. That said you could probably do the painting in an abstract item view, but I believe it'll be much more hassle to implement.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • martinheidelbergM Offline
        martinheidelbergM Offline
        martinheidelberg
        wrote on last edited by
        #3

        Thank you for your reply!

        That was my wayB. I will probably do that and go with the graphics scene framework! I just thought, that there is a nicer version with the Model/View Framework.

        kshegunovK 1 Reply Last reply
        0
        • martinheidelbergM martinheidelberg

          Thank you for your reply!

          That was my wayB. I will probably do that and go with the graphics scene framework! I just thought, that there is a nicer version with the Model/View Framework.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @martinheidelberg said:

          I just thought, that there is a nicer version with the Model/View Framework.

          No, at least not an easy way as far as I know, since you'd want a pretty heavily custom painting. I believe it possible, but still doubt the wisdom of it, because the graphics view framework is quite better tailored for tasks such as yours.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          martinheidelbergM 1 Reply Last reply
          0
          • kshegunovK kshegunov

            @martinheidelberg said:

            I just thought, that there is a nicer version with the Model/View Framework.

            No, at least not an easy way as far as I know, since you'd want a pretty heavily custom painting. I believe it possible, but still doubt the wisdom of it, because the graphics view framework is quite better tailored for tasks such as yours.

            Kind regards.

            martinheidelbergM Offline
            martinheidelbergM Offline
            martinheidelberg
            wrote on last edited by
            #5

            @kshegunov

            Since I already worked with the graphics framework, I will stick with it!
            Thank you both for your posts. It saved me a lot of time trying ;)

            solved

            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