QT笔记 -- (1) .ui文件

刚开始写QT,designer用的不习惯,打开.ui文件看了一下,很容易读的xml文件,记录一下。

大体框架如下

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>HelloQTClass</class>
 <widget class="QMainWindow" name="HelloQTClass">
  <!--一些属性-->
  <property name="geometry"> ... </property>
  <property name="windowTitle"> ... </property>

  <!--主要控件,包括布局管理器-->
  <widget class="QWidget" name="centralWidget">...</widget>

  <!--菜单栏-->
  <widget class="QMenuBar" name="menuBar">...</widget>

  <!--工具栏-->
  <widget class="QToolBar" name="mainToolBar">...</widget>

  <!--状态栏-->
  <widget class="QStatusBar" name="statusBar"/>

  <!--action-->
  <action name="actionOpen">
   <property name="text">
    <string>open</string>
   </property>
  </action>
 </widget>
 
 <layoutdefault spacing="6" margin="11"/>
 
 <resources>
  <include location="HelloQT.qrc"/>
 </resources>
 
 <!--事件以及响应-->
 <connections>
  <connection>
   <sender>actionOpen</sender>
   <signal>triggered()</signal>
   <receiver>HelloQTClass</receiver>
   <slot>open()</slot>
   <hints>...</hints>
  </connection>
 </connections>
 
 <!--槽的定义-->
 <slots>
  <slot>open()</slot>
 </slots>

</ui>
原文地址:https://www.cnblogs.com/redips-l/p/6993496.html