Unsolved How could I hide the main window's standard buttons...?
-
Hi:
I'm new to Qt Quick .
To begin my first app, I would like to hide the main toolbox of main-window. I mean the "Minimize - Maximize and Close " buttons. I wonder if there is a tutorial for it ...?!Thanks for helping...
MSD. -
Hi and welcome to devnet,
You can take a look at the Window flags example. It shows how you can modify various aspects of your widgets including these buttons.
-
Hi "SGaist" ;
Thanks you for reply and the link ... Actually , I'm new in C++ , so to me the "Window flags example " is somehow complicated. Is there any optimized codes, or can you send me a simple code to remove that buttons...?Thanks.
-
Call:
setWindowFlags(Qt::WindowTitleHint);
in your main window.
-
Hi SGaist :
I changed my main.cpp to this:#include <QApplication> #include <QQmlApplicationEngine> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; QMainWindow qm; qm.setWindowFlags(Qt::WindowTitleHint); qm.resize(250, 220); qm.show(); //engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
This is works fine, but now , how could I open my "main.qml" file as main window ...?
(engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); opens the file in another window )
Thanks.
-
Hi, use the following:
// in main int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); } // in main.qml [...] Window { visible: true flags: Qt.WindowTitleHint [...]
-
Sorry, my bad, I've managed to miss it was for QtQuick. @Devopia53's solution is what you are looking for.
-
Thank you Devopia53 (and SGaist):
flags: Qt.WindowTitleHint
works fine...