Created
March 25, 2016 03:36
-
-
Save 0xlitf/273f68259fdd75e0ceb0 to your computer and use it in GitHub Desktop.
QLabel显示图片保持缩放比
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| m_displayer->setPixmap(QPixmap::fromImage(image).scaled(m_displayer->size(), Qt::KeepAspectRatio)); | |
| //1、第一个参数应该为label的size,而不是图片的size | |
| //2、不应该设置setScaledContents(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment