我似乎无法使用 Qt::WindowFlags 添加关闭按钮
当我将 QMdiSubWindow 插入 QMdiArea 时,将调用以下代码:
Qt::WindowFlags flags;
flags = Qt::Widget | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint;
if(closeable)
{
qDebug("Window is closeable. %x", Qt::WindowCloseButtonHint);
flags |= Qt::WindowCloseButtonHint;
}
由于某种原因,即使 closeable 为 true,关闭按钮也不会显示在小部件的标题栏上。
这是将小部件插入 QMdiArea 的调用。
mdi->addSubWindow(widget, flags);
有什么建议吗?
I have the following code that is called when I insert a QMdiSubWindow into a QMdiArea:
Qt::WindowFlags flags;
flags = Qt::Widget | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint;
if(closeable)
{
qDebug("Window is closeable. %x", Qt::WindowCloseButtonHint);
flags |= Qt::WindowCloseButtonHint;
}
For some reason, even when closeable is true, the closebutton won't display on the widget's titlebar.
This is the call to insert the widget into the QMdiArea.
mdi->addSubWindow(widget, flags);
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现尝试使用 sdk 中包含的窗口标志示例对尝试正确获取标志有很大帮助。
C:\QtSDK\Examples\4.7\widgets\windowflags\
I found that playing around with the window flags example included with the sdk was a lot of help when trying to get the flags correct.
C:\QtSDK\Examples\4.7\widgets\windowflags\