Results 1 to 7 of 7

Thread: filterout the Alt+Ctrl+Del

  1. #1
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default filterout the Alt+Ctrl+Del

    Hi All
    In my application, One system is is connect to another system (Client server type application.) I can lock the client the client from master side. If client is locked then a widget is displayed in client side. whicjh should grab all keyboard and mouse event. current all key board event are filrterout excep ALT+CTRL+DEl. inorder to do it i did like following
    Qt Code:
    1. void CLockWidget::keyPressEvent(QKeyEvent *i_KeyEvent)
    2. {
    3. //const QKeyEvent *keyEv = static_cast<QKeyEvent *>(i_Event);
    4.  
    5. if(i_KeyEvent->key() == Qt::Key_Delete)
    6. {
    7. i_KeyEvent->ignore();
    8. }
    9. else if(i_KeyEvent->key() == Qt::Key_Alt)
    10. {
    11. i_KeyEvent->ignore();
    12. }
    13. else if(i_KeyEvent->key() == Qt::Key_Control)
    14. {
    15. i_KeyEvent->ignore();
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    But its not filtering out. How to it.

  2. #2
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: filterout the Alt+Ctrl+Del

    What do your want to intercept the Ctrl+Alt+Del sequence for?
    Ctrl+Alt+Del is designed to be handle by the system, and it doesn't sound a good idea to substitute yourself to the OS.

  3. #3
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: filterout the Alt+Ctrl+Del

    Anyway, you can't do it at Qt level, you've got to use Win API.
    Qt Code:
    1. SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
    To copy to clipboard, switch view to plain text mode 

    Have look at :http://www.qtcentre.org/threads/2529...T-CTRL-DEL!!!! and http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
    Last edited by toutarrive; 24th March 2010 at 22:57.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: filterout the Alt+Ctrl+Del

    Judging from his profile, it would seem that the OP wants it for Unix/X11, not Windows, in which case, comment out the line in /etc/inittab

  5. #5
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: filterout the Alt+Ctrl+Del

    Well spotted ... Should read profile more carefully.
    Sorry for that.

  6. #6
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: filterout the Alt+Ctrl+Del

    Quote Originally Posted by fatjuicymole View Post
    Judging from his profile, it would seem that the OP wants it for Unix/X11, not Windows, in which case, comment out the line in /etc/inittab
    Yes fatjuicymole, I need to do it in Linux (using Qt). Can you plz tell me how to do in which case, comment out the line in /etc/inittab through coding?.

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: filterout the Alt+Ctrl+Del

    If your app is running as a typical user (non-root), then you can't.

    If it's SUID root then you can use reboot() api to modify ctrl-alt-del behavior.

    Another alternative is to modify /etc/initab to check for the presence of a file or pipe before allowing the operation, and then control that file or pipe from your application.

Similar Threads

  1. Keypressevent - CTRL Key_Enter
    By qtuser20 in forum Qt Programming
    Replies: 2
    Last Post: 3rd March 2010, 20:47
  2. Why Ctrl+A not working in QListWidget?
    By rajesh in forum Qt Programming
    Replies: 6
    Last Post: 10th December 2009, 14:40
  3. disable ALT+CTRL+DEL!!!!
    By phillip_Qt in forum Qt Programming
    Replies: 10
    Last Post: 3rd November 2009, 09:23
  4. How to catch CTRL+Y in application
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2009, 06:14
  5. CTrl + A
    By navi1084 in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2008, 09:19

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.