PDA

View Full Version : Program with many waidgets[how to]



"BumbleBee"
8th October 2011, 16:39
I will be making a large app with buttons that open additional Qwidgets.
What is the best way to orgg=anise the whole process?

Thanks

Zlatomir
8th October 2011, 17:29
Well - each widget will have it's own .h/.cpp (maybe .ui) files - i think this is, pretty much, already organized...
or i didn't understood you? Do you ask for some "design patterns" for the whole project?

"BumbleBee"
8th October 2011, 19:00
The project will be like: Main form and many buttons leading each one to a different widget(I want a new form to appear for each widget).
I have created the main window and added a Form class > widget.
Then how do I link the buttons of the main form to open any widget I have?

wysota
9th October 2011, 09:46
Use signals and slots. Possibly with QSignalMapper.

"BumbleBee"
9th October 2011, 10:06
Well I already found a way to do this.
I made an object of the widget class in me main .h file and then just used this object(.show()),in a slot.
Is that ok if I do it for like 10 widgets?
And how slow my program gonna be if i make all those 10 widgets(10 more classes..:/)

wysota
9th October 2011, 10:54
I have no idea what you mean.

ChrisW67
9th October 2011, 22:13
And how slow my program gonna be if i make all those 10 widgets(10 more classes..:/)

It sounds like you are creating 10 widget objects in your main window constructor and only show()-ing them when a button is pressed. This is less efficient than it could be memory-wise (versus creating each widget only when requested), but unless it makes the machine starting pushing things out to disc cache it will have little impact on speed.

"BumbleBee"
10th October 2011, 12:44
It sounds like you are creating 10 widget objects in your main window constructor and only show()-ing them when a button is pressed. This is less efficient than it could be memory-wise (versus creating each widget only when requested), but unless it makes the machine starting pushing things out to disc cache it will have little impact on speed.

Well,I would like the widgets to save some things(like listview),so that I write something to it and then when I open it again it should be there...