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
QtWS25 Last Chance

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.
  • M Offline
    M Offline
    martinheidelberg
    wrote on 9 Mar 2016, 13:25 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

    K 1 Reply Last reply 9 Mar 2016, 15:07
    0
    • M martinheidelberg
      9 Mar 2016, 13:25

      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

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 9 Mar 2016, 15:07 last edited by kshegunov 3 Sept 2016, 15:07
      #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
      • M Offline
        M Offline
        martinheidelberg
        wrote on 9 Mar 2016, 16:14 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.

        K 1 Reply Last reply 9 Mar 2016, 22:45
        0
        • M martinheidelberg
          9 Mar 2016, 16:14

          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.

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 9 Mar 2016, 22:45 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

          M 1 Reply Last reply 10 Mar 2016, 08:16
          0
          • K kshegunov
            9 Mar 2016, 22:45

            @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.

            M Offline
            M Offline
            martinheidelberg
            wrote on 10 Mar 2016, 08:16 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

            5/5

            10 Mar 2016, 08:16

            • Login

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