[Solved] Cancelable dowloading dialog?
-
Hi,
I'm developing an app for Maemo. The app downloads some audio files from the server.
As the data downloads I would like to show the loading dialog.
Also I'd like it to have a "Cancel" button, which will stop the downloading if clicked.Is there any way to bind the downloading directly to the dialog, or do I have to implement threading myself?
-
You should implement cancellation by yourself. It will be not hard. Just close the connection and collect garbage.
-
To get progress info you can use signal
@
void QNetworkReply::downloadProgress ( qint64 bytesReceived, qint64 bytesTotal )
@For cancellation you can use either
@
void QNetworkReply::abort ()
@
or
@
void QNetworkReply::close ()
@Read about them in Assistant, they are slightlty different.
-
I'm having problems connecting the QNetworkReply signal.
My code:
@
QNetworkReply *reply = manager->post(request, data);
QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(downProg(qint64,qint64)))
@Gives an error:
no matching function to call to 'QObject:connect(QNetworkReply*&, const char*, MyClass* const, const char*)'
candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt:ConnectionType)'