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. QTextEdit Ctrl + + zoomIn keyevent not working in Windows

QTextEdit Ctrl + + zoomIn keyevent not working in Windows

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 2.2k 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.
  • H Offline
    H Offline
    haney
    wrote on last edited by
    #1

    Hi,

    I developed an editor using QTextEdit. In this zoomIn option is working for Ctrl + '+'. But when I press Ctrl + Shift + '=' keys zoomIn feature is not working.

    In linux by default, Ctrl +Shift +'=' is working. In windows it is not working.

    Ctrl+Shift+= is same as Ctrl ++

    I tried to capture the events in keypressEvent(QKeyEvent *e) method like this:
    @
    if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Plus)
    {
    this->zoomIn();
    qDebug()<<"key ctrl shift + pressed";
    } // not working

    // second trial
    if(e->modifiers() == Qt::ControlModifier &&e->modifiers() == Qt::ShiftModifier && e->key() == Qt::Key_Equal)
    {
    this->zoomIn();
    qDebug()<<"key ctrl shift + pressed";
    } // not working
    @

    How can I make Ctrl+shift+'=' make zoomIn in textEdit. How can I capture these keypresses combination.

    Please suggest your views on this.

    Appreciate your help in this regard.

    Thanks,
    Haney.

    }
    
    1 Reply Last reply
    0
    • H Offline
      H Offline
      haney
      wrote on last edited by
      #2

      I tried even the nativeScanCode() each key has a unique scan code. I cannot differentiate = and + using scan code cuz it is one key, hence same scancode.

      How to catch the combination of key press like Ctrl + Shift + '=' .

      Please give any suggestions.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        haney
        wrote on last edited by
        #3

        I was able to do it this way.

        @
        Qt::KeyboardModifiers mod = QApplication::keyboardModifiers ();
        bool SHIFT = mod.testFlag(Qt::ShiftModifier);
        bool CTRL = mod.testFlag(Qt::ControlModifier);

                if (SHIFT && CTRL)
                {
                    if(e->key() == Qt::Key_Plus){
        
                        qDebug()<<"now plus caught";
                        this->zoomIn();
                 }
        

        @

        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