• 6503阅读
  • 6回复

请教:第二次调用QWidget类的show()函数显示界面时,有延迟!!! [复制链接]

上一主题 下一主题
离线xuyantao
 
只看楼主 倒序阅读 楼主  发表于: 2008-05-30
— 本帖被 XChinux 执行加亮操作(2008-06-04) —
功能:在主界面中调用QRadarParaSetInterface,QRadarParaSetInterface是一个基于QWidget的类,里面有很多按钮。
主界面中调用QRadarParaSetInterface的代码如下:
    if(radarParaSetInterface == NULL){
        radarParaSetInterface = new QRadarParaSetInterface(this,0,WStyle_Customize|WStyle_Title);   
        radarParaSetInterface -> show();
    } else
        radarParaSetInterface -> show();

第一次调用QRadarParaSetInterface的时候,调用正常;然后我在QRadarParaSetInterface中使用radarParaSetInterface ->close(); 返回主界面。如果我调用QRadarParaSetInterface后什么也不做,再调用的时候没什么问题。
问题是:一旦我调用了QRadarParaSetInterface之后,进行一些操作(隐藏或者显示QRadarParaSetInterface中的一些按钮),返回主界面后再次调用它的时候,明显感觉QRadarParaSetInterface界面要延迟一下才能显示出来!!不知道怎么回事??请帮忙分析一下!
PS:radarParaSetInterface ->close(); 只是隐藏了自己,并没有销毁,因此再次调用的时候使用的就是else部分的代码。
[ 此贴被xuyantao在2008-05-30 12:40重新编辑 ]
离线xuyantao
只看该作者 1楼 发表于: 2008-06-02
我说的不清楚吗?没人回复。。。。。 
离线xuyantao
只看该作者 2楼 发表于: 2008-06-03
最后一次顶,期待答案中。。。
离线steinlee

只看该作者 3楼 发表于: 2008-06-04
People are talking about that Qt4 is slower than Qt3. This may be one of the problems. In theory, your code seems fine. One suggestion would be to destroy the instance and create a new one. Before you do it, you need to save all settings in a model class you create for this class. It is not a neat way. But you can try it if you feel annoyed with the problem. 
Looking for remote C/C++ and Qt 兼职
离线xuyantao
只看该作者 4楼 发表于: 2008-06-04
引用第3楼steinlee于2008-06-04 01:01发表的  :
People are talking about that Qt4 is slower than Qt3. This may be one of the problems. In theory, your code seems fine. One suggestion would be to destroy the instance and create a new one. Before you do it, you need to save all settings in a model class you create for this class. It is not a neat way. But you can try it if you feel annoyed with the problem.

Thanks for your help! In fact I use the same way to deal with this problem as your suggestion, and it works well. Thank you!
离线tangxunmin

只看该作者 5楼 发表于: 2009-06-22
为什么我的代码 和你的基本一样 但每次执行程序的 时候 都异常推出  调试的时候 总是指向->show()
这一句  知道怎么回事么
离线111111

只看该作者 6楼 发表于: 2013-03-18
radarParaSetInterface = new QRadarParaSetInterface(this,0,WStyle_Customize|WStyle_Title);    
这句话是不是应该放在if外面?要不你的else中对象是哪来的?或者这个对象已经在前面申明了,那就去掉此句,因为此句又建立了对象
快速回复
限100 字节
 
上一个 下一个