Results 1 to 5 of 5

Thread: setWindowOpacity()

  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default setWindowOpacity()

    wow,
    I was calling
    <QmainWindow>setWindowOpacity();
    repeatedly for a fade out in my qt 4.0.1 app and it was fine.

    I've just updated to qt 4.1.0 and it's terrible - slow, jumpy and 100%cpu.

    Am I doing something wrong?

    K

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: setWindowOpacity()

    did you rebuilt your project agaist the new version of Qt?

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: setWindowOpacity()

    Yep. and if I comment out the setWindowOpactiy() call thingts go quickly (without fading, of course)

    K

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setWindowOpacity()

    I've just updated to qt 4.1.0 and it's terrible - slow, jumpy and 100%cpu.
    Oops, I suggested you to go to version 4.1 in another post

    this is a bug already filed to the trolls. You could try the latest snapshot instead seems it's resolved in 4.1.1

    bug 94296 - setWindowOpacity flickers and deactivates window on Windows
    Qt Code:
    1. Using the following code to fade in a window works fine with 4.0, but produces an unacceptable flicker and activation-change for each call to setWindowOpacity with 4.1-RC1:
    2.  
    3. #include <QtGui>
    4.  
    5. class CFadeWidget : public QWidget
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. CFadeWidget(QWidget * apParent = NULL) : QWidget(apParent)
    11. {
    12. setAutoFillBackground(true);
    13. setAttribute(Qt::WA_NoSystemBackground, false);
    14. setWindowOpacity(0.0);
    15. mFadeTimer.setInterval(50);
    16. connect(&mFadeTimer, SIGNAL(timeout()), this,
    17. SLOT(nextFadeStep()));
    18. mFadeTimer.start();
    19. }
    20.  
    21.  
    22. protected slots:
    23. virtual void nextFadeStep()
    24. {
    25. qreal opacity = windowOpacity()+0.1;
    26.  
    27. setWindowOpacity(opacity);
    28.  
    29. if (opacity >= 1.0)
    30. {
    31. mFadeTimer.stop();
    32. emit opaque();
    33. }
    34. }
    35.  
    36.  
    37. signals:
    38. void opaque();
    39. void transparent();
    40.  
    41.  
    42. private:
    43. QTimer mFadeTimer;
    44.  
    45. };
    46.  
    47. #include "main.moc"
    48.  
    49. int main(int argc, char **argv)
    50. {
    51. QApplication a(argc, argv);
    52.  
    53. w.show();
    54.  
    55. CFadeWidget fader;
    56. fader.show();
    57.  
    58. return a.exec();
    59. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: setWindowOpacity()

    Oops, I suggested you to go to version 4.1 in another post
    Yes, you did
    but I can't hold it against you - this is a peace, love and help your neighbour type of place - a techno-hippy place. The forum is great.

    thanks for your help,
    K

Similar Threads

  1. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 11:05
  2. setWindowOpacity doesn't work!
    By nupul in forum Qt Programming
    Replies: 5
    Last Post: 21st April 2006, 19:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.