QPropertyAnimation funktioniert nicht
-
Hallo,
folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:
/** * @brief MainMenuWidget::btnMenuClicked */ void MainMenuWidget::btnMenuClicked() { qDebug() << this; QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth"); animation.setDuration(500); if(isMaximized()) { setProperty("defaultWidth", width()); //setMaximumWidth(m_config["minimizedWidth"].toInt()); animation.setStartValue(width()); animation.setEndValue(m_config["minimizedWidth"].toInt()); } else { //setMaximumWidth(property("defaultWidth").toInt()); animation.setStartValue(width()); animation.setEndValue(property("defaultWidth").toInt()); } animation.start(QAbstractAnimation::DeleteWhenStopped); }Die Konsolenausgabe dazu ist:
MainMenuWidget(0x26eb99ac210, name="menuContainer") QPropertyAnimation::updateState (): Changing state of an animation without targetIch verstehe es nicht. Das Object in "this" hat geerbt von QWidget.
Ich wäre dankbar für eure Hilfe.
-
Hallo,
folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:
/** * @brief MainMenuWidget::btnMenuClicked */ void MainMenuWidget::btnMenuClicked() { qDebug() << this; QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth"); animation.setDuration(500); if(isMaximized()) { setProperty("defaultWidth", width()); //setMaximumWidth(m_config["minimizedWidth"].toInt()); animation.setStartValue(width()); animation.setEndValue(m_config["minimizedWidth"].toInt()); } else { //setMaximumWidth(property("defaultWidth").toInt()); animation.setStartValue(width()); animation.setEndValue(property("defaultWidth").toInt()); } animation.start(QAbstractAnimation::DeleteWhenStopped); }Die Konsolenausgabe dazu ist:
MainMenuWidget(0x26eb99ac210, name="menuContainer") QPropertyAnimation::updateState (): Changing state of an animation without targetIch verstehe es nicht. Das Object in "this" hat geerbt von QWidget.
Ich wäre dankbar für eure Hilfe.
@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
Ohmann, das Problem liegt hier:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");Das Sternchen bei der declaration als Pointer hat gefehlt.
So is richtig:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth"); -
Hallo,
folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:
/** * @brief MainMenuWidget::btnMenuClicked */ void MainMenuWidget::btnMenuClicked() { qDebug() << this; QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth"); animation.setDuration(500); if(isMaximized()) { setProperty("defaultWidth", width()); //setMaximumWidth(m_config["minimizedWidth"].toInt()); animation.setStartValue(width()); animation.setEndValue(m_config["minimizedWidth"].toInt()); } else { //setMaximumWidth(property("defaultWidth").toInt()); animation.setStartValue(width()); animation.setEndValue(property("defaultWidth").toInt()); } animation.start(QAbstractAnimation::DeleteWhenStopped); }Die Konsolenausgabe dazu ist:
MainMenuWidget(0x26eb99ac210, name="menuContainer") QPropertyAnimation::updateState (): Changing state of an animation without targetIch verstehe es nicht. Das Object in "this" hat geerbt von QWidget.
Ich wäre dankbar für eure Hilfe.
-
Hallo,
folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:
/** * @brief MainMenuWidget::btnMenuClicked */ void MainMenuWidget::btnMenuClicked() { qDebug() << this; QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth"); animation.setDuration(500); if(isMaximized()) { setProperty("defaultWidth", width()); //setMaximumWidth(m_config["minimizedWidth"].toInt()); animation.setStartValue(width()); animation.setEndValue(m_config["minimizedWidth"].toInt()); } else { //setMaximumWidth(property("defaultWidth").toInt()); animation.setStartValue(width()); animation.setEndValue(property("defaultWidth").toInt()); } animation.start(QAbstractAnimation::DeleteWhenStopped); }Die Konsolenausgabe dazu ist:
MainMenuWidget(0x26eb99ac210, name="menuContainer") QPropertyAnimation::updateState (): Changing state of an animation without targetIch verstehe es nicht. Das Object in "this" hat geerbt von QWidget.
Ich wäre dankbar für eure Hilfe.
@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
Ohmann, das Problem liegt hier:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");Das Sternchen bei der declaration als Pointer hat gefehlt.
So is richtig:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth"); -
S sp3x has marked this topic as solved on
-
@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
Ohmann, das Problem liegt hier:
QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");Das Sternchen bei der declaration als Pointer hat gefehlt.
So is richtig:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?
Mit auto kannst Du das gleiche Problem vermeiden.
auto animation = new QPropertyAnimation(this, "maximumWidth"); -
@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?
Mit auto kannst Du das gleiche Problem vermeiden.
auto animation = new QPropertyAnimation(this, "maximumWidth");@JoeCFD said in QPropertyAnimation funktioniert nicht:
Mit auto kannst Du das gleiche Problem vermeiden.
Ist das nicht eine schlechte Angewohnheit
autozu oft zu nutzen?(Isn't this a bad habit/style to use
autotoo often? In theory, you could replace almost every variable withauto, but then your code would be a mess or at least harder to understand) -
@JoeCFD said in QPropertyAnimation funktioniert nicht:
Mit auto kannst Du das gleiche Problem vermeiden.
Ist das nicht eine schlechte Angewohnheit
autozu oft zu nutzen?(Isn't this a bad habit/style to use
autotoo often? In theory, you could replace almost every variable withauto, but then your code would be a mess or at least harder to understand) -
@sp3x said in QPropertyAnimation funktioniert nicht:
QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?
Mit auto kannst Du das gleiche Problem vermeiden.
auto animation = new QPropertyAnimation(this, "maximumWidth");