Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Printing the contents of a QTableWidget
Forum Update on Monday, May 27th 2025

Printing the contents of a QTableWidget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koplersky
    wrote on last edited by
    #1

    I need to print the contents of a QTableWidget, keeping a table-like structure.
    The easiest way I found was to generate an HTML code from the table data and then pass it to a QWebView widget.

    The problem is that I'm using Qt 4.7.3, which has a bug in Windows that causes the QWebView's "print" slot to print only blank pages. I can't update the SDK because it's being widely used in our projects.

    After googling a lot, I've found a workaround: use a QTextEdit or other similar widget and then call its "print" slot. But that don't quite suit my needs because the HTML subset is too restricted. I could not even apply a border to the table, let alone set more complex attributes.

    I've then tried to subclass QPainter and add the patch lines manually, but I've got into a lot of trouble for trying to access private members.

    What else could I try to solve my problem?
    I really appreciate any advice on this.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi
      Did you try some Report engines?
      "KDReports":http://www.kdab.com/kdab-products/kd-reports/
      "QtRS":http://sourceforge.net/projects/qtrs/
      "QtRPT":http://sourceforge.net/projects/qtrpt/
      "OpenRPT":http://www.xtuple.com/openrpt
      or here
      "qt-apps":http://qt-apps.org/index.php?xcontentmode=4240

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved