Hi,
If you set wordWrap to True for a QLabel in widget the layout, the
resizing of the widget is kinda strange: The widget can be resized to
nothing etc. I've attached a small example, displaying two widgets: One
with and one without wordwrap. This must be a bug, right?
Best regards,
Mads
import sys
from PyQt4 import QtCore, QtGui
class Label(QtGui.QLabel):
"""
Class for defining a word wrapped label.
"""
def __init__(self, parent=None):
"""
Constructor.
"""
# Call base class constructor
QtGui.QLabel.__init__(self, parent)
# Add some text
text = """Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."""
self.setText(text)
class Widget(QtGui.QWidget):
def __init__(self, word_wrap=False, parent=None):
"""
Constructor.
"""
# Call base class constructor
QtGui.QWidget.__init__(self, parent)
# Add some text
layout = QtGui.QVBoxLayout()
self.setLayout(layout)
# Add some widgets
label = Label()
label.setWordWrap(word_wrap)
layout.addWidget(label)
push_button = QtGui.QPushButton('Press me')
layout.addWidget(push_button)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
widget1 = Widget(word_wrap=False)
widget1.show()
widget2 = Widget(word_wrap=True)
widget2.show()
sys.exit(app.exec_())
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt