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

On Mac OS X Carbon, setMask() is not applied correctly

XMLWordPrintable

    • macOS

      On Mac OS X Carbon, a mask set on the top level window is not applied correctly. It seems that the position of the mask is ignored.

      Here is a code to reproduce the problem, the screenshots attached show the result on Cocoa and Carbon. The visual artefact on the left of the second window on Carbon disapears after the first repaint.

       
      //////////////////// 
      // sample code 
      //////////////////// 
      
      #include <QtGui> 
      #include <QtDebug> 
       
      int main(int argc, char *argv[]) 
      { 
          QApplication app(argc, argv); 
       
          /////////////// 
          // BUG widget 
          /////////////// 
          QWidget* qwBug = new QWidget (0 , Qt::Window |Qt::FramelessWindowHint); //bug 
          QPushButton* bt1 = new QPushButton(qwBug); 
          bt1->setText("Button 1"); 
          bt1->move(10,10); 
          bt1->show(); 
          QPushButton* bt2 = new QPushButton(qwBug); 
          bt2->setText("Button 2"); 
          bt2->move(110,10); 
          bt2->show(); 
       
          qwBug->setGeometry(100, 100, 210, 50); 
          qwBug->showNormal(); 
       
          // next line should chop the left 100 pixels 
          qDebug() << qwBug->geometry().width()-100; 
          qDebug() << qwBug->geometry().height(); 
          qwBug->setMask (QRect(100, 0, qwBug->geometry().width()-100, qwBug->geometry().height())); 
          qwBug->show(); 
       
          ////////////////// 
          // Normal Widget 
          ////////////////// 
          QWidget* qw = new QWidget (0 , Qt::Window ); //fine 
          QPushButton* bt3 = new QPushButton(qw); 
          bt3->setText("Button 3"); 
          bt3->move(10,10); 
          bt3->show(); 
          QPushButton* bt4 = new QPushButton(qw); 
          bt4->setText("Button 4"); 
          bt4->move(110,10); 
          bt4->show(); 
       
          qw->setGeometry(100, 200, 210, 50); 
          qw->showNormal(); 
       
          // next line should chop the left 100 pixels 
          qDebug() << qw->geometry().width()-100; 
          qDebug() << qw->geometry().height(); 
          qw->setMask (QRect(100, 0, qw->geometry().width()-100, qw->geometry().height())); 
          qw->show(); 
       
          return app.exec(); 
      }
      

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

            richard Richard Moe Gustavsen
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes