Results 1 to 4 of 4

Thread: print QTableWidget

  1. #1
    Join Date
    May 2006
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default print QTableWidget

    I'm trying to print a QTableWidget so I create a QPixmap like this

    QPixmap pixGroupe = QPixmap::grabWidget(this); // this == QTableWidget
    QPrinter * printDvce = new QPrinter;
    QPainter paintr(printDvce);
    paintr.drawPixmap(pixGroupe);

    the probleme with this code is that I can't get all the QtableWidget contents in the pixmap,
    I've juste get the visible region of the table. (viewport + visible part of the headers ).

    is Any one can tell what can I do to print all the content of QtableWidget ?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: print QTableWidget

    Give this a try.
    J-P Nurmi

  3. #3
    Join Date
    May 2006
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: print QTableWidget

    thank you for this reply.
    T tried your code with QPainter's powerful redirecting mecanism.
    but the probleme is that I get only the contents ( the viewport()) of the QTableWidget
    without the horzontal and the vertical header and without any widget painted inside the content of the table. can you have any Idea ?

    I linked to this post a screenshot of the table I want to print(table.jpg)
    and the pixmap that I obtained with your code (PrintResult1.jpg)
    Attached Images Attached Images

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: print QTableWidget

    Quote Originally Posted by chak_med View Post
    the probleme is that I get only the contents ( the viewport()) of the QTableWidget
    without the horzontal and the vertical header and without any widget painted inside the content of the table.
    So you are using cell widgets? I guess you would have to do the corresponding "redirecting + paint event" -trick for headers and all the cell widgets as well.
    J-P Nurmi

Similar Threads

  1. parsing QtableWidget from a QStackedWidget
    By rosmarcha in forum Qt Programming
    Replies: 10
    Last Post: 13th October 2006, 14:36
  2. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  3. QTableWidget Update - slow
    By DPinLV in forum Qt Programming
    Replies: 16
    Last Post: 18th August 2006, 21:09
  4. Replies: 6
    Last Post: 5th March 2006, 21:05
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34

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.