Animation with QPropertyAnimation and QTimer
-
I want that when the timer ends the icon appears to be illuminated
but this does not work
connect (timer, SIGNAL (timeout ()), UI- <label1, SLOT (setPIxmap (pix));@21sdino
nope
that is not valid syntax :)
connect (timer, SIGNAL (timeout ()), UI- <label1, SLOT (setPIxmap (pix));
You cannot just call a function like that with a random parameter. You must use a slot function that
has same parameters as the signal. here signal is timeout () and it has no parameters.So Its not how it works. Did u study ?
http://doc.qt.io/qt-5/signalsandslots.htmlyou could hook up
http://doc.qt.io/qt-5/qabstractanimation.html#finishedand then call
setPIxmap (pix) in that slot -
@21sdino
so that is still wrong u cannot just use a random function as slot. u must make your own :)
mainwinow.h
slots:
void AnimFinished();.cpp
void mainwindow::AnimFinished() {
setPIxmap (pix); /// here its legal
}connect(anim1,SIGNAL(finished()),ui->label1,SLOT(AnimFinished()));
-
Could you please explain in detail what you want to do ?
Your code does not seem to be very structured.
As @mrjj says we can only guess what you are doing.I think you have to remove your QGraphicsOpacityEffect after animation ends (ui->label2->setGraphicsEffect(NULL);) because your end value is 0.3 and this means it has no full opacity.