首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

关于Qt初始化的有关问题

2013-02-25 
关于Qt初始化的问题,求助我要初始化子控件在主窗口的相对位置,所以必须要创建了这个类之后,显示出来以后才

关于Qt初始化的问题,求助
我要初始化子控件在主窗口的相对位置,所以必须要创建了这个类之后,显示出来以后才能初始化,不知道Qt有没有类似MFC的InitialDlg这样的函数啊?
[解决办法]
木有,可以写在resizeEvent里。
[解决办法]
可以重载showEvent()
当QWidget被显式显示时,触发这个

void QWidget::showEvent ( QShowEvent * event ) [virtual protected]

This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter.

Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().
[解决办法]
在构造函数中应该也可以吧

热点排行