Implement "analyze" button that loads the test image.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Jul 2017 21:19:06 +0000 (23:19 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Jul 2017 21:19:06 +0000 (23:19 +0200)
qtapp/barcode2cash/mainwindow.cpp
qtapp/barcode2cash/mainwindow.h
qtapp/barcode2cash/mainwindow.ui

index 5b7e16a286d00f1623ea44dad5fb96821b8055e8..99c4cff371f83d5b5ab4148f2d6023587401fc55 100644 (file)
@@ -64,3 +64,9 @@ void MainWindow::showCaptureSuccess(int, QString fileName) {
 void MainWindow::showCaptureError(int, QCameraImageCapture::Error error, QString errorString) {
     ui->statusBar->showMessage(tr("Error when capturing image (error id %2): %1.").arg(errorString).arg(error));
 }
+
+
+void MainWindow::analyze() {
+    QPixmap image("test.jpg");
+    ui->labAnalyzeImage->setPixmap(image);
+}
index 51be7912a3c3db01ae60aa5c513f0bb077c0d0c7..3157f87c4467acd94139cde583641f1a8fa6db98 100644 (file)
@@ -30,6 +30,7 @@ public slots:
     void capture();
     void showCaptureSuccess(int id, QString fileName);
     void showCaptureError(int id, QCameraImageCapture::Error error, QString errorString);
+    void analyze();
 
 };
 
index 76c4ab218a7597af9bec325f2563389563805d9e..ff9fbd6fc304de07785a0f2e1d5212177976ee86 100644 (file)
@@ -6,57 +6,77 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>457</width>
+    <height>350</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>MainWindow</string>
   </property>
   <widget class="QWidget" name="centralWidget">
-   <widget class="QPushButton" name="pbCapture">
-    <property name="geometry">
-     <rect>
-      <x>40</x>
-      <y>50</y>
-      <width>81</width>
-      <height>22</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Capture</string>
-    </property>
-   </widget>
-   <widget class="QLabel" name="labCameraReady">
-    <property name="geometry">
-     <rect>
-      <x>50</x>
-      <y>20</y>
-      <width>59</width>
-      <height>14</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>TextLabel</string>
-    </property>
-   </widget>
-   <widget class="QCameraViewfinder" name="viewFinder" native="true">
-    <property name="geometry">
-     <rect>
-      <x>80</x>
-      <y>80</y>
-      <width>251</width>
-      <height>161</height>
-     </rect>
-    </property>
-   </widget>
+   <layout class="QHBoxLayout" name="horizontalLayout_3">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QPushButton" name="pbCapture">
+          <property name="text">
+           <string>Capture</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="labCameraReady">
+          <property name="text">
+           <string>TextLabel</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QCameraViewfinder" name="viewFinder" native="true"/>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QPushButton" name="pbAnalyze">
+          <property name="text">
+           <string>Analyze</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="labAnalyzeResult">
+          <property name="text">
+           <string>TextLabel</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QLabel" name="labAnalyzeImage">
+        <property name="text">
+         <string>TextLabel</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
   </widget>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>400</width>
+     <width>457</width>
      <height>19</height>
     </rect>
    </property>
   </customwidget>
  </customwidgets>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>pbAnalyze</sender>
+   <signal>clicked()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>analyze()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>266</x>
+     <y>54</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>191</x>
+     <y>72</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>analyze()</slot>
+ </slots>
 </ui>