[SOLVED] Window Title Disappearing on Mac after Hide in 5.2.0, didn't happen in 5.1.2

  • This could be related to this issue here: "https://bugreports.qt-project.org/browse/QTBUG-33011

    I create a dialog box, which displays properly with the window title (and minimize, maximize and close buttons).
    After I hide it, change its location, then change its colors, set the window flags, and after I show it again with window title bar is gone.

    This wasn't a problem in 5.1.2, but appeared in 5.2.0. In 5.1.2 I set the window flags like this:

    @setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);@

    and I had no problems until 5.2.0. I tried 5.2.1 (current stable branch), and the problem is still there. But if I set the window flags like this:

    @setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);@

    then I get the title bar back.

    So I have a workaround, but it seems like a regression to me.

    I can come up with a (hopefully) small test case if needed. I'm running on Mac OS 10.8.5.

  • Lifetime Qt Champion


    Yes, a test case would be very good

  • (I tried posting this reply once, and it disappeared into the ozone... hope this attempt fares better)

    I got a simple test case :) I built it with 5.2.1 (stable) and the problem occurs. If I build it with 5.1.0, no problem (the window title stays put).

    @#include <QApplication>
    #include <QDialog>
    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QDialog *dialog = new QDialog();

    dialog->show(); // appears with window title


    Qt::Dialog |
    Qt::CustomizeWindowHint |

    dialog->show(); // in 5.1, window title is there but not in 5.2.1 (or 5.2.0)

    return a.exec();

    That should reproduce the problem... please let me know if it doesn't or if there's anything else I can do.



  • Lifetime Qt Champion

    Don't worry, it does show the behavior.

    Looking at the sources, I can't say it's a regression, in fact it looks like it's 5.1 that didn't have the correct behavior.

    Qt::CustomizeWindowHint means "turn off the default window title hints" From there you can customize it to your liking (title, button etc.) Something that it seem you could not do in 5.1

  • Ah, OK, so it was an intentional change in behavior from 5.1 to 5.2? Was it a bug fix?

    Thanks for the clarification!


  • Lifetime Qt Champion

    As far as I can tell, yes.

    The log says:

    This ensures that the possible window flag combinations are respected
    where possible in Cocoa.

  • Great... thanks!

  • Lifetime Qt Champion

    You're welcome !

    If this answers your question, please update the thread title prepending [solved] so other forum users may know it's all good :)

  • Done!

    And I tagged it "solved" as well :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.