Structuring code for gui apps
I would like to ask you what is the best way to organize hand coded GUI. I am new to Qt and I need to start building large app
. I was thinking of making classes (as containers) for each toolbar or menu but than I would have object which consist objects (for example buttons or it can be buttons and another container with buttons than it would be another object inside) and I have no idea how can I connect all of them together because they don't have access to each other. I am just asking about the proper method for that.
Thanks for your help
Hi and welcome to devnet forum
Your questions are pretty general. Probably the best for you is to go through the different examples. This will you an impression and probably also the plan for your plan.
For connecting different buttons and other GUI elements you need to use Qt's signal-slot mechanism.
I would like to ask you what is the best way to organize hand coded GUI. I am new to Qt and I need to start building large app.
If you're about to build a large application, my best warm-hearted advice is to not hand-code your GUI. Use the designer for that.
- It will spare you hours upon hours of tweaking of margins and other such minor things.
- The code is more easily maintained.
- You can see what you're doing, especially relevant if you're new to Qt.
@nuke Hi! From "The Art of Unix Programming", Eric S. Raymond, (summary from wikipedia):
Rule of Generation:
Developers should avoid writing code by hand and instead write abstract high-level programs that generate code. This rule aims to reduce human errors and save time.
Or, like @kshegunov already said: Use Qt Designer ;-)
@nuke Thanks guys for your help but still i would like to know basic concept of writing GUIs without that.