Skip to content

Commit

Permalink
Refs issue #43: fixed onclick
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Amadeus committed Jun 9, 2018
1 parent 24b6d2c commit f6a17f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -306,11 +308,13 @@ void MainWindow::processAndShowPicture(std::shared_ptr<QImage> 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());

Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/molluscview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ MolluscView::MolluscView(MainWindow * window)

void MolluscView::mouseReleaseEvent(QMouseEvent * event)
{
QGraphicsView::mouseReleaseEvent(event);
m_window->onClick(event);
}

0 comments on commit f6a17f6

Please sign in to comment.