KM
Katty MisikNov. 10, 2020, 8:14 a.m.
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() //{ //}
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.Do you like it? Share on social networks!
B
- Bogdannn
- March 27, 2024, 7:15 p.m.
C++ - Test 001. The first program and data types
- Result:46points,
- Rating points-6
Last comments
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
АК
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
Анатолий КононенкоFeb. 5, 2024, 1:50 a.m.
EVADec. 25, 2023, 10:30 a.m.
Boost - static linking in CMake project under Windows Сделал всё по-как у вас, но выдаёт ошибку [build] LINK : fatal error LNK1104: не удается открыть файл "libboost_locale-vc142-mt-gd-x64-1_74.lib" Хоть убей, не могу понять в чём дел…
Qt/C++ - Lesson 056. Connecting the Boost library in Qt for MinGW and MSVC compilers Для решения твой проблемы добавь в файл .pro строчку "LIBS += -lws2_32" она решит проблему , лично мне помогло.
Now discuss on the forum
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Евгений, добрый день! Такой вопрос. Верно ли следующее утверждение: Любое Android-приложение, написанное на Java/Kotlin чисто теоретически (пусть и с большими трудностями) можно написать и на C+…
Павел ДорофеевApril 14, 2024, 2:35 a.m.
Вернуть старое поведение QComboBox, не менять индекс при resetModel Добрый день! У нас много проектов в которых используется QComboBox, в версии 5.5.1, когда модель испускает сигнал resetModel, currentIndex не менялся. В версии 5.15 при resetModel происходит try…
Как получить в массив значения из связанной модели? Спасибо, разобрался:))
AC
QML Обнулить значения SpinBox Доброго времени суток, не могу разобраться с обнулением значение SpinBox находящего в делегате. import QtQuickimport QtQuick.ControlsWindow { width: 640 height: 480 visible: tr…
Alexandru CodreanuJan. 19, 2024, 11:57 a.m.