Results 1 to 6 of 6

Thread: QTableView with widgets

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableView with widgets

    Hi,

    I have a QTableView with four columns.

    I use setIndexWidget to put the widgets into the various cells, thus in column one I have a QCheckBox, col 2 a QSlider, col 3 a QLineEdit and col 4 a QToolButton. All these are in the first row of the table. Now if I wanted to add another row would it be possible to use the widgets in row1 and put them into row2? How many of these widgets could I have before the table view would grind to a halt?!

    Thanks,
    Steve

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView with widgets

    No, you'd have to create another set of widgets.

    How many widgets? Not many

    Consider using a QScrollArea instead of the view.

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView with widgets

    Hi,

    QScrollArea? Can this act like a table or do I just add various widgets to the scroll area using setWidget?

    Regards,
    Steve

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView with widgets

    If you add a header and program the whole thing to resize the widgets under it, I don't see a problem. Right now you are trying to use a table without items which doesn't make much sense and slows you down.

  5. #5
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView with widgets

    Thanks for that,

    So I'd have a QScrollView and place a QHeaderView inside it and then use headerData to supply the data for each section of the header?

    Regards,
    Steve

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView with widgets

    Do whatever you want. QHeaderView is a very limited class - it's not even a view at all... Not everything might work there - but I wish you luck, this is a very interesting issue.

  7. The following user says thank you to wysota for this useful post:

    steg90 (22nd November 2007)

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23
  3. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  4. Replies: 11
    Last Post: 7th July 2006, 13:09
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.