Results 1 to 2 of 2

Thread: How to change the columnar controls in QTableView?

  1. #1
    Join Date
    Sep 2015
    Posts
    50
    Qt products
    Qt5
    Platforms
    Unix/X11
    Thanks
    8

    Default Re: How to change the columnar controls in QTableView?

    Hello everyone I am hoping to get some architectural advice on the best way to put together my UI.

    What I currently have in my Main Window is a QGraphicsView as the primary piece that the user interacts with. On the right hand side I have docked a QTreeView that keeps track of the hierarchy I have created of QGraphicsItems in the scene of the QGraphicsView.

    Note: The hierarchy I mention could be Item1 and Item2 as siblings or Item2 is a child of Item1 but never Item1 being a child of Item2. It is a data hierarchy that is specific for my app and has nothing to do with QT itself.

    In the QTreeView I wish to represent this hierarchy. When I click on either Item1 or Item2 in the QGraphicsView, I want to do two things:

    1. Highlight the object in the QTreeView
    2. Display in another docked window under the QTreeView a QTableView with the various editable properties of the object.

    Those two items are not an issue to do.

    My main problem is thus:
    The properties of the Item I clicked on can be set using controls: a text field, a combobox drop down, spinner controls, and just static text.

    Question 1: Does QTableView allow you to customise the type of control that is under each column?
    Question 2: Is there a better way of approaching this?

    I did take a look at the QStandardItem and QStandardItemModel but this did not seem to provide the droids I was looking for.


    Cheers!
    -Caolan.


    Added after 54 minutes:


    Update...

    I found more information. It appears that Delegates could be a solution to my woes. here's a sample of it: http://programmingexamples.net/wiki/...oBoxDelegate.h

    Opinions?!
    Last edited by Caolan O'Domhnaill; 15th October 2015 at 01:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: How to change the columnar controls in QTableView?

    Yes, delegates.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    Caolan O'Domhnaill (15th October 2015)

Similar Threads

  1. Change QTableview
    By wparja in forum Newbie
    Replies: 2
    Last Post: 12th September 2011, 17:38
  2. How can I change row heigth in QTableView?
    By Tamara in forum Qt Programming
    Replies: 8
    Last Post: 18th August 2011, 20:41
  3. Change QTableView orientation
    By r2d2u2 in forum Qt Programming
    Replies: 2
    Last Post: 31st May 2010, 10:30
  4. Replies: 2
    Last Post: 26th November 2009, 04:45
  5. Hiding controls changes spacing of other controls
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2007, 20:47

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
  •  
Qt is a trademark of The Qt Company.