开发者

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜