From f6a17f62283b2f4fec92b1aef824329dbe6c003b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 9 Jun 2018 15:27:34 +0200 Subject: [PATCH] Refs issue #43: fixed onclick --- src/mainwindow.cpp | 12 ++++++++---- src/mainwindow.hpp | 1 + src/molluscview.cpp | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 466acb3..5f2b7a4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -17,6 +17,7 @@ MainWindow::MainWindow(QWidget *parent, MolluscPalette* molluscPalette, bool use , m_selectedMolluscIndex(0) , m_layout(new QGridLayout()) , m_scrollArea(new QScrollArea()) + , m_resultLabel(new QLabel()) , m_infoWidget(new QWidget()) , m_dWidget(new QDockWidget(this)) , m_classLabel(new QLabel()) @@ -57,6 +58,7 @@ MainWindow::MainWindow(QWidget *parent, MolluscPalette* molluscPalette, bool use this->setCentralWidget(m_view); m_view->setScene(m_scene); + m_scene->addWidget(m_resultLabel); this->showCameraButton(); this->showDia(); } @@ -306,11 +308,13 @@ void MainWindow::processAndShowPicture(std::shared_ptr inputImage) { m_idImage = new QImage(image.width(), image.height(), image.format()); m_molluscs = Painter::paint(molluscPositions, m_molluscPalette, *m_result, *m_idImage); - m_scene->removeItem(m_pixmapItem); - delete m_pixmapItem; + //m_scene->removeItem(m_pixmapItem); + //delete m_pixmapItem; auto offset = (display.width() - m_result->width()) / 2; - m_scene->setSceneRect(-offset, 0, display.width(), display.height()); - m_pixmapItem = m_scene->addPixmap(QPixmap::fromImage(*m_result)); + //m_scene->setSceneRect(-offset, 0, display.width(), display.height()); + //m_pixmapItem = m_scene->addPixmap(QPixmap::fromImage(*m_result)); + m_resultLabel->setFixedSize(display.width(), display.height()); + m_resultLabel->setPixmap(QPixmap::fromImage(*m_result)); m_cameraButton->move(display.width() - m_cameraButton->iconSize().width() - offset, display.height() - m_cameraButton->iconSize().height()); diff --git a/src/mainwindow.hpp b/src/mainwindow.hpp index 1af4c83..9d56c85 100644 --- a/src/mainwindow.hpp +++ b/src/mainwindow.hpp @@ -65,6 +65,7 @@ class MainWindow : public QMainWindow { QWidget *m_infoWidget; QDockWidget *m_dWidget; QPushButton *m_cameraButton; + QLabel *m_resultLabel; QLabel *m_classLabel; QLabel *m_familyLabel; diff --git a/src/molluscview.cpp b/src/molluscview.cpp index 0f294c2..2abc58e 100644 --- a/src/molluscview.cpp +++ b/src/molluscview.cpp @@ -9,5 +9,6 @@ MolluscView::MolluscView(MainWindow * window) void MolluscView::mouseReleaseEvent(QMouseEvent * event) { + QGraphicsView::mouseReleaseEvent(event); m_window->onClick(event); }