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

Windows: QClipboard failed to set QImage with transparency

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P2: Important
    • 5.4.0
    • 4.6.3, 5.3.0, 5.3.1
    • QPA: Windows
    • Windows 7 Enterprise, 32bit, English
    • 9150563940f61be9fb17510be49c0734244866a5 (dev, 4.7.2014)

    Description

      Steps:
      1. Create a QImage object with transparency.
      2. QClipboard::setImage to set clipboard, save teh QImage to a PNG file also.
      3. Paste the clibpard to word or other applications.
      Note: the transparent pixels were filed with black.
      This looks like a regression on 4.6.3. (I didn't find it on 4.6.2)

      Please use the code below to recreate this defect:

      #include <QtCore>
      #include <QApplication>
      #include <QClipboard>
      #include <QPainter>
      #include <QImage>
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          QImage img( 100, 100, QImage::Format_ARGB32_Premultiplied );
          img.fill( QColor(Qt::transparent).rgba() );
          
          {
              QPainter painter( &img );
              painter.setBrush( Qt::blue );
              painter.drawPie( 20, 20, 50, 50, 45 * 16, 135 * 16 );
          }
      
          QApplication::clipboard()->setImage( img );
          img.save( "C:/test.png" );
      
          return 0;
      }
      

      Attachments

        1. qtbug11463.zip
          3 kB
        2. white_bg.png
          white_bg.png
          43 kB

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              aladdina Mason Chang
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes