Qt Forum

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

    How to create a shortcut for spacebar key without using keypressevent?

    General and Desktop
    2
    2
    4186
    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.
    • G
      guru last edited by

      Hi,
      I want to create a shortcut for spacebar key in my qtapplication, I tried following code,

      @QShortcut *VKey_SpaceBar = new QShortcut (QKeySequence (tr("space")), ui->chkAll );

       QObject :: connect (VKey_SpaceBar, SIGNAL(activated()), ui->chkAll, SLOT(click()));@
      

      But, nothing happen, whats wrong in my code.

      1 Reply Last reply Reply Quote 0
      • V
        Violet Giraffe last edited by

        Try simply:

        @QShortcut spacebarShortdcur(QKeySequence(Qt::Key_Space), this, SLOT(calcDirectorySize()), 0, Qt::WidgetWithChildrenShortcut);@

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