Qt 5.9 | Qt Multimedia | Camera Example | camera.ui Example File

Qt 5.9.4 Reference Documentation

# camera.ui Example File

multimediawidgets/camera/camera.ui

      <?xml version="1.0" encoding="UTF-8"?>
      <ui version="4.0">
       <class>Camera</class>
       <widget class="QMainWindow" name="Camera">
        <property name="geometry">
         <rect>
          <x>0</x>
          <y>0</y>
          <width>668</width>
          <height>422</height>
         </rect>
        </property>
        <property name="windowTitle">
         <string>Camera</string>
        </property>
        <widget class="QWidget" name="centralwidget">
         <layout class="QGridLayout" name="gridLayout_3">
          <item row="0" column="0" rowspan="3">
           <widget class="QStackedWidget" name="stackedWidget">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
              <horstretch>1</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
            </property>
            <property name="palette">
             <palette>
              <active>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>145</red>
                  <green>145</green>
                  <blue>145</blue>
                 </color>
                </brush>
               </colorrole>
              </active>
              <inactive>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>145</red>
                  <green>145</green>
                  <blue>145</blue>
                 </color>
                </brush>
               </colorrole>
              </inactive>
              <disabled>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>145</red>
                  <green>145</green>
                  <blue>145</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>145</red>
                  <green>145</green>
                  <blue>145</blue>
                 </color>
                </brush>
               </colorrole>
              </disabled>
             </palette>
            </property>
            <property name="currentIndex">
             <number>0</number>
            </property>
            <widget class="QWidget" name="viewfinderPage">
             <layout class="QGridLayout" name="gridLayout_5">
              <item row="0" column="0">
               <widget class="QCameraViewfinder" name="viewfinder" native="true"/>
              </item>
             </layout>
            </widget>
            <widget class="QWidget" name="previewPage">
             <layout class="QGridLayout" name="gridLayout_4">
              <item row="0" column="0">
               <widget class="QLabel" name="lastImagePreviewLabel">
                <property name="sizePolicy">
                 <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
                  <horstretch>0</horstretch>
                  <verstretch>0</verstretch>
                 </sizepolicy>
                </property>
                <property name="frameShape">
                 <enum>QFrame::Box</enum>
                </property>
                <property name="text">
                 <string/>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
           </widget>
          </item>
          <item row="1" column="1" colspan="2">
           <widget class="QPushButton" name="lockButton">
            <property name="text">
             <string>Focus</string>
            </property>
           </widget>
          </item>
          <item row="2" column="1" colspan="2">
           <widget class="QTabWidget" name="captureWidget">
            <property name="currentIndex">
             <number>0</number>
            </property>
            <widget class="QWidget" name="tab_2">
             <attribute name="title">
              <string>Image</string>
             </attribute>
             <layout class="QGridLayout" name="gridLayout">
              <item row="0" column="0">
               <widget class="QPushButton" name="takeImageButton">
                <property name="enabled">
                 <bool>false</bool>
                </property>
                <property name="text">
                 <string>Capture Photo</string>
                </property>
                <property name="icon">
                 <iconset resource="camera.qrc">
                  <normaloff>:/images/shutter.svg</normaloff>:/images/shutter.svg</iconset>
                </property>
               </widget>
              </item>
              <item row="1" column="0">
               <spacer name="verticalSpacer_2">
                <property name="orientation">
                 <enum>Qt::Vertical</enum>
                </property>
                <property name="sizeHint" stdset="0">
                 <size>
                  <width>20</width>
                  <height>161</height>
                 </size>
                </property>
               </spacer>
              </item>
              <item row="2" column="0">
               <widget class="QLabel" name="label">
                <property name="text">
                 <string>Exposure Compensation:</string>
                </property>
               </widget>
              </item>
              <item row="3" column="0">
               <widget class="QSlider" name="exposureCompensation">
                <property name="minimum">
                 <number>-4</number>
                </property>
                <property name="maximum">
                 <number>4</number>
                </property>
                <property name="pageStep">
                 <number>2</number>
                </property>
                <property name="orientation">
                 <enum>Qt::Horizontal</enum>
                </property>
                <property name="tickPosition">
                 <enum>QSlider::TicksAbove</enum>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
            <widget class="QWidget" name="tab">
             <attribute name="title">
              <string>Video</string>
             </attribute>
             <layout class="QGridLayout" name="gridLayout_2">
              <item row="0" column="0">
               <widget class="QPushButton" name="recordButton">
                <property name="text">
                 <string>Record</string>
                </property>
               </widget>
              </item>
              <item row="1" column="0">
               <widget class="QPushButton" name="pauseButton">
                <property name="text">
                 <string>Pause</string>
                </property>
               </widget>
              </item>
              <item row="2" column="0">
               <widget class="QPushButton" name="stopButton">
                <property name="text">
                 <string>Stop</string>
                </property>
               </widget>
              </item>
              <item row="3" column="0">
               <spacer name="verticalSpacer">
                <property name="orientation">
                 <enum>Qt::Vertical</enum>
                </property>
                <property name="sizeHint" stdset="0">
                 <size>
                  <width>20</width>
                  <height>76</height>
                 </size>
                </property>
               </spacer>
              </item>
              <item row="4" column="0">
               <widget class="QPushButton" name="muteButton">
                <property name="text">
                 <string>Mute</string>
                </property>
                <property name="checkable">
                 <bool>true</bool>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
           </widget>
          </item>
         </layout>
        </widget>
        <widget class="QMenuBar" name="menubar">
         <property name="geometry">
          <rect>
           <x>0</x>
           <y>0</y>
           <width>668</width>
           <height>21</height>
          </rect>
         </property>
         <widget class="QMenu" name="menuFile">
          <property name="title">
           <string>File</string>
          </property>
          <addaction name="actionStartCamera"/>
          <addaction name="actionStopCamera"/>
          <addaction name="separator"/>
          <addaction name="actionSettings"/>
          <addaction name="separator"/>
          <addaction name="actionExit"/>
         </widget>
         <widget class="QMenu" name="menuDevices">
          <property name="title">
           <string>Devices</string>
          </property>
         </widget>
         <addaction name="menuFile"/>
         <addaction name="menuDevices"/>
        </widget>
        <widget class="QStatusBar" name="statusbar"/>
        <action name="actionExit">
         <property name="text">
          <string>Exit</string>
         </property>
        </action>
        <action name="actionStartCamera">
         <property name="text">
          <string>Start Camera</string>
         </property>
        </action>
        <action name="actionStopCamera">
         <property name="text">
          <string>Stop Camera</string>
         </property>
        </action>
        <action name="actionSettings">
         <property name="text">
          <string>Settings</string>
         </property>
        </action>
       </widget>
       <customwidgets>
        <customwidget>
         <class>QCameraViewfinder</class>
         <extends>QWidget</extends>
         <header>qcameraviewfinder.h</header>
         <container>1</container>
        </customwidget>
       </customwidgets>
       <resources>
        <include location="camera.qrc"/>
       </resources>
       <connections>
        <connection>
         <sender>recordButton</sender>
         <signal>clicked()</signal>
         <receiver>Camera</receiver>
         <slot>record()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>647</x>
           <y>149</y>
          </hint>
          <hint type="destinationlabel">
           <x>61</x>
           <y>238</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>stopButton</sender>
         <signal>clicked()</signal>
         <receiver>Camera</receiver>
         <slot>stop()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>647</x>
           <y>225</y>
          </hint>
          <hint type="destinationlabel">
           <x>140</x>
           <y>236</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>pauseButton</sender>
         <signal>clicked()</signal>
         <receiver>Camera</receiver>
         <slot>pause()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>647</x>
           <y>187</y>
          </hint>
          <hint type="destinationlabel">
           <x>234</x>
           <y>237</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>actionExit</sender>
         <signal>triggered()</signal>
         <receiver>Camera</receiver>
         <slot>close()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>-1</x>
           <y>-1</y>
          </hint>
          <hint type="destinationlabel">
           <x>154</x>
           <y>130</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>takeImageButton</sender>
         <signal>clicked()</signal>
         <receiver>Camera</receiver>
         <slot>takeImage()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>625</x>
           <y>132</y>
          </hint>
          <hint type="destinationlabel">
           <x>603</x>
           <y>169</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>lockButton</sender>
         <signal>clicked()</signal>
         <receiver>Camera</receiver>
         <slot>toggleLock()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>658</x>
           <y>75</y>
          </hint>
          <hint type="destinationlabel">
           <x>453</x>
           <y>119</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>muteButton</sender>
         <signal>toggled(bool)</signal>
         <receiver>Camera</receiver>
         <slot>setMuted(bool)</slot>
         <hints>
          <hint type="sourcelabel">
           <x>647</x>
           <y>377</y>
          </hint>
          <hint type="destinationlabel">
           <x>5</x>
           <y>280</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>exposureCompensation</sender>
         <signal>valueChanged(int)</signal>
         <receiver>Camera</receiver>
         <slot>setExposureCompensation(int)</slot>
         <hints>
          <hint type="sourcelabel">
           <x>559</x>
           <y>367</y>
          </hint>
          <hint type="destinationlabel">
           <x>665</x>
           <y>365</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>actionSettings</sender>
         <signal>triggered()</signal>
         <receiver>Camera</receiver>
         <slot>configureCaptureSettings()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>-1</x>
           <y>-1</y>
          </hint>
          <hint type="destinationlabel">
           <x>333</x>
           <y>210</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>actionStartCamera</sender>
         <signal>triggered()</signal>
         <receiver>Camera</receiver>
         <slot>startCamera()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>-1</x>
           <y>-1</y>
          </hint>
          <hint type="destinationlabel">
           <x>333</x>
           <y>210</y>
          </hint>
         </hints>
        </connection>
        <connection>
         <sender>actionStopCamera</sender>
         <signal>triggered()</signal>
         <receiver>Camera</receiver>
         <slot>stopCamera()</slot>
         <hints>
          <hint type="sourcelabel">
           <x>-1</x>
           <y>-1</y>
          </hint>
          <hint type="destinationlabel">
           <x>333</x>
           <y>210</y>
          </hint>
         </hints>
        </connection>
       </connections>
       <slots>
        <slot>record()</slot>
        <slot>pause()</slot>
        <slot>stop()</slot>
        <slot>enablePreview(bool)</slot>
        <slot>configureCaptureSettings()</slot>
        <slot>takeImage()</slot>
        <slot>startCamera()</slot>
        <slot>toggleLock()</slot>
        <slot>setMuted(bool)</slot>
        <slot>stopCamera()</slot>
        <slot>setExposureCompensation(int)</slot>
       </slots>
      </ui>