Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with keyEvent handler

Problem with keyEvent handler

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 282 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    I've added a keyPressEvent handler to my code:

    void DSSImageWidget::keyPressEvent(QKeyEvent* e)
    {
        QPointF mouseLocation(mapFromGlobal(QCursor::pos()));
        if (e->matches(QKeySequence::ZoomIn))
            zoom(mouseLocation, 1);
        if (e->matches(QKeySequence::ZoomOut))
            zoom(mouseLocation, -1);
        
        Inherited::keyPressEvent(e);
    }
    
    

    But it never calls the zoom mf! Even though I press Ctrl++ or Ctrl+-

    I also tried this in a keyReleaseEvent handler - also didn't work ...

    What am I doing wrong? Should I also call ignore() for key sequences I'm not interested in?

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #2

      Arrgh - the problem was a case of WHICH + and - key to combine with Ctrl!

      Num-pad keys work for this, but not the regular ones

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved