Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt/win: showMaximized() overlapping taskbar on a frameless window

Tags:

qt

qt4

I'm building an application that has its own custom chrome. I have turned the default window border off by setting the flag:

this->setWindowFlags(Qt::FramelessWindowHint);

After this flag is set and the default window border is turned off, any calls to:

this->showMaximized();

result in a window that takes up the entire screen, overlapping the task bar. Is there a common work around for this or another method I should be calling instead of showMaximized()?

Win7/Qt4.6

like image 964
greggreg Avatar asked Apr 14 '10 21:04

greggreg


1 Answers

You should not inherit from QDesktopWidget.

You can get the "available geometry" by getting the QDesktopWidget instance from QApplication::desktop:

QDesktopWidget *desktop = QApplication::desktop();
// Because reserved space can be on all sides of the scren
// you have to both move and resize the window
this->setGeometry(desktop->availableGeometry());
like image 127
alexisdm Avatar answered Sep 27 '22 19:09

alexisdm