Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10
-
Allo,
I am on Kubuntu 20.10.
I have Qt Creator 4.14.2, it says based on Qt 5.15.2 (GCC 7.3.1 20180303 (Red Hat 7.3.1-5), 64 bit)WHAT WORKS:
I can disable the Minimize and Maximize buttons.
The window cannot be resized.THE PROBLEM IS:
I can still see the Minimize and Maximize buttons.MyProject::MyProject(QWidget *parent, QString &filePath) : QMainWindow(parent) , ui(new Ui::MyProject) { ui->setupUi(this); setFixedSize(size()); setGeometry(WindowPosition[0], WindowPosition[1], ClientWindowSize[0], ClientWindowSize[1]); setWindowTitle(ApplicationTitle); }
That’s not the entire constructor. I cut out most of the fat.
-
Hi,
You can do some more customization using the WindowFlags.
-
I added
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);but the Maximize button still remains.
The minimize button works and I think that's ok. How can I hide the maximize button? -
@stretchthebits
Did you try playing with theQt::WindowMinimizeButtonHint
/Qt::WindowMaximizeButtonHint
/Qt::WindowMinMaxButtonsHint
flags? There is a Qt example at https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html you could play with to see the effects of the various flags. -
@JonB said in Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10:
@stretchthebits
Did you try playing with theQt::WindowMinimizeButtonHint
/Qt::WindowMaximizeButtonHint
/Qt::WindowMinMaxButtonsHint
flags? There is a Qt example at https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html you could play with to see the effects of the various flags.I found that project in the Qt Creator Welcome screen and I compiled it.
Some of it does stuff, such as a frameless window gives me a frameless window.Always on top window gives me a Always on top window.
So which one gets rid of the Maximize button?
-
@stretchthebits
The ones I told you in my previous post. Just as per their names imply.Note they are "hints". The native windowing system may ignore them.