QDockWidget and setting/unsetting titleBarWidget
Hi, I'm working on dock-based application and recently I've decided to use my own titleBarWidgets. It works great, but the downfall is we lose native fell & look when going into undocked state (at least on Win7).
So what I was trying to do was to connect to topLevelChanged signal and then in slot either set my custom widget as titleBarWidget (going into docked state) or set titleBarWidget to 0 (undocked), thus returning native window decorations. So code looks roughly like this:
Code:
...
QObject::connect( this,
SIGNAL(topLevelChanged
(bool)),
this,
SLOT(setUseNativeTitleBar
(bool)) );
...
void setUseNativeTitleBar(bool native)
{
if ( native ) {
// restoring native
setTitleBarWidget(0);
} else {
// using custom
setTitleBarWidget(titleBar);
}
}
Now it seems to work just fine, but more than often it results in assertion failure during undocking (especially when stacking widgets horizontally):
ASSERT: "!(item.flags & QDockAreaLayoutItem::GapItem)" in file widgets\qdockarealayout.cpp, line 1082
So my question is: is changing titleBarWidget in this manner even possible? If so, how to get it working?
Oh yes, and I'm using Qt 4.7.1.
Re: QDockWidget and setting/unsetting titleBarWidget
I have the very same issue. Could someone from QT confirm doing this is wrong?
Re: QDockWidget and setting/unsetting titleBarWidget
I have exact same issue.
ASSERT: "!(item.flags & QDockAreaLayoutItem::GapItem)" in file c:\ndk_buildrepos\qt-desktop\src\gui\widgets\qdockarealayout.cpp, line 1082
I'm working with Qt 4.7.4 on WinXP.
This is a very old thread. Had you resolved this issue?
Re: QDockWidget and setting/unsetting titleBarWidget
Unfortunately not. The error was nested too deep inside Qt code. Because of that I switched to non-native titlebars.