Slowing down the close of the download dialog with 2 seconds to avoid unpeasant flashing dialogs.

This commit is contained in:
Kjell Kernen
2014-03-04 17:03:54 +01:00
parent 0b83d9e0d7
commit bb767ca863
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -2,6 +2,7 @@
#include "ui_downloaddialog.h"
#include <QMessageBox>
#include <QtGui>
#include <QTime>
#include "helpers.h"
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
@@ -87,3 +88,14 @@ void downloadDialog::fileError()
file = 0;
reject();
}
void downloadDialog::closeEvent( QCloseEvent * event)
{
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
QTime closeTime= QTime::currentTime().addSecs(2);
while( QTime::currentTime() < closeTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
event->accept();
}
+1
View File
@@ -27,6 +27,7 @@ private slots:
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private:
void closeEvent( QCloseEvent * event);
Ui::downloadDialog *ui;
QNetworkAccessManager qnam;