Important: Please read the Qt Code of Conduct -

Window Flags in Red Hat 6

  • I have two objectives. First, to change the window title bar to only have the close button, so remove the minimize and maximize button. Second, get all of my application dialogues to appear in the task bar. I have done this successfully in a CentOS environment. The same code does not seem to work in Red Hat 6 as the minimize and maximize buttons remain in the title bar. The window flags used are as follows:

    Qt::WindowFlags flags = Qt::Window; //ensures my dialogues appear in the task bar.
    flags |= Qt::CustomizeWindowHint; //required to change some window settings
    flags |= Qt::WindowTitleHint; //adds the window title bar
    flags |= Qt::WindowCloseButtonHint; //adds the close button
    dialog.setWindowFlags(flags); //sets the window flags for the dialog

    The minimize and maximize buttons should not be appearing as I have not added the hints for them. Could this be an issue caused by the window manager ignoring/overriding the Qt window flags? I am struggling to find a solution using solely Qt code. I have tried adding the following to the flags in desperation attempts:

    flags &= ~(Qt::WindowMinimizeButtonHint); //attempt to remove minimize button
    flags &= ~(Qt::WindowMaximizeButtonHint); //attempt to remove maximize button

    I am using Qt 5.6.1. Any thoughts or solutions would be appreciated. Thanks.

  • Moderators

    @scassedy Since linux uses window managers and they can be customized by each distro it's hard to do stuff like this.

    What window manager/version are you using in red hat 6? What window manager/version are you using in centos?

    First things to do is determine that and then try to match them up. So match red hat to centos and try again. If you still have the issue then it is some setting that red hat has done differently. But that should give you an idea where to look for the solution.

  • @ambershark Thanks for the input. I was afraid the window manager changes might be the issue. We are using KDE as our window manager. I have limited control on what I am allowed to change unfortunately. For now, I will likely move forward with work around. Since the applications dialogues now appear in the task bar, there is little downside to minimizing them. The issue was they would simply get "lost" when they were minimized. I was able to remove the maximize button by setting fixed size restraints on the dialogues. I will update the post if I ever figure out how to get the KDE settings and the Qt Window Flags to play nicely together. I have been investigating the kwindecorations settings, but had no luck yet.

Log in to reply