Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Beep when spacebar pressed

Beep when spacebar pressed

Scheduled Pinned Locked Moved Solved QML and Qt Quick
9 Posts 4 Posters 2.4k Views 2 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.
  • Kevin LussierK Offline
    Kevin LussierK Offline
    Kevin Lussier
    wrote on last edited by
    #1

    Hello all.

    I have what I hope is a simple question to answer. If I have a window with only a button in it, and if I hit the tab key to set the focus to the button, and if I then hit the spacebar, my onClicked() gets properly called. However, I also get a beep. Now, I can understand a beep if I don't have the focus set to the button - it would indicate that I've done something wrong (i.e. no action can be taken because no control has the focus). But why do I get the beep if I'm on the button? And, more importantly, how do I make it so that it doesn't beep?

    Here's a very simple app to demonstrate:

    import QtQuick 2.7
    import QtQuick.Window 2.0
    import QtQuick.Controls 2.0
    
    ApplicationWindow {
        title: "Why the Beep?"
        width: 170
        height: 60
        visible: true
    
        Button {
            anchors.centerIn: parent
            text: "Press Me"
            onClicked: console.log("Button clicked.");
        }
    }
    

    Any help is appreciated :-)

    Kevin

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Which platform you trying this ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      Kevin LussierK 2 Replies Last reply
      3
      • dheerendraD dheerendra

        Which platform you trying this ?

        Kevin LussierK Offline
        Kevin LussierK Offline
        Kevin Lussier
        wrote on last edited by
        #3

        @dheerendra

        Oh, sorry. I should have specified. This is Qt 5.7 running on Mac.

        Kevin

        1 Reply Last reply
        0
        • dheerendraD dheerendra

          Which platform you trying this ?

          Kevin LussierK Offline
          Kevin LussierK Offline
          Kevin Lussier
          wrote on last edited by
          #4

          @dheerendra

          I just tested on Windows and there is no beep.

          Kevin

          1 Reply Last reply
          0
          • jpnurmiJ Offline
            jpnurmiJ Offline
            jpnurmi
            wrote on last edited by jpnurmi
            #5

            Strange. It happens with an empty window, but only with Qt 5.7 - not with Qt 5.6.

            import QtQuick 2.6
            import QtQuick.Window 2.2
            
            Window {
                width: 200
                height: 200
                visible: true
            }
            
            jpnurmiJ 1 Reply Last reply
            0
            • jpnurmiJ jpnurmi

              Strange. It happens with an empty window, but only with Qt 5.7 - not with Qt 5.6.

              import QtQuick 2.6
              import QtQuick.Window 2.2
              
              Window {
                  width: 200
                  height: 200
                  visible: true
              }
              
              jpnurmiJ Offline
              jpnurmiJ Offline
              jpnurmi
              wrote on last edited by
              #6

              Same results (beeps with 5.7, not with 5.6) with a plain minimal Qt Gui C++ app without Qt Widgets nor Qt Quick at all.

              #include <QtGui>
              
              int main(int argc, char *argv[])
              {
                  QGuiApplication app(argc, argv);
                  QWindow window;
                  window.show();
                  return app.exec();
              }
              
              1 Reply Last reply
              1
              • jpnurmiJ Offline
                jpnurmiJ Offline
                jpnurmi
                wrote on last edited by
                #7

                Looks like the issue has been fixed in Qt 5.7.1.

                • https://bugreports.qt.io/browse/QTBUG-54211
                • https://codereview.qt-project.org/#/c/163467/
                Kevin LussierK 1 Reply Last reply
                1
                • jpnurmiJ jpnurmi

                  Looks like the issue has been fixed in Qt 5.7.1.

                  • https://bugreports.qt.io/browse/QTBUG-54211
                  • https://codereview.qt-project.org/#/c/163467/
                  Kevin LussierK Offline
                  Kevin LussierK Offline
                  Kevin Lussier
                  wrote on last edited by
                  #8

                  @jpnurmi

                  Cool. Thanks.

                  Kevin

                  1 Reply Last reply
                  0
                  • miaalexandraM Offline
                    miaalexandraM Offline
                    miaalexandra
                    wrote on last edited by
                    #9
                    This post is deleted!
                    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