当我尝试按Enter键插入新行时,所有的行看起来都很好,直到超出窗口的限制为止。见下例:
我试过这个(Widget alignment in cell pyqt),这和我的问题差不多,但它不能解决它。你知道吗
下一个代码执行错误:
from PyQt5 import QtWidgets
import sys
app = QtWidgets.QApplication([])
table = QtWidgets.QTableWidget(0, 1)
def create_empty_row():
widget_completer = QtWidgets.QLineEdit()
widget_completer.returnPressed.connect(
create_empty_row)
_rows = table.rowCount()
table.setRowCount(_rows + 1)
table.setCellWidget(_rows, 0,
widget_completer)
create_empty_row()
table.show()
sys.exit(app.exec_())
我还尝试填充QTableWidget程序,一切看起来都很好,QLineEdit没有错位。但我必须按要求插入新行。你知道吗
如何在QTableWidget内对齐QLineEdit?你知道吗
谢谢!!你知道吗
您没有为不同的小部件设置正确的几何图形。所以,问题是QTableWidget的高度应该是屏幕高度-QLineEdit.height文件. 通过此更改,QLineEdit几何体与QTableWidget不匹配,应该对齐。你知道吗
我希望这对你有帮助
敬礼
相关问题 更多 >
编程相关推荐