Results 1 to 7 of 7

Thread: Draw on a QTableWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Draw on a QTableWidget

    How do you trigger the paintEvent? By calling update? Or dont't you trigger it by yourself and only let Qt trigger it when neccessary?
    It's nice to be important but it's more important to be nice.

  2. #2
    Join Date
    Jan 2006
    Location
    England
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw on a QTableWidget

    I'm letting Qt call the event whenever it wants to. It seems to do it whenever a cell is selected or deselected and when it is moved. The function is definitely being called though.

    I can even reproduce the problem in a minimal program where the only thing I do is create the custom table and try to draw in it's paintEvent function.

  3. #3
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Draw on a QTableWidget

    From http://doc.trolltech.com/4.1/qabstra...tml#paintEvent
    void QAbstractScrollArea:aintEvent ( QPaintEvent * event ) [virtual protected]

    This event handler can be reimplemented in a subclass to receive paint events (passed in event), for the viewport() widget.

    Note: If you open a painter, make sure to open it on the viewport().

    Reimplemented from QWidget.

    See also QWidget:aintEvent().
    Maybe this helps
    It's nice to be important but it's more important to be nice.

  4. The following user says thank you to axeljaeger for this useful post:

    Corran (30th December 2006)

  5. #4
    Join Date
    Jan 2006
    Location
    England
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw on a QTableWidget

    That sorted it, thanks a lot. I'd only read the QWidget paintEvent documentation. It didn't occur to me that it would be subclassed halfway through the system like that.

Similar Threads

  1. want to draw points in QGraphicsScene
    By ntp in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2008, 18:14
  2. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  3. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 19th December 2006, 23:27
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.