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

A frameless Window with opacity animation turns black at the end of animation.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.2, 5.1.0 Beta 1
    • 5.0.0
    • GUI: Painting
    • None
    • Windows (Windows 7), Mac (OSX 10.7)
    • b3820b12fbded1f173837eee7f7559783e92b46b , fixup 67bed5616bf4743b432566130d1f3cfb6a2dc0c1, yet another fix: bc741b867cbff58f59c2698d22a37121ebcc6c50

    Description

      With Qt5, a frameless window with opacity animation turns black at the end of animation. To make it refresh/update, you need to move your mouse over buttons. This issue only happens with Qt5.

      #include <QApplication>
      #include <QPushButton>
      #include <QHBoxLayout>
      #include <QPropertyAnimation>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      
      	// Create transparent popup window.
      	QWidget* popup = new QWidget(NULL, Qt::WindowFlags(Qt::FramelessWindowHint | Qt::ToolTip));
      	popup->setWindowFlags(Qt::FramelessWindowHint | Qt::ToolTip);
      	popup->setAttribute(Qt::WA_TranslucentBackground);
      
      	// Add button to popup window.
      	QHBoxLayout* layout = new QHBoxLayout(popup);
      	QPushButton* button1 = new QPushButton(popup);
      	button1->setFixedSize(200, 300);
      	layout->addWidget(button1);
      	QPushButton* button2 = new QPushButton(popup);
      	button2->setFixedSize(200, 300);
      	layout->addWidget(button2);
      
      	// Create opacity animation.
      	QPropertyAnimation* fadeInAnimation = new QPropertyAnimation(popup, "windowOpacity");
      	fadeInAnimation->setDuration(1000);
      	fadeInAnimation->setStartValue(0.0);
      	fadeInAnimation->setEndValue(1.0);
      
      	// Show popup
      	popup->setWindowOpacity(0.0);
      	fadeInAnimation->start();
      	popup->show();
      
      	return a.exec();
      }
      

      Attachments

        1. screenshot-1.jpg
          screenshot-1.jpg
          69 kB
        2. qtbug29010.zip
          2 kB
        3. qtbug29010_2.zip
          2 kB

        Issue Links

          Activity

            People

              kleint Friedemann Kleint
              junozz Juno Kwak
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: