V
V
Vampire0162021-05-02 15:00:44
Qt
Vampire016, 2021-05-02 15:00:44

How to remove all buttons and menus from a window in Qt?

There are two standard windows (mainwindow and printorder). The second is added to the first in mdiArea as a child window. And it is EXTREMELY necessary for me that it does not have buttons and menus on top. I removed the minimize button and min / max with the help of flags, but the menu and the cross are not removed. What are the options?

In the window code printorder indicated:

this->setWindowFlag(Qt::WindowMinimizeButtonHint, false);
    this->setWindowFlag(Qt::WindowMinMaxButtonsHint, false);
    this->setWindowFlag(Qt::WindowSystemMenuHint, false);
    this->setWindowFlag(Qt::WindowCloseButtonHint, false);
    this->setWindowFlag(Qt::WindowFullscreenButtonHint, false);

In mainwindow:

auto flags = PrOrd->windowFlags();
    flags.setFlag(Qt::MSWindowsFixedSizeDialogHint);
    ui->mdiArea->addSubWindow(PrOrd, flags & ~Qt::WindowCloseButtonHint);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2021-05-02
@Vampire016

Open the Window Flags Example in QtCreator, and select the desired combination of flags.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question