Structuring code for gui apps



  • Hi,

    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


  • Moderators

    @nuke

    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.


  • Qt Champions 2016

    @nuke
    Hello,

    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.

    1. It will spare you hours upon hours of tweaking of margins and other such minor things.
    2. The code is more easily maintained.
    3. You can see what you're doing, especially relevant if you're new to Qt.

    Kind regards.



  • @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.