键盘数据监控:

同样的,键盘的检测和鼠标的情形很类似,都是以QWidget为基类的工程

Step1:在UI设计中添加该模块需要使用的相关组件,如下所示:

 <width>141</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Direction Contol:</string>
   </property>
  </widget>
  <widget class="QGraphicsView" name="graphicsView">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>50</y>
     <width>181</width>
     <height>151</height>
    </rect>
   </property>
  </widget>
  <widget class="QLabel" name="label_7">
   <property name="geometry">
    <rect>
     <x>250</x>
     <y>200</y>
     <width>91</width>
     <height>17</height>
    </rect>
   </property>
   <property name="text">
    <string>Move Regon</string>
   </property>
  </widget>
  <widget class="QPushButton" name="pushButton_3">
   <property name="geometry">
    <rect>
     <x>240</x>
     <y>100</y>
     <width>16</width>
     <height>16</height>
    </rect>
   </property>
   <property name="font">
    <font>
     <pointsize>8</pointsize>
     <italic>false</italic>
    </font>
   </property>
   <property name="text">
    <string>O</string>
   </property>
  </widget>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>
View Code

相关文章: