Results 1 to 5 of 5

Thread: how to make Window+M key work for my application

  1. #1
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Exclamation how to make Window+M key work for my application

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to make Window+M key work for my application

    Qt Code:
    1. #include <qt_windows.h>
    2. ...
    3. ::SendMessage(winId(), WM_SYSCOMMAND, SC_MOVE, 0);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to make Window+M key work for my application

    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.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to make Window+M key work for my application

    Quote Originally Posted by yxmaomao View Post
    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:
    Qt Code:
    1. void MyWindow::resizeEvent(QResizeEvent* event)
    2. {
    3. Q_UNUSED(event);
    4. setMask(rect());
    5. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. #5
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to make Window+M key work for my application

    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.

Similar Threads

  1. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 11:43
  2. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57
  3. Replies: 2
    Last Post: 12th November 2006, 09:47
  4. Why can't I make dynamic_cast work properly?
    By pir in forum General Programming
    Replies: 13
    Last Post: 18th July 2006, 17:17
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 11:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.