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. Subclassing the QTreeView class to register fields in a QWizard

Subclassing the QTreeView class to register fields in a QWizard

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.5k 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.
  • C Offline
    C Offline
    cobaltsixty
    wrote on last edited by
    #1

    Hi all,

    I'm very new to Qt and I've been stucked for a while now.
    I decided to build a GUI based on a QWizard. In such a context, parameters are passed from one QWizardPage to another via the parameters registration process. This is pretty much straightforward, excepted when using objects that are not 'registrable' by-design. In my case, I have a QTreeView inside a QWizardPage. I need to register the user-selected directory so that to launch processings in the final step. It seems the only solution is to subclass the QTreeView class. I tried but I wasn't able to get it working. Any help on this ?

    Thanks a lot by advance.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      You don't have to subclass. I request to go through how QTreeView can be used with models. QTreeView emits signals like the following whenever you select on treeview.

      e.g
      @void activated(const QModelIndex & index)
      void clicked(const QModelIndex & index)@

      Using index, you can query the data(filename) and store at some temp variables. You can use this temp variable where ever you want.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cobaltsixty
        wrote on last edited by
        #3

        Hi Dheerendra, thanks a lot for your answer.
        This is an alternative I definitely have to consider.
        Anyway, I'm still interested in having a better knowledge of subclassing given such a context.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          This is not alternative. It the way it supposed to be used. If you need any additional functions apart from what is provided in QTreeView, then you need to subclass it. In the current scenario, I don't see the reason for you to subclass it.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

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

            Hi,

            You should only need to add a QString property to your subclass and implement the corresponding function to register your custom QTreeView.

            What did not work ?

            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

            • Login

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