Skip to content
QtWS25 Call for Papers
  • 0 Votes
    3 Posts
    540 Views
    jeanmilostJ

    @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?

  • 0 Votes
    6 Posts
    1k Views
    VRoninV

    @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();
  • 0 Votes
    2 Posts
    2k Views
    J

    Does anyone have any ideas with this?

  • 0 Votes
    12 Posts
    3k Views
    kshegunovK

    @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.

  • 0 Votes
    4 Posts
    1k Views
    SGaistS

    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.

  • 0 Votes
    38 Posts
    9k Views
    kshegunovK

    @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.

  • 0 Votes
    6 Posts
    12k Views
    raven-worxR

    i guess this issue will be solved along with your other issue.

  • 0 Votes
    6 Posts
    5k Views
    raven-worxR

    @IL
    here ya go

  • 1 Votes
    3 Posts
    1k Views
    SGaistS

    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.

  • 0 Votes
    1 Posts
    913 Views
    No one has replied
  • 0 Votes
    2 Posts
    918 Views
    Cold_DistanceC

    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.

  • 0 Votes
    4 Posts
    19k Views
    SGaistS

    So you already tested the Edit->Advanced possibilities ?