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. How to use crtl key to make work on my widget.
Forum Updated to NodeBB v4.3 + New Features

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

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

    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
    0
    • S Offline
      S Offline
      silur
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zoat129
        wrote on last edited by
        #3

        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
        0

        • Login

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