Kirell
Kirell

Reputation: 9798

Elegant way for general controller (GUI based application)

I was wondering, is there an elegant way to organize the main controller for a gui. For instance, a controller manages clicks and updates from different widgets in the gui.

This controller calls many subcontrollers for the different part of the app, still in my main I have a horrible:

int main( int argc, char** argv )
{
    QApplication a(argc, argv);
    Manager m;
    return a.exec();
}

and the Manager is something like

Manager::Manager( QObject *parent )
: QObject(parent)
, serv( new Services::ServiceManager(this) )
, window( new Gui::WindowManager(this) )
, blablaManager

There is always a need for a root class which links all the subparts together, if you have ideas.

Thanks!

Upvotes: 0

Views: 154

Answers (1)

Thomas Matthews
Thomas Matthews

Reputation: 57688

You can always have a more "elegant" solution with another level of indirection. However, at some point, the elegance outweighs the performance, scheduling and maintenance costs.

Making a "generic" GUI may not justify the cost for a company that only produces 2 or three different GUIs.

Upvotes: 1

Related Questions