You are not logged in.

Dear visitor, welcome to QtForum.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.

asGuestwhoNeedsHELP

Unregistered

1

Wednesday, October 13th 2004, 10:21am

BC: QProgressbar > How to scale ?

Hello all friendly Programmers,

i want to have a QProgressbar for a starting Dialogue of Programs. For starting programs I am using QProcess.

Practical: Imagine a Dialog with labels and buttons. You click on a start Button, then the external Program will be started. During the start time, the QProgressbar should indicate how much of the programstart have passed. At the End the Dialog should close itself.

It seems like a combination of the QProcess and the QProgressbar.

But I have no clue how to get the starting status of my external programs. I do either have no clue how deep in my operating system UNIX this information are stored.

I assume that a solution could make use of threading?

But the programs should run alone, if my QT app is closed.

I"m stucked.

Thanks for your thoughts!

. aGuestwhoNeedsHELP

e8johan

Professional

  • "e8johan" is male

Posts: 1,195

Location: Sweden

  • Send private message

2

Wednesday, October 13th 2004, 12:36pm

RE: BC: QProgressbar > How to scale ?

The problem with you suggested application is that you cannot know how long the child process has progressed unless it tells you. Anyhow, use QProcess to spawn your child process and a standard dialog to show the result. Perhaps you can listen to the stdout from the QProcess instance and get the progress from there.

You will not have to touch any Unix directly, to do this. Qt wraps all that you need.

aGuestwhoNeedsHelp

Unregistered

3

Thursday, October 14th 2004, 10:15am

Hello e8johan,

thank you for your reply.

Is there a tutorial from someone, who had done this already ?

.aGuestwhoNeedsHelp

hatulflezet

Professional

Posts: 1,301

Location: Munich Germany

Occupation: Programmer

  • Send private message

4

Thursday, October 14th 2004, 11:03am

Quoted

Perhaps you can listen to the stdout from the QProcess instance and get the progress from there.

It should be mentioned, that if the started program is not outputing progress information to the stdout (and most programs dont output "quantitive" output, rather status msges which you cant use for indicating progress with a progressbar) listening to the stdout will not help much.
Click here! I dare ya'!! :]
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"

aGuestwhoNeedsHelp

Unregistered

5

Thursday, October 14th 2004, 2:45pm

Hello hatulflezet,

thats also my problem.

Is there a way to get a Status, if the programm has really started ?

---
In the summary of the new QT Book 'Practical QT' stands a headline called "How do I implement a QProgressBar that shows time to completion?"

Perhaps this is a way to get it ?

hatulflezet

Professional

Posts: 1,301

Location: Munich Germany

Occupation: Programmer

  • Send private message

6

Thursday, October 14th 2004, 3:25pm

Quoted

Is there a way to get a Status, if the programm has really started

Both start() and loanch() return true on success.
So you can know if the program was started or not.
Click here! I dare ya'!! :]
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"

aGuestwhoNeedsHelp

Unregistered

7

Friday, October 15th 2004, 1:43pm

Hello all,

i sure have mispelled my problem.

I have the start time ( =0). I need the time, when the programm has finished loading and is User-ready.

That is not so easy.

.aGuestwhoNeedsHelp

hatulflezet

Professional

Posts: 1,301

Location: Munich Germany

Occupation: Programmer

  • Send private message

8

Friday, October 15th 2004, 2:52pm

Use QTime to mesure the time between when you call start()/launch() and when they return.
If start()/launch() returns true, your application should be "up and running".
But why would you need that?
Click here! I dare ya'!! :]
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"

aGuestwhoNeedsHelp

Unregistered

9

Monday, October 18th 2004, 8:51am

Hello hatulflezet,

i can mesure the time with QTime when the programm is coming up. Now I need to give this time to an Progressbar. This Progressbar should then display a 0-100% scale and run the time from the mesure of QTime.


1. QProcess is ordered to start the programm
2. QTime mesures the tim e till the programm is "up and running"
3. QProcess appears and run the mesured time from 0-100%.


I have understand your solve in this way. I have it not implemented yet, but I wonder how a QProcess object can be quick enough displayed, if the time first have to be mesured.

The mesured period is exactly the time, when the QProcess bar should progress.

The QProcess object should be an indicator of waiting time, till programm is finally "up and running". For example you sure know the status bar of KDE when you start it, and all the things have to load in memory. That is exactly my definition of a status bar. But I don't have functions that return loaded, like KDE's startup, because I am working directly with the system. Have I ?

.aGuestwhoNeedsHelp

hatulflezet

Professional

Posts: 1,301

Location: Munich Germany

Occupation: Programmer

  • Send private message

10

Monday, October 18th 2004, 9:02am

Quoted

I need the time, when the programm has finished loading and is User-ready.

Is very much different then:

Quoted

i can mesure the time with QTime when the programm is coming up. Now I need to give this time to an Progressbar. This Progressbar should then display a 0-100% scale and run the time from the mesure of QTime.


The first is not such a problem the second is, since if the started application is not preprogrammed to output progress information there is no way to know how much of its loading process is done.
The only way (if at all) to do that (to my knowlege) would be to tap somehow to the system it self and get the information from there.

To conclude this, since this thread starts to go in circles:
You can get confirmation to the successful (or not) loading of a started program.
You can know when the loading is finished - as stated above in this thread.
To my knowlege it is not possible to get the progress of the loading of a prgoram unless it is giving progress information.
Click here! I dare ya'!! :]
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"

Ilan

Trainee

  • "Ilan" is male

Posts: 78

Location: Israel

Occupation: Software engineer

  • Send private message

11

Monday, October 18th 2004, 9:50am

You can try to establish socked connection between your application and the launched process.

The progress bar information should be handled in the process and it should send notifications through the socket to your gui application. It should set the progress bar percentage according to the data it receives from the launched process.

aGuestwhoNeedsHelp

Unregistered

12

Monday, October 18th 2004, 10:42am

@hatulflezet: Ok, I now have hopefully understood the point of the problem. Thanks for convenience.

@Ilan: Your idea sounds very tricky, because I do not know much about socket connections. You perhaps have a tutorial or a specialized information source?

13

Wednesday, March 30th 2005, 9:51am

hi, aGuestwhoNeedsHelp
i v the same trouble with you ,i am a student , i want a progressBar to make my program beautiful, thanks ,waiting for answer!