PDA

View Full Version : New here, old thread...



felipealencar
25th May 2009, 17:42
Well, first, sorry about the poor english (I do speak portuguese so...)...
So now, I'm a newbie with Qt, but I'm trying to do a little project with this...
Talking a little about the project: it's a process simulator (with politics like FIFO, STF, ...), and if I'm righ I will need three threads to implement what I want:

- The user can control process;
- The processing "animation" (some list showing the status of queues and the id of the process that is running);
- And the processing ...

If I'm in the wrong way please tell me hehe...

So, the first problem which I need some help is, what's the way to implement something like a counter number? But instead is the ID of the process that is running...
I'm using a line_edit to show the numbers but I can use anything that you guys recommend LOL...
I can show the number of the process, but not "animated" or counting you know?...

Well again sorry, and any help will be so much appreciate.
[]'s Cya!

wysota
25th May 2009, 19:23
You don't need three threads. One will be sufficient.

Try expressing your problem more clearly, I admit I can't understand what your problem is.

felipealencar
25th May 2009, 20:43
So... talking about the program:
- A mainwindow with some buttons (create process, block, unblock, kill), haa and with an animated list of the process (not implemented and one of my problems and doubt).\
- In the background I need to implement a function which will be executing the process createds by the users (with time slice, changes of process, etc.)...

So[2] I my mind (tired mind hehe), I only think in threads to make this program work simultaneos (user view, lists` animation and the mainfunctions)... some guys talk me about timers but I still not see how It could help me...

So[3], the first step is, I really need use the QThreads? Second: when i tried to use the threads at Qt is like the view of user (create process, etc.) has stoped to the other loop in the ``thread`` execute... but I post the code here later, well, again, it`s a horrible english but help me lol !

--

Ah talking about the animation, what`s the way to make something like:
char c;
while(c<`z`)
{
ui->line_edit->setText(c);
c++;
}
It`s works, but not like an animation hehe i mean how to show the `counter couting` to the user?and it`s what I need to know how to do... hmmm like a timer or something like this...

wysota
25th May 2009, 21:55
- A mainwindow with some buttons (create process, block, unblock, kill), haa and with an animated list of the process (not implemented and one of my problems and doubt).\
This one is easy, let's skip that for now.


- In the background I need to implement a function which will be executing the process createds by the users (with time slice, changes of process, etc.)...
You will need QProcess for this.


So[2] I my mind (tired mind hehe), I only think in threads to make this program work simultaneos (user view, lists` animation and the mainfunctions)... some guys talk me about timers but I still not see how It could help me...
You can use timers for animation so that you have constant frame rates but apart from that you probably won't need neither timers nor threads.


So[3], the first step is, I really need use the QThreads?
No, you don't. Unless you will be using some solutions where you can't avoid blocking the main thread.


Ah talking about the animation, what`s the way to make something like:
char c;
while(c<`z`)
{
ui->line_edit->setText(c);
c++;
}
It`s works, but not like an animation hehe i mean how to show the `counter couting` to the user?
How about using QProgressBar or QProgressDialog?

felipealencar
26th May 2009, 13:52
Huhuhu.. the QTimer makes what I want, :D...

But now, how it's a process simulator, you really think I will need to use QProcess? Because de "process" createds by the users will be only some nodes of one queue... If you could give me more details about that I appreciate again...

Ahh backing to the QTimer, it's execute the 'slot function' in times and times right?!

wysota
26th May 2009, 21:19
No, I thought you meant a process in terms of the operating system. If you just mean a procedure, then you might need threads (if you want to run more than one at the same time).