[Solved] Segmentation fault with dynamic property animation.



  • Hello!

    I am new to Qt and c++. I am writing a little program which has some fancy animated buttons. I am animating it's background with QPropertyAnimation, but let the code speak instead of me:

    @void AnimatedButton::enterEvent(QEvent *){
    QPropertyAnimation *animation = new QPropertyAnimation(this, "backgroundColor");
    animation->setDuration(500);
    animation->setStartValue(getBackgroundColor());
    animation->setEndValue(QColor(0, 153, 204));
    animation->setLoopCount(1);
    animation->start();
    }@

    The problem with it that when I use the 'backgroundColor' property dinamically (to make it editable from the QDesigner) I get a segmentation fault. If I use it as a static property, everything works fine. Here's the segmentation fault dump (or how it's called): http://pastebin.com/yU9unLF5

    Does anybody know what I'm doing wrong? I want to access that property from the Designer.

    EDIT

    I found out that I get segmentation fault whenever I use property() or setProperty() function.

    SOLVED

    Okay, I was dumb. I used property and setProperty functions in the custom widgets' class. That was a problem. I missunderstood the documentation, I thought I should use them there too, but it works as the static properties. Anyway, sorry for wasting your time for this.



  • Well, we all make dumb mistakes, learning from them is the hard part ;-)
    Please update the title of this topic to [SOLVED] <title>, that will make sure no other helpers get stuck reading a solved topic ;-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.