好吧,我有一个上面有一个按钮的文本编辑器......我希望文本编辑器位于布局内,以便它增加和减小它的大小QDialog
,但我不想对按钮做同样的事情,顺便说一句,它没有我想要的尺寸,也不能改变它。我能做些什么?
代码:
from PyQt4 import QtCore, QtGui
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class TextEditorDlg(QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.resize(500, 400)
self.Grid = QtGui.QGridLayout(self)
self.button = QtGui.QPushButton(self)
self.Grid.addWidget(self.button, 0, 0)
self.lineEdit = QtGui.QLineEdit(self)
self.textEdit = QtGui.QTextEdit(self)
self.Grid.addWidget(self.lineEdit, 1, 0)
self.Grid.addWidget(self.textEdit, 2, 0)
if __name__ == '__main__':
app = QApplication(sys.argv)
myapp = TextEditorDlg()
myapp.show()
sys.exit(app.exec_())
现在看到问题了吗?