QtDesigner &PySide:QTableWidget 无法访问 [英] QtDesigner & PySide: QTableWidget don't get accessible

查看:46
本文介绍了QtDesigner &PySide:QTableWidget 无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 QtDesigner 中创建了一个表单.这个表单在函数的帮助下从 PySide 加载

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

widget = loader.load(file, parent)

然而,QTableWidget(带有objectNname buffer_table)无法通过

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

widget.buffer_table

如果我使用 QPushButton,它会起作用.我怎样才能让它工作.我想用 Python 填写表格.

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

这是我想使用的 ui 文件:http://pastebin.com/6PZFrvmr

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

当我创建一个新表并尝试加载它时,它似乎有效.但是,如果我将它放在 QTabWidget 中,我将无法访问它.

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.

widget.findChild(QWidget, "buffer_table"):搜索&找到就是诀窍!

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

推荐答案

您可以尝试使用以下命令查看表是否存在:widget.findChild(QWidget, "buffer_table")(甚至来自父,因为它是递归搜索).

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).

这篇关于QtDesigner &PySide:QTableWidget 无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆