简体   繁体   English

如何根据Qt5中的窗口大小更改为Qlabel启用自动调整大小?

[英]How to enable auto resize for Qlabel in accordance with Window size change in Qt5?

I am beginning with a Qt5 programming. 我从Qt5编程开始。 I am working on an image crop application. 我正在研究图像裁剪应用程序。 the Qlabel which is holding the loaded image is of a fixed size. 保存加载的图像的Qlabel具有固定的大小。 I need the Qlabel to auto resize in accordance with the main window size changes 我需要Qlabel根据主窗口大小的变化自动调整大小

Default screen 默认画面

resized screen 调整萤幕大小

Try using different QLayouts. 尝试使用其他QLayouts。 The entire purpose of Qlayouts is the take of responsibility of sizing and positioning from you. Qlayouts的全部目的是承担您进行大小调整和定位的责任。 That's something that Qt dose very well, in comparison to other UI frameworks. 与其他UI框架相比,Qt可以很好地解决这一问题。

Read this http://doc.qt.io/qt-5/layout.html 阅读此http://doc.qt.io/qt-5/layout.html

mentioned in the comment, here's a solution I did in 20mins. 评论中提到的,这是我在20分钟内完成的解决方案。 http://www.pilypala.com/sites/default/files/resizing.zip http://www.pilypala.com/sites/default/files/resizing.zip

在此处输入图片说明在此处输入图片说明在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM