View Full Version : setWindowOpacity()
TheKedge
2nd February 2006, 19:18
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
high_flyer
2nd February 2006, 21:46
did you rebuilt your project agaist the new version of Qt?
TheKedge
3rd February 2006, 10:48
Yep. and if I comment out the setWindowOpactiy() call thingts go quickly (without fading, of course)
K
Everall
3rd February 2006, 14:46
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
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:
#include <QtGui>
class CFadeWidget : public QWidget
{
Q_OBJECT
public:
CFadeWidget(QWidget * apParent = NULL) : QWidget(apParent)
{
setAutoFillBackground(true);
setAttribute(Qt::WA_NoSystemBackground, false);
setWindowOpacity(0.0);
mFadeTimer.setInterval(50);
connect(&mFadeTimer, SIGNAL(timeout()), this,
SLOT(nextFadeStep()));
mFadeTimer.start();
}
protected slots:
virtual void nextFadeStep()
{
qreal opacity = windowOpacity()+0.1;
setWindowOpacity(opacity);
if (opacity >= 1.0)
{
mFadeTimer.stop();
emit opaque();
}
}
signals:
void opaque();
void transparent();
private:
QTimer mFadeTimer;
};
#include "main.moc"
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QWidget w;
w.show();
CFadeWidget fader;
fader.show();
return a.exec();
}
TheKedge
3rd February 2006, 15:08
Oops, I suggested you to go to version 4.1 in another post
Yes, you did:mad:
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
Powered by vBulletin® Version 4.2.5 Copyright © 2023 vBulletin Solutions Inc. All rights reserved.