[Qt-interest] How to close s subwindow?

donglongchao donglongchao at 163.com
Tue Nov 10 15:55:49 CET 2009






在2009-11-10,"John McClurkin" <jwm at nei.nih.gov> 写道:
>donglongchao wrote:
>> Hi,all
>> 
>> I have a problem when I develop a MDI app whose UI was create by QT 
>> Designer.The two subwindows of MdiArea were created by right-click on 
>> MdiArea widget and then choose "add subwindow" from the pop menu.When I 
>> start the app,both of the two subwindows appears,but I just want one of 
>> them to appears.So I find two function called void *closeActiveSubWindow 
>> <http://doc.trolltech.com/4.5/qmdiarea.html#closeActiveSubWindow>* () 
>> and void *closeAllSubWindows 
>> http://doc.trolltech.com/4.5/qmdiarea.html#closeAllSubWindows>* ().But 
>> neither of them is what I need.I just want a function who can close some 
>> certain subwindow I want to close. Is there any function like that ,but 
>> I missed somewhere?
>
>If closeActiveSubWindow() or closeAllSubWindows() won't work for you, 
>you will have to write your own function that iterates over all the 
>subwindow to find the one you want to close.

It is not a good news for me.:-(.Maybe I should suggestion the developers of QT to add some function like that.:-)
>Or I could reach my goal(start the app with only one
>> subwindow appears) through other better way?Any suggestions are welcomed.
>
>You can write your app so that only one subwindow appears on startup. 
>You can also write your app so that no subwindows appear on startup. 
>Whether a subwindow is shown depends on whether you call show() on the 
>object.
>
If you add subwindows by QT Designer as I descributed above(right click,choose add subwindow..etc),you would get all your subwindows appears when your app start.Because there will be a line of code says "mdiAero->addSubwindow(xxx)" in the generated head file named ui_xxx.h which will show all the subwindows.Unfortunately we could not modify the ui_xxx.h file by hand and I did not find some property to set in QT Designer to determine which subwindow should appear and which one should not ,too.I also tried the hide() function.But I can only hide the widgets on the subwindow but not the subwindow itself.I got a blank subwindow left.:-(.I think the only way is remove the subwindows from mdiArea in order to let them disappears.If this methond is not conventence,I have to setup my subwindows in different .ui files but not intergrate them together in one big .ui file like I am doing now.
Any way,thank you for your suggestions,John McClurkin.
>> Thanks a lot in advance.
>> 
>> Longchao
>> 
>> 
>> 
>> ------------------------------------------------------------------------
>> "Ñ©¼û"ÑîÃÝÑûÄ㹲Ʒ3D¹úÔÏÍøÓΡ¶ÌìÏ·¡¡·£¬º£±¨Ãâ·ÑÁì 
>> <http://allyes.nie.163.com/main/adfclick?db=afanie&bid=1258,613,23&cid=147,4,1&sid=1355&show=ignore&url=http://tx2.163.com/fab.html> 
>> 
>_______________________________________________
>Qt-interest mailing list
>Qt-interest at trolltech.com
>http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091110/6c1a6716/attachment.html 


More information about the Qt-interest-old mailing list