fix: 解决bug85090

Description: 使用看图的适应图片的策略

Log: 与图片显示有关
Bug: https://pms.uniontech.com/zentao/bug-view-85090.html
Change-Id: I2d6ac4ae04af90b8b36ee56e9b0e318a16649131
This commit is contained in:
liuminghang 2021-06-24 16:51:32 +08:00
parent a72a11c17b
commit 17fb3bf430

View File

@ -193,6 +193,7 @@ void MainWidget::setupUi(QWidget *Widget)
m_pwidget->setFixedSize(this->width(), this->height() - 23);
m_pwidget->move(0, 0);
}
void MainWidget::setupConnect()
@ -300,7 +301,16 @@ void MainWidget::openImage(const QImage &img, const QString &name)
if (m_imageview) {
m_imageview->openFilterImage(img);
QTimer::singleShot(100, [ = ] {
//分辨率大于window的采用适应窗口没超过则适应图片
QRect rect1 = m_imageview->image().rect();
if ((rect1.width() >= m_imageview->width() || rect1.height() >= m_imageview->height() - 150) && m_imageview->width() > 0 &&
height() > 0)
{
m_imageview->fitWindow();
} else
{
m_imageview->fitImage();
}
});
m_imgName = name;
}