Skip to content
  • 0 Votes
    13 Posts
    4k Views
    Sh1gsS

    @mrjj

    I've changed it to check if it's in the first edit, to stop the timer so it'd look like

    123.___.___.___

    And then the user will have to manually hit "Delete" repeatedly to delete the characters. This way, the program doesn't crash. It's not exactly elegant, but it's close enough to the requirements I was given.

    I have also changed that curEdit->installEventFilter(this) is only called once.

    Thank you very much for your help, I will go ahead and mark this as solved.

  • 0 Votes
    2 Posts
    2k Views
    M

    Here's the solution. You have to do it in Javascript. Ensure jQuery is loaded in your web pages (even the IFRAME/FRAME ones) and then apply this code:

    <script type="text/javascript"> $(document).ready(function(){ // Disable backspace key except in fields. $(document).keydown(function(e) { var elid = $(document.activeElement).is('INPUT, TEXTAREA') ; if (e.keyCode === 8 && !elid) { if(e.ctrlKey) { window.history.back(); } else { // disable backspace e.preventDefault(); return false; } } }); }); </script>

    SOURCE: http://stackoverflow.com/a/17278620/105539