KM
Katty MisikNov. 10, 2020, 7:14 p.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!
Ua
- Unknown akadamn
- Jan. 24, 2025, 5:14 p.m.
Qt - Test 001. Signals and slots
- Result:84points,
- Rating points4
Ua
- Unknown akadamn
- Jan. 24, 2025, 4:22 p.m.
Qt - Test 001. Signals and slots
- Result:42points,
- Rating points-8
Last comments
ИМ
Django - Tutorial 017. Customize the login page to Django Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
Игорь МаксимовNov. 22, 2024, 9:51 p.m.

Evgenii LegotckoiOct. 31, 2024, 11:37 p.m.
Fb3 file reader on Qt Creator Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
ИМ
Django - Lesson 064. How to write a Python Markdown extension Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
Игорь МаксимовOct. 5, 2024, 4:51 p.m.
QML - Lesson 016. SQLite database and the working with it in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
Now discuss on the forum
f
Рисование на QGraphicsScene при зажатой кнопке мыши Подскажите, пожалуйста! Как данный класс можно дополнить, чтобы созданные объекты можно было перемещать мышкой по сцене?
firstlunoxodFeb. 15, 2025, 1:46 p.m.

ДмитрийFeb. 3, 2025, 4:24 p.m.
не запускается компьютер!!! Не запускается компьютер (точнее работает блок , но сам монитор вообще жесть)В общем я ничего с интернета не скачивала в последнее время. На компе никаких левых пр…
Нужно запретить перемещение только некоторых итемов, остальные перемещать можно. Вопрос решен. Узнать QModelIndex элемента на который мы перетаскиваем другой элемент, можно с помощью функции indexAt(event->position().toPoint()) представления QTreeViev вызываемой в переопр…
OAuth2.0 через VK, получение email Спасибо большое за помощь и простите за то что отнял время своей невнимательностью.