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. [Solved] QTreeView add data before expand item
Forum Updated to NodeBB v4.3 + New Features

[Solved] QTreeView add data before expand item

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.9k 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.
  • G Offline
    G Offline
    Galbarad
    wrote on last edited by
    #1

    Hi all
    I have tree that related with objects in DB, user not use tree all the time, but sometimes user want to see list of objects in some folder and I should fill this folder before expand. I am use inheritor of QBaseTreeItem from Qt examples

    Exists another way except use own subclass of QTreeView and reimplement MouseClick event???

    thank you for help
    good luck

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

      Hi!
      Can you link to this example?
      But if you mean lazy model you don't need subclass TreeView. In this cases you need subclass QAbstractItemModel and reimplement:
      @bool canFetchMore(const QModelIndex & parent) const;
      void fetchMore(const QModelIndex & parent);@
      as strart point for creating tree models you can take "this":http://qt-project.org/doc/qt-5.0/qtwidgets/itemviews-editabletreemodel.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galbarad
        wrote on last edited by
        #3

        Thank you qxoz, I'll try your way

        information about overriding mauseClickEvent I found there
        http://lists.trolltech.com/qt-interest/2006-08/thread00282-0.html

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Galbarad
          wrote on last edited by
          #4

          all work in the best way )
          thanks qxoz

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

            You're welcome.
            I am glad to be helpful :)

            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