Results 1 to 7 of 7

Thread: Alt+f4 combination in windows application

  1. #1
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Alt+f4 combination in windows application

    Hello Guys,
    I got small problem with my app.
    What I should do to capture "alt+f4" event and assign to it my own acction.
    I use QMainWindow class.
    I will be gratefull 4 any tips.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    You should reimplement QWidget::closeEvent.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    Thanks it works fine !

  4. #4
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    But now I have another problem:
    <code>
    void QWidget::closeEvent(QCloseEvent *event)
    {
    event->ignore();
    }
    </code>
    How can I now gain access to action from my own QMainWindow ?
    Is there any simple way ?

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    Didn't get what an action do you mean.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    In my own main window when someone click on close option, it will start action which display new QDialog window with question like "Do u really want to quit?" Yes|No

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Alt+f4 combination in windows application

    See Main window example. Especially how MainWindow::closeEvent works.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Replies: 0
    Last Post: 20th November 2009, 15:30
  2. how to disable Alt F4 combination
    By omprakash in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2008, 20:18
  3. Replies: 6
    Last Post: 13th May 2008, 13:19
  4. Newline char combination in qstring
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2008, 12:18
  5. OR combination flags in QAbstractFileEngine
    By pmaktieh.sirhc in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2007, 12:31

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
  •  
Qt is a trademark of The Qt Company.