首页 \ 问答 \ Keys.Context1与Qt / QML绑定的关键是什么?(What key is Keys.Context1 tied to in Qt/QML?)

Keys.Context1与Qt / QML绑定的关键是什么?(What key is Keys.Context1 tied to in Qt/QML?)

我正在构建一个概念验证应用程序,在Windows上,测试我可以用QML做什么,但最终结果将在嵌入式Linux系统上运行(我也需要学习)。 我一直在处理键处理(Enter,Up,down,Left和Right等),并注意到有4个键被标记为Context1到4。

QtQuick文档中,引用了Keys.Context1..4以及相关的onPressed事件,但未提及它们的使用方式。

context1Pressed(KeyEvent事件)

按下Context1键时会发出此信号。 event参数提供有关事件的信息。

相应的处理程序是onContext1Pressed。

如何找出这些绑定的物理键,或者如何指定它们绑定的键?


I'm currently building a proof of concept application, on windows, testing out what I can do with QML but the end result is going to run on an embedded Linux system (which I'll need to learn too). I've been working with key handling (Enter, Up, down, Left and Right etc.) and noticed that there are 4 keys marked as Context1 to 4.

In the QtQuick docs there is reference to Keys.Context1..4 with associated onPressed events but not about how they are used.

context1Pressed(KeyEvent event)

This signal is emitted when the Context1 key has been pressed. The event parameter provides information about the event.

The corresponding handler is onContext1Pressed.

How do I find out what physical keys these are bound to, or how can I specify which keys they bind to?


原文:https://stackoverflow.com/questions/24610591
更新时间:2023-08-07 08:08

最满意答案

好的我找到了解决方案! 如果我把col-sm-12放在<ul>它会得到一个高度。 在隐藏.more-items列表之前我甚至不需要计算它:-)

更新了jsfiddle: https ://jsfiddle.net/vn1z6z9L/3/

<div class="container">
  <div class="row">
    <ul class="items col-sm-12">
      <li class="item col-sm-4">asf</li>
      <li class="item col-sm-4">dd</li>
      <li class="item col-sm-4">ssddf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
    </ul>
    <ul class="more-items col-sm-12">
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
    </ul>
  </div>

OK I found the solution! If I put col-sm-12 on the <ul> it gets a height. I don't even need to calculate it before hiding the .more-items list :-)

Updated jsfiddle: https://jsfiddle.net/vn1z6z9L/3/

<div class="container">
  <div class="row">
    <ul class="items col-sm-12">
      <li class="item col-sm-4">asf</li>
      <li class="item col-sm-4">dd</li>
      <li class="item col-sm-4">ssddf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
    </ul>
    <ul class="more-items col-sm-12">
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">as</li>
      <li class="item col-sm-4">sdf</li>
      <li class="item col-sm-4">sdf</li>
    </ul>
  </div>

相关问答

更多