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:

Qt Code:
  1. QWidget* titleBar;
  2. ...
  3. QObject::connect( this, SIGNAL(topLevelChanged(bool)), this, SLOT(setUseNativeTitleBar(bool)) );
  4. ...
  5. void setUseNativeTitleBar(bool native)
  6. {
  7. if ( native ) {
  8. // restoring native
  9. setTitleBarWidget(0);
  10. } else {
  11. // using custom
  12. setTitleBarWidget(titleBar);
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 

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.