qt程序的运行方式
求大神解释一下qt程序从编译到运行的过程,还有为什么一定要有QApplicationa(argc,argv)对象。...
求大神解释一下qt程序从编译到运行的过程,还有为什么一定要有QApplication a(argc,argv)对象。
展开
2个回答
展开全部
qassistant中有对QApplication的详细说明。
对于QApplication它有如下说明:
It initializes the application with the user's desktop settings such as palette(), font() and doubleClickInterval(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.
It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. By using sendEvent() and postEvent() you can send your own events to widgets.
It parses common command line arguments and sets its internal state accordingly. See the constructor documentation below for more details.
It defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
It specifies how the application is to allocate colors. See setColorSpec() for details.
It provides localization of strings that are visible to the user via translate().
It provides some magical objects like the desktop() and the clipboard().
It knows about the application's windows. You can ask which widget is at a certain position using widgetAt(), get a list of topLevelWidgets() and closeAllWindows(), etc.
It manages the application's mouse cursor handling, see setOverrideCursor()
大意是它要负责初始化应用、处理窗口事件、分析命令行的参数、定义程序外观、字符串的本地化、提供了一些魔术对象、了解窗口的基本信息、管理程序的鼠标指针处理等。要具体弄清楚的话就读qassistant。
对于QApplication它有如下说明:
It initializes the application with the user's desktop settings such as palette(), font() and doubleClickInterval(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.
It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. By using sendEvent() and postEvent() you can send your own events to widgets.
It parses common command line arguments and sets its internal state accordingly. See the constructor documentation below for more details.
It defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
It specifies how the application is to allocate colors. See setColorSpec() for details.
It provides localization of strings that are visible to the user via translate().
It provides some magical objects like the desktop() and the clipboard().
It knows about the application's windows. You can ask which widget is at a certain position using widgetAt(), get a list of topLevelWidgets() and closeAllWindows(), etc.
It manages the application's mouse cursor handling, see setOverrideCursor()
大意是它要负责初始化应用、处理窗口事件、分析命令行的参数、定义程序外观、字符串的本地化、提供了一些魔术对象、了解窗口的基本信息、管理程序的鼠标指针处理等。要具体弄清楚的话就读qassistant。
2015-05-20
展开全部
你是怎么说的啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询