KM
Katty Misik10. November 2020 08:14

Qt animation scale

Добрый день, не могу сделать анимацию скалинг или плавное увеличение виджета
Буду очень благодарна
за помощ !

#include "errordialog.h"
#include "ui_errordialog.h"
#include <QMessageBox>
#include <QPropertyAnimation>
#include <QGraphicsColorizeEffect>
#include <QPushButton>
#include <QPoint>
#include <QMessageBox>
#include <QPropertyAnimation>
#include <QGraphicsColorizeEffect>

ErrorDialog::ErrorDialog(Error &error, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ErrorDialog)
{

    //  ErrorDialog::scale();
    ui->setupUi(this);
    ui->errorText->setText(error.value);
    if(error.priority==Error::Priority::Warning) {
        ui->mainLalbe->setStyleSheet("color: #ead637;"
                                     "font-size:25px;"
                                     "font-weight:500;");
        ui->mainLalbe->setText("Ostrzeżenie");
        //  this->setVisible(false);
    } else {
        ui->mainLalbe->setStyleSheet("color: rgb(208, 37, 31);"
                                     "font-size:18px;"
                                     "font-weight:bold;");
    }
    ui->sourceLabel->setText(error.source);
    ui->errorText->setWordWrap(true);
    ui->sourceLabel->setWordWrap(true);
    //ui->widget->setStyleSheet("border-image: url(:/img/error.png) 0 0 0 0 stretch stretch;");
    err = &error;
    setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::Popup | Qt::WindowStaysOnTopHint);




    //  connect(this, &ErrorDialog::reverseAnimStarted,
    //        [this] {animation_on = true; });


    //  this->setVisible(false);

    //Animator::dialogAnimationIfReverse(this, 0.0, 1.0, 1500, 1000);



    // m_button = new QPushButton("Close", this);
    //  ui->buttonBox->addWidget(StandardButton);

    // m_button->buttonBox;
    //   this.rect()
    //QPoint *newcenterpnt = ((ErrorDialog().rect()->topLeft+ErrorDialog().rect()->topRight)/2);

    //QPoint *newcenterpnt = this->topLeft+this->topRight / 2;
    //m_button->setGeometry(QRect(QPoint(100, 100), QSize(200, 50)));


    //this->gridLayout->addWidget(m_button);



    //  QWidget->addWidget(m_button);
    //  connect(m_button, SIGNAL (released()), this, SLOT (handleButton()));



}

void ErrorDialog::scale()

{


    //int mimsize = this->getSize->minimumSize();

    QPropertyAnimation *animation = new QPropertyAnimation(this, "scale");
    animation->setDuration(1500);
    animation->setStartValue(QSize(this->minimumSize()));
    animation->setEndValue(QSize(this->maximumSize()));

    //  this->setVisible(true);
    animation->start();
}

//void ErrorDialog::open()
//{
//animate(false);
//QDialog::open();
//}

//void ErrorDialog::done(int r)



//{
//if (!animation_on) {
// animate(true);
// setResult(r);
// if (r == QDialog::Accepted)
//  emit accepted();
//else if (r == QDialog::Rejected)
//    emit rejected();
//  emit finished(r);
//}
//}




//void ErrorDialog::animate(bool reverse)

//{


//emit reverseAnimStarted();

//  Animator::dialogAnimationIfElse(this, 1.0, 0.0, 1000, 1500 );
//}



ErrorDialog::~ErrorDialog()

{
    delete ui;
}



//void ErrorDialog::handleButton() {


//}

void ErrorDialog::on_buttonBox_rejected()
{
    err->clicked=true;
    err->dateAccepted = QDateTime::currentDateTime();
    Global::logger->add(*err);
}

void ErrorDialog::on_buttonBox_clicked(QAbstractButton *button)
{
    Q_UNUSED(button)
    err->dateAccepted = QDateTime::currentDateTime();


    //  emit reverseAnimStarted();

    //  Animator::dialogAnimationIfElse(this, 1.0, 0.0, 1000, 1500 );


}



//void ErrorDialog::showEvent(QShowEvent *event)
//{

//  Animator::dialogAnimationIfReverse(this, 0.0, 1.0, 1500, 1000);
//  ui->connectionLayout->addWidget(connection);
// QDialog::showEvent(event);
//}



//void Ui::ErrorDialog()
//{


//}

Рекомендуємо хостинг TIMEWEB
Рекомендуємо хостинг TIMEWEB
Stabiles Hosting des sozialen Netzwerks EVILEG. Wir empfehlen VDS-Hosting für Django-Projekte.

Magst du es? In sozialen Netzwerken teilen!

0

Kommentare

Nur autorisierte Benutzer können Kommentare posten.
Bitte Anmelden oder Registrieren
Letzte Kommentare
ИМ
Игорь Максимов5. Oktober 2024 07:51
Django – Lektion 064. So schreiben Sie eine Python-Markdown-Erweiterung Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
d
dblas55. Juli 2024 11:02
QML - Lektion 016. SQLite-Datenbank und das Arbeiten damit in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
k
kmssr8. Februar 2024 18:43
Qt Linux - Lektion 001. Autorun Qt-Anwendung unter Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lektion 007. Arbeiten mit ICMP-Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
EVA
EVA25. Dezember 2023 10:30
Boost - statisches Verknüpfen im CMake-Projekt unter Windows Ошибка LNK1104 часто возникает, когда компоновщик не может найти или открыть файл библиотеки. В вашем случае, это файл libboost_locale-vc142-mt-gd-x64-1_74.lib из библиотеки Boost для C+…
Jetzt im Forum diskutieren
J
JacobFib17. Oktober 2024 03:27
добавить qlineseries в функции Пользователь может получить любые разъяснения по интересующим вопросам, касающимся обработки его персональных данных, обратившись к Оператору с помощью электронной почты https://topdecorpro.ru…
JW
Jhon Wick1. Oktober 2024 15:52
Indian Food Restaurant In Columbus OH| Layla’s Kitchen Indian Restaurant If you're looking for a truly authentic https://www.laylaskitchenrestaurantohio.com/ , Layla’s Kitchen Indian Restaurant is your go-to destination. Located at 6152 Cleveland Ave, Colu…
КГ
Кирилл Гусарев27. September 2024 09:09
Не запускается программа на Qt: точка входа в процедуру не найдена в библиотеке DLL Написал программу на C++ Qt в Qt Creator, сбилдил Release с помощью MinGW 64-bit, бинарнику напихал dll-ки с помощью windeployqt.exe. При попытке запуска моей сбилженной программы выдаёт три оши…
F
Fynjy22. Juli 2024 04:15
при создании qml проекта Kits есть но недоступны для выбора Поставил Qt Creator 11.0.2. Qt 6.4.3 При создании проекта Qml не могу выбрать Kits, они все недоступны, хотя настроены и при создании обычного Qt Widget приложения их можно выбрать. В чем может …

Folgen Sie uns in sozialen Netzwerken