Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt C++ minimize and maximize window

Tags:

c++

qt

I create main window by using class QWidget and setup window flag to Qt::CustomizeWindowHint (to disable title bar). But than I found problem - when I click on my program button on Windows taskbar - program won't minimize and maximize. What can I do to remove this problem? I use Windows 7. Sorry 4 my bad english.

like image 922
Outsider Avatar asked Nov 25 '11 15:11

Outsider


2 Answers

That's the feature of Qt::CustomizeWindowHint.When use this windows flag,you can hardly control the window.What you can try is adding two buttons to your window and connect them to showMaximized() and showMinimized().Then you can maximize or minimize the window by clicking the buttons.

like image 124
user957121 Avatar answered Oct 22 '22 18:10

user957121


This answer is a while ago but I faced the same challenge now and could find a solution. Maybe its helpfull for someone else. As proposed before one should specify Qt::FramelessWindowHint instead of Qt::CustomizeWindowHint. This also hides the title and border of the window. To still have the minimize/maximize feature I additionaly specified Qt::WindowSystemMenuHint, Qt::WindowMinimizeButtonHint and Qt::WindowMaximizeButtonHint. That's it!

like image 34
user2814680 Avatar answered Oct 22 '22 16:10

user2814680