PDA

View Full Version : how to make Window+M key work for my application



yxmaomao
2nd July 2008, 05:18
we can create a main window with setWindowFlags(Qt::FramelessWindowHint), but it will make my application don't repsone system (window+M ) keys , anybody know how to get window+M keys work again

jpn
6th July 2008, 19:33
#include <qt_windows.h>
...
::SendMessage(winId(), WM_SYSCOMMAND, SC_MOVE, 0);

yxmaomao
6th July 2008, 23:54
that's not right,
How can I catch the windows+M key pressed event , when I called setWindowFlags(Qt::FramelessWindowHint), OS will not send me that event.

jpn
9th July 2008, 20:51
that's not right,
How can I catch the windows+M key pressed event , when I called setWindowFlags(Qt::FramelessWindowHint), OS will not send me that event.

Oh, sorry. I completely misunderstood the question. For some reason I thought "Windows+M" as the window move action in the system menu. :)

Anyway, Windows won't send you necessary messages if you only have a Qt::FramelessWindowHint window. So how about using QWidget::setMask() instead of Qt::FramelessWindowHint? Something like this:


void MyWindow::resizeEvent(QResizeEvent* event)
{
Q_UNUSED(event);
setMask(rect());
}

yxmaomao
10th July 2008, 00:35
Yes , I can use setMask() , but another problem is : when I maximise the application, still title bar's height will be left on the top screen, if I using showfullscreen() then updateGeometry() to make application maximum, in this case , system context menu will be not right. I mean restore menu will be disabled.