c++ - How can I maximize my main window and prevent resize in QT -
i trying maximize main qt window upon running , prevent user resizing it. have tried
int main(int argc, char *argv[]) { qapplication a(argc, argv); mainwindow widget; widget.showmaximized(); widget.show(); return a.exec(); }
which maximize window, along
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { this->setwindowflags(this->windowflags() | qt::mswindowsfixedsizedialoghint); ui->setupui(this); }
which grey out "restore down", "maximize" button located in title bar in middle of minimize , close window.
but still able drag title bar down unsnap maximized window , readjust size corner , edges.
how can prevent ability unsnap window , no strictly no resizing.
thanks!
if want window frame disappear , maximize-lose-restoredown buttons invisible, can modify ui part of code as:
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { this->setwindowflags(this->windowflags() | qt::mswindowsfixedsizedialoghint); ui->setupui(this); this->setwindowflags(qt::framelesswindowhint); //makes frame invisible this->setwindowstate(qt::windowmaximized); //maximizes window }
Comments
Post a Comment