Bug fix: Ui resize

This commit is contained in:
yonghye 2018-11-06 16:12:27 +09:00
parent 6f593bba38
commit b411e35ccb
3 changed files with 7 additions and 10 deletions

View File

@ -86,6 +86,9 @@ void label_img::setMousePosition(int x, int y)
if(x > this->width()) x = this->width() - 1; if(x > this->width()) x = this->width() - 1;
if(y > this->height()) y = this->height() - 1; if(y > this->height()) y = this->height() - 1;
m_aspectRatioWidth = static_cast<double>(m_inputImg.width()) / this->width();
m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height();
m_mouse_pos_in_image_coordinate = QPoint(static_cast<int>(x * m_aspectRatioWidth + 0.5), m_mouse_pos_in_image_coordinate = QPoint(static_cast<int>(x * m_aspectRatioWidth + 0.5),
static_cast<int>(y * m_aspectRatioHeight + 0.5)); static_cast<int>(y * m_aspectRatioHeight + 0.5));
} }
@ -96,9 +99,6 @@ void label_img::openImage(const QString &qstrImg)
m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888); m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888);
m_inputImgCopy = m_inputImg; m_inputImgCopy = m_inputImg;
m_aspectRatioWidth = static_cast<double>(m_inputImg.width()) / this->width();
m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height();
m_objBoundingBoxes.clear(); m_objBoundingBoxes.clear();
m_leftButtonClickedPoint = QPoint(); m_leftButtonClickedPoint = QPoint();

View File

@ -24,7 +24,6 @@ public:
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev); void mouseReleaseEvent(QMouseEvent *ev);
QImage m_inputImg; QImage m_inputImg;
QImage m_inputImgCopy;//for drawing QImage m_inputImgCopy;//for drawing

View File

@ -21,8 +21,6 @@ public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
Q_SIGNALS:
private slots: private slots:
void on_pushButton_open_files_clicked(); void on_pushButton_open_files_clicked();
void on_pushButton_save_clicked(); void on_pushButton_save_clicked();