ok i found a solution,
i created a class in c++ with a single function to correct the main window by getting the main window and correct the window and restrict resize.
the function is called from qml, because i do not know when the window is active.
in main.qml it is active.
void correctWindowSize() {
QWindow *mw = getMainWindow();
if( mw == nullptr ) {
qDebug() << "WINDOW NOT FOUND";
}
else {
Qt::WindowFlags flags = 0;
flags |= Qt::Dialog;
// flags |= Qt::Tool;
// flags |= Qt::WindowTitleHint;
mw->setFlags(flags);
mw->setMinimumWidth(mw->width());
mw->setMinimumHeight(mw->height());
mw->setMaximumWidth(mw->width());
mw->setMaximumHeight(mw->height());
}
}
QWindow* getMainWindow()
{
foreach (QWindow *w, qApp->allWindows()) {
if(w->inherits("QWindow")) {
qDebug() << "window found";
return w;
}
}
return nullptr;
}