Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, March 2007
Re: Creating threads in Qt/X11


Message 1 in thread

you need to subclass your designer class. if you created a main window in designer, you would have 
something like

class MyMainWindow : public QMainWindow, public Ui:MainWindow
{
// ...
};

I would suggest looking into the book "C++ GUI Programming with Qt 4" [1], everything described 
nicely in there..

manu.


[1] amazon link:
http://tinyurl.com/38c3ka


Pankaj wrote:
> Hello,
>  
> I am new to Qt/X11. I am now working on the Qt Designer. I want to 
> create a new thread in Qt.
>  
> My question is:
>  
> The Designer has embedded all the event handling code in the ui.h file. 
> I know that to create a thread in Qt, we subclass from QThread class. 
> But where can I create a subclass of QThread? Can I create this in ui.h 
> or create another .cpp file and include the .cpp file in ui.h?
>  
> Any help/suggestions would be very helpful. Also how can I add new 
> member variables to a form in Designer. Adding new functions to form is 
> very simple.
>  
> Thank you.
>  
> Pankaj.
>  

--
 [ signature omitted ] 

Message 2 in thread

> you need to subclass your designer class. if you created a main 

WRONG!
1.) You must NEVER put GUI-related stuff into a seperate thread!
2.) He's using Qt3 - that's why "uic" is creating all class-code he needs.

Just subclass from QThread with an editor of your choice, write your 
thread code and create that thread at a reasonable position in your code. 
Don't forget to add your new source/header files to the .pro file.

Regards,
Malte


--
 [ signature omitted ] 

Message 3 in thread

oh, sorry - have been reading his post too fast I guess.


Malte Witt wrote:
>> you need to subclass your designer class. if you created a main 
> 
> WRONG!
> 1.) You must NEVER put GUI-related stuff into a seperate thread!
> 2.) He's using Qt3 - that's why "uic" is creating all class-code he needs.
> 
> Just subclass from QThread with an editor of your choice, write your 
> thread code and create that thread at a reasonable position in your code. 
> Don't forget to add your new source/header files to the .pro file.
> 
> Regards,
> Malte
> 
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 4 in thread

Hello,

I am new to Qt/X11. I am now working on the Qt Designer. I want to create a new thread in Qt. 

My question is:

The Designer has embedded all the event handling code in the ui.h file. I know that to create a thread in Qt, we subclass from QThread class. But where can I create a subclass of QThread? Can I create this in ui.h or create another .cpp file and include the .cpp file in ui.h?

Any help/suggestions would be very helpful. Also how can I add new member variables to a form in Designer. Adding new functions to form is very simple.

Thank you.

Pankaj.

Message 5 in thread

On Mon, March 12, 2007 10:45, Pankaj wrote:
> I am new to Qt/X11. I am now working on the Qt Designer. I want to create
> a new thread in Qt.

The Designer is only for GUI work. For the real code you need to use an
actual editor. It is called "programming", not "clicking"... ;-)



    Konrad

--
 [ signature omitted ] 

Message 6 in thread

Thanks, Konrad. I do understand that to create threads in Qt, we need to
write the code. I am writing an application where I have already developed
the GUI using the Designer.

My question is: can I write the code in the actual editor and then include
the same in the ui.h code, using #include directive? As I need to integrate
both these code snippets.

Thank you.

Pankaj.

----- Original Message ----- 
From: "Konrad Rosenbaum" <konrad@xxxxxxxxx>
To: "Pankaj" <pankaj@xxxxxxxxxxxxx>
Cc: <qt-interest@xxxxxxxxxxxxx>
Sent: Monday, March 12, 2007 12:37 AM
Subject: Re: Creating threads in Qt/X11


> On Mon, March 12, 2007 10:45, Pankaj wrote:
> > I am new to Qt/X11. I am now working on the Qt Designer. I want to
create
> > a new thread in Qt.
>
> The Designer is only for GUI work. For the real code you need to use an
> actual editor. It is called "programming", not "clicking"... ;-)
>
>
>
>     Konrad
>
>


--
 [ signature omitted ]