Unsolved Animation with QPropertyAnimation and QTimer
-
@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 -
so? connect(anim1,SIGNAL(finished()),ui->label1,SLOT(setPixmap(pix)));
-
@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()));
-
the problem remains the same I do not understand why
-
@21sdino
but when animation is finished, your slot is called
and u can then set the pixmap you want?Im not sure which part is not working.
-
only it works in more cases than before but not in all
-
@21sdino
Ok, i cant tell. seems ok.
You should single step and see what is going on. -
i'm tring this from 2 days and i'don't find the solution
-
@21sdino
ok, but u need to use more QDebug and find out where it fails.
Sadly we cannot just guess it. Or at Least I cannot. -
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.