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

Carbon : Setting palette brush to a pixmap does not work.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.1
    • 4.6.1
    • None
    • None
    • Carbon only, tested on Snow Leopard.
    • 2d0e06a495b5c5a723997eef9618fdd7a7bc98b1

    Description

      Setting the palette brush to a pixmap does not work on Carbon. It works on Cocoa, windows and Linux.

      On carbon instead of the pixmap being shown a transparent window is shown.

      As in the commented out code in the example, setting the same pixmap as a brush inside the paint event works ok.

      //set a png file in MyWidget constructor
      #include <QtGui>
      
      class MyWidget: public QWidget
      {
      public:
          MyWidget(QWidget *parent = 0);
      protected:
          virtual void paintEvent ( QPaintEvent * event );
      
      private:
         QImage img;
         QPixmap pixmap;
      };        
      
      MyWidget::MyWidget(QWidget *parent) : QWidget(parent) 
      {
          setWindowTitle("Qt Tester paintEvent");
          img.load("../../../qt-logo.png");
          pixmap = QPixmap::fromImage(img);
      
          //setting a pixmap as the brush on carbon does not show the image.
                  QBrush brush;
                  brush.setTexture(pixmap);
                  brush.setStyle(Qt::TexturePattern);
                  QBrush b2(pixmap);
                  QPalette pal;
                  pal.setBrush(QPalette::Window,b2);
                  setPalette(pal);
      }
      
      void MyWidget::paintEvent( QPaintEvent * event){
          QPainter painter(this);
      
      //The brush is used in this example on all platforms.
      
      //    QBrush brush;
      //    brush.setTexture(pixmap);
      //    brush.setStyle(Qt::TexturePattern);
      //    QBrush b2(pixmap);
      //    painter.setBrush(b2);
      //    painter.drawRoundedRect(0,0,100,100,5,5);
      //    painter.drawText(20,20,"Qt");
       }
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          MyWidget *myWin = new MyWidget();
          myWin->show();
          return app.exec();
      }
      
      

      Attachments

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

        Activity

          People

            cduclos Carlos Duclos (Inactive)
            dettman Dean Dettman (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