Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to use crtl key to make work on my widget.

    General and Desktop
    3
    3
    788
    Loading More Posts
    • 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.
    • Z
      Zeee last edited by

      how to use crtl key to make work on my widget.
      I want when I press the ctrl + 6 s such an action executes on my widget and the action ceases when I press the button again ctrl 6
      here is my code
      @
      QObject::connect(QKeySequence ("Ctrl + 5"), SIGNAL(clicked()), this, SLOT(popp()));
      popp()
      {
      }@

      [Edit: Added @ tags -- mlong]

      1 Reply Last reply Reply Quote 0
      • S
        silur last edited by

        @QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+6"), parent);
        QObject::connect(shortcut, SIGNAL(activated()), receiver, SLOT(yourSlotHere());@

        1 Reply Last reply Reply Quote 0
        • Z
          zoat129 last edited by

          thank you very much for your help,
          I want when I press the ctrl + 6 s such an action executes on my widget and the action ceases when I press the button again ctrl 6

          my slot have boolean as argument and I want when I press ctrl6 the first time to execute my slot with true as argument and when I press ctrl 6 again to put my slot argument on on. I try this

          QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+6"), parent);
          QObject::connect(shortcut, SIGNAL(activated(bool)), receiver, SLOT(yourSlotHere(bool));
          

          but it not work,
          i am new in qt

          1 Reply Last reply Reply Quote 0
          • First post
            Last post