Quotes matching



  • I am able to match paraenthesis using key release and key press concept but i am not able to match double quotes and single quotes. Any help would be appreciable!!!.For Paraenthesis matching, I compare parenthesis by pressing key that contains text {.
    if((key->text().contains("{")))

    but for Double and single Quotes using this kind of condition is not appropriate.
    if((key->text().contains(""")))
    This shows an error.



  • I don't think matching the text from the key is the way to go... I'd rather use something like that:

    void MyClass::keyPressEvent(QKeyEvent *event)
    {
        switch (event->key()) {
            case Key::Key_A: /* do something useful */; break;
            case Key::Key_S: /* do something useful */; break;
            case Key::Key_W: /* do something useful */; break;
            case Key::Key_D: /* do something useful */; break;
        }
    }
    

    Have a look at QKeyEvent and the key enum



  • Hi, seems you don't familiar with C/C++ escaped char, such as ""?\..."



  • its working fine now with escape sequence (").


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.