summaryrefslogtreecommitdiffstats
path: root/examples/network/http/main.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-17 15:56:30 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-11-05 13:54:13 +0000
commitd482a92858f181c76229dc977ee9c159ba36515f (patch)
tree429e985974655f5e2ebb2f2738ed54bd1fec682e /examples/network/http/main.cpp
parentf13d8163ec80afdb0051897dc705598ea2691725 (diff)
Polish the HTTP example.
- Remove unneeded member variables. - Use new connection syntax. - Streamline code. - Add a QCheckBox for launching the file after download and make the default file name and download directory configureable. - Make status messages more verbose. - Set Password echo mode on authentication dialog. - Extract the progress dialog to a separate class that is directly connected to the QNetworkReply, which is created on demand. Set set minimum and duration on it. This fixes a crash that currently occurs when clicking "Abort" on the SSL error dialog and "Cancel" on the progress dialog that is then re-shown due to its internal force timer/minimum duration handling. - Resize according to screen size. Task-number: QTBUG-48332 Change-Id: Ia2611e63fe96d6f49e4cdd06049a206ddb2c2864 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'examples/network/http/main.cpp')
-rw-r--r--examples/network/http/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/network/http/main.cpp b/examples/network/http/main.cpp
index 5857af265c..b4960008ec 100644
--- a/examples/network/http/main.cpp
+++ b/examples/network/http/main.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include <QApplication>
+#include <QDesktopWidget>
#include <QDir>
#include "httpwindow.h"
@@ -47,8 +48,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
-
HttpWindow httpWin;
+ const QRect availableSize = QApplication::desktop()->availableGeometry(&httpWin);
+ httpWin.resize(availableSize.width() / 5, availableSize.height() / 5);
+ httpWin.move((availableSize.width() - httpWin.width()) / 2, (availableSize.height() - httpWin.height()) / 2);
httpWin.show();
return app.exec();