Modbus Master example

 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>MainWindow</class>
  <widget class="QMainWindow" name="MainWindow">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>516</width>
     <height>378</height>
    </rect>
   </property>
   <property name="maximumSize">
    <size>
     <width>16777215</width>
     <height>1000</height>
    </size>
   </property>
   <property name="windowTitle">
    <string>Modbus Client Example</string>
   </property>
   <widget class="QWidget" name="centralWidget">
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
      <layout class="QGridLayout" name="gridLayout">
       <item row="0" column="5">
        <widget class="QLabel" name="label_27">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="text">
          <string>Server Address:</string>
         </property>
        </widget>
       </item>
       <item row="0" column="7">
        <widget class="QPushButton" name="connectButton">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="text">
          <string>Connect</string>
         </property>
         <property name="checkable">
          <bool>false</bool>
         </property>
         <property name="autoDefault">
          <bool>false</bool>
         </property>
         <property name="default">
          <bool>true</bool>
         </property>
        </widget>
       </item>
       <item row="0" column="4">
        <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
       <item row="0" column="6">
        <widget class="QSpinBox" name="serverEdit">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="minimum">
          <number>1</number>
         </property>
         <property name="maximum">
          <number>247</number>
         </property>
        </widget>
       </item>
       <item row="0" column="1">
        <widget class="QComboBox" name="connectType">
         <item>
          <property name="text">
           <string>Serial</string>
          </property>
         </item>
         <item>
          <property name="text">
           <string>TCP</string>
          </property>
         </item>
        </widget>
       </item>
       <item row="0" column="2">
        <widget class="QLabel" name="label_2">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="text">
          <string>Port:</string>
         </property>
        </widget>
       </item>
       <item row="0" column="0">
        <widget class="QLabel" name="label">
         <property name="text">
          <string>Connection type:</string>
         </property>
        </widget>
       </item>
       <item row="0" column="3">
        <widget class="QLineEdit" name="portEdit">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
        </widget>
       </item>
      </layout>
     </item>
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout_2">
       <item>
        <widget class="QGroupBox" name="groupBox_2">
         <property name="minimumSize">
          <size>
           <width>250</width>
           <height>0</height>
          </size>
         </property>
         <property name="title">
          <string>Read</string>
         </property>
         <layout class="QGridLayout" name="gridLayout_3">
          <item row="0" column="0">
           <widget class="QLabel" name="label_4">
            <property name="text">
             <string>Start address:</string>
            </property>
           </widget>
          </item>
          <item row="0" column="1">
           <widget class="QSpinBox" name="readAddress">
            <property name="maximum">
             <number>9</number>
            </property>
           </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_5">
            <property name="text">
             <string>Number of values:</string>
            </property>
           </widget>
          </item>
          <item row="1" column="1">
           <widget class="QComboBox" name="readSize">
            <property name="currentIndex">
             <number>9</number>
            </property>
            <item>
             <property name="text">
              <string>1</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>2</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>3</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>4</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>5</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>6</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>7</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>8</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>9</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>10</string>
             </property>
            </item>
           </widget>
          </item>
          <item row="2" column="0">
           <widget class="QLabel" name="label_9">
            <property name="text">
             <string>Result:</string>
            </property>
           </widget>
          </item>
          <item row="3" column="0" colspan="2">
           <widget class="QListWidget" name="readValue">
            <property name="minimumSize">
             <size>
              <width>0</width>
              <height>0</height>
             </size>
            </property>
           </widget>
          </item>
         </layout>
        </widget>
       </item>
       <item>
        <widget class="QGroupBox" name="writeGroupBox">
         <property name="minimumSize">
          <size>
           <width>225</width>
           <height>0</height>
          </size>
         </property>
         <property name="title">
          <string>Write</string>
         </property>
         <layout class="QGridLayout" name="gridLayout_2">
          <item row="0" column="0">
           <widget class="QLabel" name="label_7">
            <property name="text">
             <string>Start address:</string>
            </property>
           </widget>
          </item>
          <item row="3" column="0" colspan="2">
           <widget class="QTreeView" name="writeValueTable">
            <property name="showDropIndicator" stdset="0">
             <bool>true</bool>
            </property>
            <property name="alternatingRowColors">
             <bool>true</bool>
            </property>
            <property name="rootIsDecorated">
             <bool>false</bool>
            </property>
            <property name="uniformRowHeights">
             <bool>true</bool>
            </property>
            <property name="itemsExpandable">
             <bool>false</bool>
            </property>
            <property name="expandsOnDoubleClick">
             <bool>false</bool>
            </property>
            <attribute name="headerVisible">
             <bool>true</bool>
            </attribute>
           </widget>
          </item>
          <item row="0" column="1">
           <widget class="QSpinBox" name="writeAddress">
            <property name="maximum">
             <number>9</number>
            </property>
           </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_8">
            <property name="text">
             <string>Number of values:</string>
            </property>
           </widget>
          </item>
          <item row="1" column="1">
           <widget class="QComboBox" name="writeSize">
            <property name="currentIndex">
             <number>9</number>
            </property>
            <item>
             <property name="text">
              <string>1</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>2</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>3</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>4</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>5</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>6</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>7</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>8</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>9</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>10</string>
             </property>
            </item>
           </widget>
          </item>
          <item row="2" column="0">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string/>
            </property>
           </widget>
          </item>
         </layout>
        </widget>
       </item>
      </layout>
     </item>
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout">
       <item>
        <widget class="QLabel" name="label_6">
         <property name="text">
          <string>Table:</string>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QComboBox" name="writeTable"/>
       </item>
       <item>
        <spacer name="horizontalSpacer_2">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>13</width>
           <height>17</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QPushButton" name="readButton">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="text">
          <string>Read</string>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QPushButton" name="writeButton">
         <property name="text">
          <string>Write</string>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QPushButton" name="readWriteButton">
         <property name="enabled">
          <bool>false</bool>
         </property>
         <property name="text">
          <string>Read-Write</string>
         </property>
        </widget>
       </item>
      </layout>
     </item>
    </layout>
   </widget>
   <widget class="QStatusBar" name="statusBar"/>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
      <width>516</width>
      <height>21</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuDevice">
     <property name="title">
      <string>&amp;Device</string>
     </property>
     <addaction name="actionConnect"/>
     <addaction name="actionDisconnect"/>
     <addaction name="separator"/>
     <addaction name="actionExit"/>
    </widget>
    <widget class="QMenu" name="menuToo_ls">
     <property name="title">
      <string>Too&amp;ls</string>
     </property>
     <addaction name="actionOptions"/>
    </widget>
    <addaction name="menuDevice"/>
    <addaction name="menuToo_ls"/>
   </widget>
   <action name="actionConnect">
    <property name="icon">
     <iconset resource="master.qrc">
      <normaloff>:/images/connect.png</normaloff>:/images/connect.png</iconset>
    </property>
    <property name="text">
     <string>&amp;Connect</string>
    </property>
   </action>
   <action name="actionDisconnect">
    <property name="icon">
     <iconset resource="master.qrc">
      <normaloff>:/images/disconnect.png</normaloff>:/images/disconnect.png</iconset>
    </property>
    <property name="text">
     <string>&amp;Disconnect</string>
    </property>
   </action>
   <action name="actionExit">
    <property name="icon">
     <iconset resource="master.qrc">
      <normaloff>:/images/application-exit.png</normaloff>:/images/application-exit.png</iconset>
    </property>
    <property name="text">
     <string>&amp;Quit</string>
    </property>
   </action>
   <action name="actionOptions">
    <property name="icon">
     <iconset resource="master.qrc">
      <normaloff>:/images/settings.png</normaloff>:/images/settings.png</iconset>
    </property>
    <property name="text">
     <string>&amp;Options</string>
    </property>
   </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <tabstops>
   <tabstop>connectType</tabstop>
   <tabstop>portEdit</tabstop>
   <tabstop>serverEdit</tabstop>
   <tabstop>connectButton</tabstop>
   <tabstop>readAddress</tabstop>
   <tabstop>readSize</tabstop>
   <tabstop>readValue</tabstop>
   <tabstop>writeAddress</tabstop>
   <tabstop>writeSize</tabstop>
   <tabstop>writeValueTable</tabstop>
   <tabstop>writeTable</tabstop>
   <tabstop>readButton</tabstop>
   <tabstop>writeButton</tabstop>
   <tabstop>readWriteButton</tabstop>
  </tabstops>
  <resources>
   <include location="master.qrc"/>
  </resources>
  <connections/>
 </ui>