Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. keys
    Log in to post

    • UNSOLVED ListView - Why Space key is never received in Keys.onPressed() signal?
      QML and Qt Quick • listview keyboard keys space keys.onpressed • • jeanmilost  

      3
      0
      Votes
      3
      Posts
      191
      Views

      @LeLev Thank you very much for your answer. It helped me to understand my issue a little more. So I tried your code, and it works, meaning that the ListView isn't eating the Space key. However my interface is a little more complex than this one, it contains other objects like SwipeView, and yes, my items contain components like buttons which may take the focus. However I already tried to deactivate them and even thus the issue remained. I played a while around the code you posted. I noticed that the following code no longer receives any key: Rectangle { anchors.fill: parent color: "transparent" visible: true SwipeView { anchors.fill: parent activeFocusOnTab: false Page { background: null ListView { id: view anchors.fill: parent spacing: 2 focus: true model: ListModel { ListElement { name: "el1" } ListElement { name: "el2" } ListElement { name: "el3" } } delegate: Button { focus: false focusPolicy: Qt.NoFocus onFocusChanged: {if (focus) focus = false;} width: parent.width height: 50 text: index === view.currentIndex ? "currentIndex" : modelData onClicked: { view.currentIndex = index } } Keys.onPressed: { console.warn("key clicked"); if (event.key === Qt.Key_Space) { console.log("space clicked"); console.log(view.model.get(view.currentIndex).name); // view.model.get(ind).name = "new value" event.accepted = true; } } } } } } So I assume that some components operate like filters and may stop internally the keyboard signals, or at least a part of them, without let the choice to the developer to bypass this behavior (or at least I don't know how to do). To be honest I'm a little puzzled, because I worked for15 years with the Windows API before changing for Qt, and receiving a keyboard notification was never an issue, even when the parent component already received it before (in fact it was the contrary: the message could be blocked in the parent, but by default it was passing). So now the question is: in the above code, how can I receive the keyboard signals, and in particular the Space key, in my ListView despite of the parent SwipeView? Or which solution is normally used in a such situation, e.g is there a way to globally listen the keyboard and intercept keys in the Windows level, BEFORE any component receives them?
    • UNSOLVED Support for multi-index containers?
      General and Desktop • data models keys software design containers multi-index • • elfring  

      6
      0
      Votes
      6
      Posts
      1009
      Views

      @elfring said in Support for multi-index containers?: Would you like to distinguish any more between the usage of one- and two-dimensional structures for data models? Nope, the 2 dimensional structure is strictly more general of the 1D version so anything that goes for the first works in the second case. beginRant(); You have been discussing a lot of theoretical problems relating to models across different threads. In all of them the feeling has been that you are uselessly overcomplicating things. I feel it would be useful for you and easier for us to walk you through a concrete example of what you are trying to achieve rather than discuss endlessly on theoretical concepts. endRant();
    • UNSOLVED QML TextInput and QuickView focus issues
      QML and Qt Quick • qml focus textinput keys focus issue • • jonny_mac_99  

      2
      0
      Votes
      2
      Posts
      1409
      Views

      Does anyone have any ideas with this?
    • SOLVED Key buffer issue with my QWizard program
      General and Desktop • keys qwizard buffer qwizardpage • • roseicollis  

      12
      0
      Votes
      12
      Posts
      2605
      Views

      @roseicollis O.o is there any other type of question? Maybe I did it wrong... :S There's a "general topic" and a "question topic". I don't get why can't you upload a pic like before and you have to use that which I suppose is another webpage... Look here.
    • UNSOLVED Perform action at timed intervals when holding key down
      General and Desktop • mediaplayer timer keys • • JordanHarris  

      4
      0
      Votes
      4
      Posts
      1188
      Views

      That's what the timer is for. If you press the key long enough then it will fire but if you release it quicker that the timeout, the timer will be cancelled, no need to measure the time between both events.
    • [Solved]How can I launch a QWizardPage with a key?
      General and Desktop • keys qwizard qwizardpage • • roseicollis  

      38
      0
      Votes
      38
      Posts
      7721
      Views

      @roseicollis Well.. we have decided to use the dialog and tell the user to press Y or N to exit or not and this issue about the focus will be a future bug to fix I think this a practical decision. Thank you so much for ALL your help Anytime. Take care! Kind regards.
    • UNSOLVED Arrows keys don’t catch in keyPressEvent()
      General and Desktop • event keys keypressevent • • IL  

      6
      0
      Votes
      6
      Posts
      9890
      Views

      i guess this issue will be solved along with your other issue.
    • UNSOLVED Arrows Key order in grid layout
      General and Desktop • gridlayout keys focus issue • • IL  

      6
      0
      Votes
      6
      Posts
      4388
      Views

      @IL here ya go
    • UNSOLVED Unsupported keys in Qt on Android
      Mobile and Embedded • android keys game buttons game keys • • bundickt  

      3
      1
      Votes
      3
      Posts
      1100
      Views

      Hi, Gerrit Introduction is the starting point for Qt Contribution. You can also check the videos of the Qt World Summit 2015. There was a talk about "your first contribution to Qt" Coding Style Guide for how to write the code.
    • Backtab, KEY_CLEAR and KEY_BACK not handled by QML
      Mobile and Embedded • qml keys keypressevent qml keyboard ev • • carloval  

      1
      0
      Votes
      1
      Posts
      777
      Views

      No one has replied

    • How do I to set a letter key to start an action? [Solved]
      General and Desktop • keys pressedkey • • Cold_Distance  

      2
      0
      Votes
      2
      Posts
      815
      Views

      Well I discovered it myself. import QtQuick 2.3 Item{ id: root Rectangle { id:cuadrado width: 150 height: 150 color: "#53a135" border.color: "#61e361" } // A partir de aquí podemos empezar a manipular el 'cuadrado' desde el teclado focus: true //Keys.onLeftPressed: cuadrado.x -= 8 //Keys.onRightPressed: cuadrado.x += 8 //Keys.onUpPressed: cuadrado.y -= 8 //Keys.onDownPressed: cuadrado.y += 8 Keys.onPressed: { switch(event.key) { case Qt.Key_Plus: cuadrado.scale += 0.2 break; case Qt.Key_Minus: cuadrado.scale -= 0.2 break; case Qt.Key_A: cuadrado.x -= 8 break; case Qt.Key_D: cuadrado.x += 8 break; case Qt.Key_W: cuadrado.y -= 8 break; case Qt.Key_S: cuadrado.y += 8 break; } } } Sorry.
    • Hotkey to auto format code?
      General and Desktop • settings keys key format hotkey auto autoformat hot indent autoindent ctrl • • Rample  

      4
      0
      Votes
      4
      Posts
      16899
      Views

      So you already tested the Edit->Advanced possibilities ?