It is part of broader code where this composite widget it is the element of a list.
But now let's focus on my problem that is:
How do I get to know the text in QPushButton?
This is the code:
myList = QListWidget(layout)
...
#this happens within a loop inside a method of the class
item = QtWidgets.QListWidgetItem()
item_widget = QtWidgets.QWidget()
line_push_button = QtWidgets.QPushButton("text I want to get")
line_push_button.clicked.connect(self.clicked)
line_text = QtWidgets.QLabel("some text")
item_layout = QtWidgets.QHBoxLayout()
item_layout.addWidget(line_push_button)
item_layout.addWidget(line_text)
item_widget.setLayout(item_layout)
myList.insertItem(i, item)
myList.setItemWidget(item, item_widget)
At runtime I can access myList, then I need to loop through the items of the list accessing for each of them the text in the button.
Since list element doesn't have a finChild, findChildren method I don't know what to do.
I don't understand how this kind of traversing works in PyQT
0 comments:
Post a Comment
Thanks