Results 1 to 4 of 4

Thread: QTreeView like excel spreadsheet

  1. #1
    Join Date
    Sep 2009
    Posts
    3

    Default QTreeView like excel spreadsheet

    Hi to all.

    I'm new on this forum. I try to find something like this but didn't find.

    I need to develop excel-like spreadsheet with possibilities:
    1. Data must be tree like:
    Group
    Element 1
    Sub Element 1
    ......
    Element 2
    .......

    And have possibility to expand and collapse each sublevels(+/- like in a tree)
    2. Need to have a possibility to hide row like in excel. In fact, give height = 0 pixels and possibility to expand it by placing mouse between rows and drag down.

    Some other functionality that I think don't have a influence for this.

    For first one is good to use QTreeView, for second QTableView.

    I start to using QTreeView. Can you help me, how to extend QTreeView for such functionality?

  2. #2
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeView like excel spreadsheet

    Hi,

    I think that you don't have to extend the QTreeView class because it is already providing all you need.

    On the QTreeView you can set the related delegates objects for the display (I can name "custom display") and editing the data.

    In order to implement the "Excel" editing, you have to implement a custom Model that will be the storage and manager for your specific data.

    It is not a so hard work, you have just to understand the correct way to implement the Model for your specific requirements. I have already constructed an editor based on the QTreeView that is able to manage a lot of kind of data. The configuration of my "editor" is based on a SQL storage with the mapping of database column to the grid column (or a subset of grid colum) with also the management of different unit of measures for the different data type. The Delegate for the editing are also created and assigned in automatically (by the class derived from the QTreeView).

    Bye

    Alessandro

  3. #3
    Join Date
    Sep 2009
    Posts
    3

    Default Re: QTreeView like excel spreadsheet

    Quote Originally Posted by Zuzzu View Post
    Hi,

    I think that you don't have to extend the QTreeView class because it is already providing all you need.

    On the QTreeView you can set the related delegates objects for the display (I can name "custom display") and editing the data.

    In order to implement the "Excel" editing, you have to implement a custom Model that will be the storage and manager for your specific data.

    It is not a so hard work, you have just to understand the correct way to implement the Model for your specific requirements. I have already constructed an editor based on the QTreeView that is able to manage a lot of kind of data. The configuration of my "editor" is based on a SQL storage with the mapping of database column to the grid column (or a subset of grid colum) with also the management of different unit of measures for the different data type. The Delegate for the editing are also created and assigned in automatically (by the class derived from the QTreeView).

    Bye

    Alessandro
    Thanks for your reply. I have my own model. But problem that I can't give to user a possibility to change row height in QTreeView. I investigate in row delegate and I think it don't give me needed functionality. It uses for data editing in row, custom row painting by cells....

  4. #4
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeView like excel spreadsheet

    Quote Originally Posted by Stapl View Post
    Thanks for your reply. I have my own model. But problem that I can't give to user a possibility to change row height in QTreeView. I investigate in row delegate and I think it don't give me needed functionality. It uses for data editing in row, custom row painting by cells....
    Have you tried with Qt::SizeHintRole ??

Similar Threads

  1. QTreeView repaint
    By graeme in forum Qt Programming
    Replies: 17
    Last Post: 13th March 2012, 14:27
  2. One Model, Two Views (QTreeView and QTableView)
    By dgarrett97 in forum Newbie
    Replies: 2
    Last Post: 14th September 2009, 19:10
  3. Automating Excel 97
    By Aki-Matti in forum Qt Programming
    Replies: 0
    Last Post: 14th December 2007, 07:28
  4. QTreeView help
    By bepaald in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2007, 22:22
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 15:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.