I am trying to add QLabels to a QverticalLayout in Pyside2, which should update with the text of certain file names. I want to have dynamic widget creation i.e the widgets should get added as the number of file name increases.
I am having no idea how to implement the same. The widgets are also not shown in the Layout.
#label.setStyleSheet("QLabel { background-color : green; color : black; }"); // I tried the commented part of the code for the labels but no luck
#label = self.ui.verticalLayout.itemAt(index).widget()
label.setStyleSheet("QLabel { background-color : white; color : black; }");
label.setText=localFile
self.ui.verticalLayout.addWidget(label)
index=index+1
label=QtWidgets.QLabel()
#label.setStyleSheet("QLabel { background-color : green; color : black; }"); // I tried the commented part of the code for the labels but no luck
#label = self.ui.verticalLayout.itemAt(index).widget()
label.setStyleSheet("QLabel { background-color : white; color : black; }");
label.setText=localFile
self.ui.verticalLayout.addWidget(label)
index=index+1
To copy to clipboard, switch view to plain text mode
I am unable to get the label in the designated place.
Bookmarks