咸宁原来也有帅锅啊,点击主窗口后产生的子窗口抛到主窗口后面怎么解决,怎么都点不到子窗口

求助,QT如何主窗口中点击一个按钮,进入到子窗口,主窗口隐藏_qt吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:29,237贴子:
求助,QT如何主窗口中点击一个按钮,进入到子窗口,主窗口隐藏收藏
炫酷暗黑奇迹MU页游强悍来袭,秒怪秒BOSS,奇迹重生,来玩就送海量礼包!
有人问过这问题
假设主窗口为w子窗口为d点击后w-&hided-&show看可行不
子窗口的parentWidget()就是主窗口parentWidget()-&show();主窗口就出来了,前提是:关闭主窗口用hide()
可以在母窗类里绑定子窗的信号和母窗的槽函数,如果碰到子窗类必须包含母窗类指针,头文件相互包含的情况,可以用类的声明前置
获取顶级指针Macro DocumentationqAppA global pointer referring to the unique application object. It is equivalent to the pointer returned by the QCoreApplication::instance() function except that, in GUI applications, it is a pointer to a QApplication instance.Only one application object can be created.See also QCoreApplication::instance().
楼主你这个问题解决了吗,看到可以回复一下吗,急用!
按键:按下子窗口show出来不久行了
VS2015新建qt项目,选择文件存储位置后按确定不能进入qt项目向导界面,,而是闪一下,又回到原来界面
这个是为什么
哪个大神给指导一下
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或查看: 2856|回复: 2|关注: 0
如何在主窗口中关闭所有子窗口
<h1 style="color:# 麦片财富积分
新手, 积分 5, 距离下一级还需 45 积分
刚接触matlab GUI,想在主界面上做一个关闭按钮,用来关闭所有子窗口,请指教!:handshake
<h1 style="color:# 麦片财富积分
关注者: 1
直接在该按钮的回叫函数加
close(GUI1);
close(GUI2);
GUI1等是你子GUI的名字。
<h1 style="color:# 麦片财富积分
回复 2# wanggang198501 的帖子
谢谢了,哎,这么简单,见笑了!
站长推荐 /2
Powered by主窗口点击按钮后又创建了一个新的子窗口,在关闭子窗口时主窗口也关闭了 - 『 提问交流 』 -
AUTOIT CN AutoIt中文论坛|acn|au3|软件汉化 - 分享您的技术!
帖子127&精华0&积分87&威望10 点&金钱11 块&贡献3 分&阅读权限20&在线时间112 小时&注册时间&最后登录&
主窗口点击按钮后又创建了一个新的子窗口,在关闭子窗口时主窗口也关闭了
大侠们帮帮忙看看我这个问题:
主窗口上点击按钮,然后调用另外的窗口脚本,创建了一个子窗口出来,但在关闭子窗口时会将程序一起退出去,大家有没有办法可以只关闭子窗口,而不影响到主窗口,下次再主窗口上点击按钮后,又可以拉起这个子窗口来。
帖子275&精华0&积分558&威望135 点&金钱2115 块&贡献150 分&阅读权限50&在线时间266 小时&注册时间&最后登录&
#include &GUIConstantsEx.au3&
_Main&#40;&#41;
_Main&#40;&#41;
& & & & ;Initialize variables
$GUIWidth = 250, $GUIHeight = 250
$ParentWin, $ParentWin_Pos, $ChildWin, $msg
& & & & ;Create main/parent window
$ParentWin = &#40;&父窗体&, $GUIWidth, $GUIHeight&#41;
& & & & ;Save the position of the parent window
& & & & $ParentWin_Pos = &#40;$ParentWin, &&&#41;
& & & & ;Show the parent window/Make the parent window visible
& & & & &#40;&#41;
& & & & ;Create child window and add the parameter to make it the child of the parent window
$ChildWin = &#40;&子窗体&, $GUIWidth, $GUIHeight, $ParentWin_Pos&#91;0&#93; + 100, $ParentWin_Pos&#91;1&#93; + 100, -1, -1, $ParentWin&#41;
& & & & ;Show the child window/Make the child window visible
& & & & &#40;&#41;
& & & & ;Switch to the parent window
& & & & &#40;$ParentWin&#41;
& & & & ;Loop until:
& & & & ;- user presses Esc when focused to the parent window
& & & & ;- user presses Alt+F4 when focused to the parent window
& & & & ;- user clicks the close button of the parent window
& & & & & & & & ;After every loop check if the user clicked something in the GUI windows
& & & & & & & & $msg = &#40;1&#41;
& & & & & & & &
& & & & & & & & & & & & ;Check if user clicked on a close button of any of the 2 windows
& & & & & & & & & & & &
$msg&#91;0&#93; = $GUI_EVENT_CLOSE
& & & & & & & & & & & & & & & & ;Check if user clicked on the close button of the child window
& & & & & & & & & & & & & & & &
$msg&#91;1&#93; = $ChildWin
& & & & & & &#40;64, &测试&, &您关闭了子窗体.&&#41;
& & & & & & & & & & & & & & & & & & & & ;Switch to the child window
& & & & & & & & & & & & & & & & & & & & &#40;$ChildWin&#41;
& & & & & & & & & & & & & & & & & & & & ;Destroy the child GUI including the controls
& & & & & & & & & & & & & & & & & & & & &#40;&#41;
& & & & & & & & & & & & & & & & & & & & ;Check if user clicked on the close button of the parent window
& & & & & & & & & & & & & & & &
$msg&#91;1&#93; = $ParentWin
& & & & & & &#40;64, &测试&, &您关闭了父窗体.&&#41;
& & & & & & & & & & & & & & & & & & & & ;Switch to the parent window
& & & & & & & & & & & & & & & & & & & & &#40;$ParentWin&#41;
& & & & & & & & & & & & & & & & & & & & ;Destroy the parent GUI including the controls
& & & & & & & & & & & & & & & & & & & & &#40;&#41;
& & & & & & & & & & & & & & & & & & & & ;Exit the script
& & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & &
& & & & & & & &
& ;==&_Main
复制代码 高亮切换
D:\autoit3\Examples\GUI\Simple\child.au3
骑白马的不一定是王子,
也许他是唐僧。
长翅膀的不一定是天使,
也许他是鸟人。
帖子127&精华0&积分87&威望10 点&金钱11 块&贡献3 分&阅读权限20&在线时间112 小时&注册时间&最后登录&
给的例子固然可以只是关闭子窗口,但是再用父窗口开创建子窗体依然创建不起来。
帖子706&精华0&积分498&威望26 点&金钱5660 块&贡献93 分&阅读权限30&在线时间402 小时&注册时间&最后登录&
本帖最后由 xiehuahere 于
19:38 编辑
andyloving
& & 在 2# 的基础上改了下:#include &GUIConstantsEx.au3&
Local $ParentWin, $ChildWin, $msg
$ParentWin = GUICreate(&父窗体&, 250, 250)
$Button = GUICtrlCreateButton(&Popup&, 75, 150, 100, 35)
GUISetState()
While 1
& & & & ;After every loop check if the user clicked something in the GUI windows
& & & & $msg = GUIGetMsg()
& & & & Switch $msg
& & & & & & & & Case $GUI_EVENT_CLOSE
& & & & & & & & & & & & Exit
& & & & & & & & Case $Button
& & & & & & & & & & & & GUISetState(@SW_DISABLE)
& & & & & & & & & & & & $ChildWin = GUICreate(&子窗体&, 200, 200, -1, -1, -1, -1, $ParentWin)
& & & & & & & & & & & & GUISetState()
& & & & & & & & & & & & Do
& & & & & & & & & & & & Until GUIGetMsg() = $GUI_EVENT_CLOSE
& & & & & & & & & & & & GUIDelete($ChildWin)
& & & & & & & & & & & & GUISetState(@SW_ENABLE)
& & & & & & & & & & & & GUISetState(@SW_RESTORE)
& & & & EndSwitch
WEnd复制代码
帖子127&精华0&积分87&威望10 点&金钱11 块&贡献3 分&阅读权限20&在线时间112 小时&注册时间&最后登录&
找到方法了,谢谢两位。我的方法如下:#include &ButtonConstants.au3&
#include &GUIConstantsEx.au3&
#include &WindowsConstants.au3&
#Region ### START Koda GUI section ### Form=
$Form = GUICreate(&Form1&, 429, 155, 192, 124)
$Button = GUICtrlCreateButton(&Button1&, 216, 48, 137, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
& & & & $nMsg = GUIGetMsg()
& & & & Switch $nMsg
& & & & & & & & Case $GUI_EVENT_CLOSE
& & & & & & & & & & & & Exit
& & & & & & & & Case $Button
& & & & & & & & & & & &&&XIXI()
& & & & EndSwitch
WEnd
;子窗口
Func XIXI()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate(&Form1&, 460, 155, 400, 124)
$Button1 = GUICtrlCreateButton(&Button1&, 216, 48, 137, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$show= True
While $show
& & & & $nMsg = GUIGetMsg()
& & & & Switch $nMsg
& & & & & & & & Case $GUI_EVENT_CLOSE
& & & & & & & & & & & & GUIDelete($Form1)
& & & & & & & & & & & & $show=False
& & & & & & & & Case $Button1
& & & & & & & & & & & & MsgBox(0,0,0)
& & & & EndSwitch
WEnd
EndFunc复制代码
帖子275&精华0&积分558&威望135 点&金钱2115 块&贡献150 分&阅读权限50&在线时间266 小时&注册时间&最后登录&
不知这个适合你胃口不?
#include &GUIConstantsEx.au3&
$mainwindow = &#40;&Hello World&, 300, 200&#41;
&#40;&Hello world! How are you?&, 30, 10&#41;
$okbutton = &#40;&opened the subform&, 20, 30, 150&#41;
$dummywindow = &#40;&Dummy window for testing &, 200, 100&#41;
&#40;$mainwindow&#41;
&#40;&#41;
& $msg = &#40;1&#41;
$msg&#91;0&#93; = $okbutton
& & & &#40;,$dummywindow&#41;
$msg&#91;0&#93; = $GUI_EVENT_CLOSE
$msg&#91;1&#93; = $mainwindow
$msg&#91;0&#93; = $GUI_EVENT_CLOSE
$msg&#91;1&#93; = $dummywindow
& & & & & &#40;,$dummywindow&#41;
复制代码 高亮切换
骑白马的不一定是王子,
也许他是唐僧。
长翅膀的不一定是天使,
也许他是鸟人。
帖子127&精华0&积分87&威望10 点&金钱11 块&贡献3 分&阅读权限20&在线时间112 小时&注册时间&最后登录&
这个也是个不错的方法,非常感谢你!
帖子62&精华0&积分31&威望0 点&金钱224 块&贡献0 分&阅读权限10&在线时间37 小时&注册时间&最后登录&
好技术&&强帖
[通过 QQ、MSN 分享给朋友]

我要回帖

更多关于 抛锅 的文章

 

随机推荐