]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - matrix-gui-v2/image-gallery.git/commitdiff
mainwindow: Fix scaling of initial image. master
authorJacob Stiffler <j-stiffler@ti.com>
Fri, 28 Aug 2015 14:52:21 +0000 (10:52 -0400)
committerJacob Stiffler <j-stiffler@ti.com>
Fri, 28 Aug 2015 17:22:55 +0000 (13:22 -0400)
Previously, the initial image was displayed during the "show" event. This cause
the scaling of the initial image to be incorrect because the QMainWindow is not
yet resized to fit the screen.

This moves the display of the initial image to the end of the resize event,
after the screen geometry has been obtained.

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
mainwindow.cpp
mainwindow.h

index eb80f8521dd64ae7d85f282d9ffe320f6e6d2837..f74dc34c0aa1258b2c90a51eedcae642e81e32c6 100644 (file)
@@ -128,12 +128,10 @@ void MainWindow::on_pushButton_clicked()
 {
     this->close();
 }
-void MainWindow::showEvent(QShowEvent *ev)
+void MainWindow::resizeEvent(QResizeEvent *ev)
 {
-    QMainWindow::showEvent(ev);
+    QMainWindow::resizeEvent(ev);
 
     if(imagesList.count() > 0)
-        displayImage(0);
+        displayImage(currentIndex);
 }
-
-
index 5a3087d48a6892eb1d23be022a530dcd0d283668..c446b5a7cda978c1e510054c975d8011a660e3d5 100644 (file)
@@ -20,7 +20,7 @@ public:
     ~MainWindow();
 
 protected:
-    void showEvent(QShowEvent *);
+    void resizeEvent(QResizeEvent *);
 private slots:
 
     void on_prevImage_clicked();