Results 1 to 4 of 4

Thread: QDockWidget and setting/unsetting titleBarWidget

  1. #1
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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:

    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.

  2. #2

    Default Re: QDockWidget and setting/unsetting titleBarWidget

    I have the very same issue. Could someone from QT confirm doing this is wrong?

  3. #3
    Join Date
    Jan 2012
    Location
    ShangHai, PRC of China
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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?

  4. #4
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

Similar Threads

  1. Replies: 1
    Last Post: 7th December 2010, 21:46
  2. Replies: 0
    Last Post: 13th October 2010, 13:57
  3. Help with QDockWidget
    By mindbender in forum Qt Programming
    Replies: 6
    Last Post: 10th March 2010, 16:13
  4. Unsetting transparency
    By Pavel Abrosimov in forum Qt Programming
    Replies: 2
    Last Post: 8th October 2009, 12:14
  5. QDockWidget and more
    By Carlsberg in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2009, 09:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.