Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-4149

QPixmap::grabWidget() produces a QPixmap of a wrong size if the widget hasn't been resized previously

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 4.7.0
    • 4.5.2, 4.6.0
    • GUI: Painting
    • None
    • 951cceac68b4a6cf38da83b69dcde2c8109342a2

    Description

      The widget itself is painted in a correct size, but has a very thick border over the rest of the QPixmap.
      Two possible workarounds are:
      1) w.show(); and then call the grabWidget()

      or

      2) w.resize(..., ...); and then grabWidget()

      Reproducible with the following code:

      #include <QtGui>
      #include <QDebug>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      QTreeWidget w;
      QPixmap pixmap = QPixmap::grabWidget(&w);
      pixmap.save("widget.png");
      return 0;
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kkalland Kim Motoyoshi Kalland (Inactive)
            mpejcoch Martin Pejcoch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes