Results 1 to 2 of 2

Thread: custom table widget: possible?

  1. #1
    Join Date
    Jul 2012
    Posts
    248
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    29
    Thanked 15 Times in 14 Posts

    Default custom table widget: possible?

    hey,

    i implemented a custom gui widget for a software i am working on, but was wondering if there`s maybe a better way.
    The widget i need is a complex widget to visually represent a bunch of custom data.
    It`s ordered in rows and columns, just like a list or table view.

    But: i have to render custom graphical content to every cell AND i have to render all the content, ie all the cells, at once.
    Another problem is, that the amount of rows is not fixed and known but depends on multiple factors, most importantly the preceding rows.
    I would also have to draw custom connections (lines, arrows, ...) across multiple cells.
    To top it off, the view has to be constantly refreshed, so speed is an issue, too.

    The software was actually written for another gui toolkit, where especially the bolded factor could not be implemented.
    Thus, a custom widget was written which provides all this, including custom drawn columns, etc.

    When i ported all this to Qt, i didnt spend much though on whether there was a better way, but copied it 1:1, using a QAbstractScrollArea as a base class.
    This works fine.
    But in the meantime, i have seen so much of Qt`s power that i keep thinking: there`s gotta be a better way to do this, making use of a pre-defined table widget or something.


    I checked out all the table views i could find (tablewidget, listwidget, table view, list view), but i was unable to find anything on drawing all cells at once in one handler and on drawing content across the whole thing.

    does anyone have hint/tips/ideas on this?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Wiki edits
    15

    Default Re: custom table widget: possible?

    You can derive your table from QTableView and reimplment the cell painting (custom cell paintings). Try searching the forum for "custom QTableView"
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Custom widget table sort
    By giantdragon in forum Qt Programming
    Replies: 10
    Last Post: 10th June 2011, 13:36
  2. Validator for the table widget item in table
    By mukunda in forum Qt Programming
    Replies: 4
    Last Post: 7th June 2011, 00:07
  3. Custom widget won't size properly in a table cell
    By zeroknowledge in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2011, 17:32
  4. Edit table for my own table-widget
    By MasterMatrix in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2010, 08:05
  5. Table Widget Vs. Table View
    By winston2020 in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2008, 10:56

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.