PDA

View Full Version : Combining different widgets



ShaChris23
30th April 2007, 23:13
Hi guys,

Newbie question here, so sorry if it isnt clear.

My environment is Windows, MS VC++ .NET 2005. I use VS Integration and Designer.

My GUI app is going to be composed of many widgets. Since this is my first Qt GUI app, I plan to build each widget as a standalone first to test if each behaves properly. I plan to build each widget with Designer. Each widget will be a thread since it needs to communicate with a serial port, and displaying the values received.

Question is if I do that, each widget will have the .ui file of its own...then would my final widget be able to have all the different UI's listed in the project?

marcel
30th April 2007, 23:19
Yes, of course. You can do that. You either arrange your widgets in a layout, or add the to a QStackedWidgget, or whatever. It doesn't matter at this stage if you plan to use multiple threads, you can do this part later.

For more details, you'll have to be more clear.
Anyway, your final widget ( that will contain all the other widgets ) will most likely be a QMainWindow or a QDialog.

Also, when using Designer you can promote some standard widgets to custom widgets, that you design yourself, either with the Designer, or by yourself.

Regards

jacek
1st May 2007, 00:22
Each widget will be a thread
Before you start doing anything with threads in Qt, read this carefully: http://doc.trolltech.com/4.2/threads.html (esp. the part that says that all widgets must live in the GUI thread, aka the main thread).

high_flyer
1st May 2007, 02:23
In addition to what jacek said, the fact the widgets need to communicate with the serial port does not automaticaly mean threads are needed.
Don't use thread unless you HAVE to.
If you exmplain the requirements of your app, we might be able to help you decide if threads are needed.
Most likely, if its not a real time super fast constant reading from the serial port, you can achieve what you want with timers.