You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Sim

Unregistered

1

Monday, August 9th 2004, 3:19am

How to show a threaded QProgressBar on top of KDE

I am experimenting on an unofficial application that I added to
KDE, specifically to Konqueror source code.

This will perform download and upload over the Internet and SSL.

I would like to just place a simple progress bar that continually loops
while download or upload is being performed. No percentage, just indicator
to the user that the trasaction is taking place.

I plan to create a class derived from QThread w/c contains QProgressBar.
And plans to just show this just before download/upload starts and end it
just after the download/upload is finished.

I am confused as to how could I show this GUI/thread/ProgressBar?
Should I get "qApp" at "run" function and from threre set the widget as main
and could I do qApp->exec()? B

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Monday, August 9th 2004, 9:41pm

QThreads are not allowed to directly call GUI code, only the application's main thread, the event loop thread is allowed to.

If you just want to update a progress bar without doing anything besides updating, you can easily do this without threads using QTimer.

Anyway, if this is part of a KDE program upload and download over SSL or more specifically https can easily be handled through KIO.

You can use KIO::NetAccess for an easy API for this kind of transfers.

Cheers,
_
Qt/KDE Developer
Debian User

Sim

Unregistered

3

Tuesday, August 10th 2004, 4:10am

Hi anda_skoa:

That suggetion for https transfers api is okay had i known it beforehand.
What i am using is curlpp for all http transactions.

My question yesterday is actually this:

I just would like to show a progress bar gui
besides the integrated application i did in KDE-Konqueror.

KDE-Koqueror will show this progress bar while doing the https transfers.
I had a class that is based on a timer that updates the progress bar automatically.
The progress bar also is just a looping progress bar. Not dependent on anything,
as long as the transfers are taking place.

So, is it okay if I just throw in a new thread as the progress bar gui,
and be able to continue on the next statement of the code w/c will perform
the https transfer? Both running together, and from that main thead just
terminate the progress bar thread?

Thanks,
Sim

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Tuesday, August 10th 2004, 2:18pm

You can use the additional thread to do you transfer routine, you then have the even loop thread available to run the timer which updates the progress bar.

Anyway, I still think switching to KIO would be less work, as it already works, uses KDE's proxy settings and certificate handling, etc.

Cheers,
_
Qt/KDE Developer
Debian User