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. Quotes matching
Qt 6.11 is out! See what's new in the release blog

Quotes matching

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      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

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dbzhang800
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          its working fine now with escape sequence (").

          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