开发者

I can't seem to add a close button using Qt::WindowFlags

开发者 https://www.devze.com 2023-03-16 15:25 出处:网络
I have the following code that is called when I insert a QMdiSubWindow into a QMdiArea: Qt::WindowFlags 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 clos开发者_如何学运维ebutton 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?


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\

0

精彩评论

暂无评论...
验证码 换一张
取 消