[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->setEndValue(QColor(0, 153, 204));

    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.


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


    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.