heLomaN
heLomaN

Reputation: 1794

How to get size maximized without set to maximized?

Worked on Win10 with QT5.

showMaximized can make the window maximized. However, if double click the title bar, it will resize. So I want to set the window as big as possible (not fullscreen, still want Windows task bar), and set it fixed, which makes double click disabled. How should I get the size max possible?

Upvotes: 1

Views: 668

Answers (1)

Vahagn Avagyan
Vahagn Avagyan

Reputation: 776

you can determine the size of the current screen

int  screen_height = QApplication::desktop()->screenGeometry().height();
int  screen_width = QApplication::desktop()->screenGeometry().width();

you can do something like this

Widget* w = new Widget;
int  screen_height = QApplication::desktop()->screenGeometry().height();
int  screen_width = QApplication::desktop()->screenGeometry().width();
w->setMinimumSize(screen_width-10, screen_height-screen_height/12);
w->showMaximized();

Upvotes: 1

Related Questions