I have the following code:
import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \ "Nullam malesuada tellus in ex elementum, vitae rutrum enim vestibulum."
It works as expected, creating a window whose size cannot be smaller:

However, when I uncomment the line self.label.setWordWrap(True) , these restrictions seem to disappear. I can resize the window to a smaller one, completely breaking the layout, since QTextEdit still retains the size limit:

I tried to fix this using self.setMinimumSize(self.size()) . This works for this particular example, however it breaks if the size is larger, for example self.text.setMinimumSize(480, 800) . This makes the window too small even when it is created, so setMinimumSize does not help:

Is there a way to fix this and make the window / layout still match the minimum QTextEdit size even if word wrap is enabled?
Version Information:
OS: Windows-7-SP1 (32bit) Python: 3.4.1 PyQt: 5.3.1 Qt: 5.3.1
source share