QtDesigner & PySide: QTableWidget don't get ac

2019-02-18 10:32发布

问题:

I made a form in QtDesigner. This form gets loaded from PySide with help of the function

widget = loader.load(file, parent)

However, the QTableWidget (with objectNname buffer_table) don't get accessible with

widget.buffer_table

If I use a QPushButton instead it works. How can I get this working. I'd like to fill up the table in Python.

This is the ui-file i'd like to use: http://pastebin.com/6PZFrvmr

EDIT: When I create a new table and try to load it, it seems to work. However, if I put it in a QTabWidget I can't access it.

EDIT2: widget.findChild(QWidget, "buffer_table"): Search & find is the trick!

回答1:

You could try to see if the table is there with: widget.findChild(QWidget, "buffer_table") (even from the parent, since it is a recursive search).