accpert.com
accpert.com

Reputation: 129

QTableWidget Signal and Slot move fields

I wonder if someone knows this.

Tabwidget and lineEdit fields

as in attached pic let's say I have a tabwidget in qt designer and some lineEdit fields. What I want to achieve is, if the user clicks on a row of the tabwidgets the values of the items will be moved to the lineEdit fields. I saw I can somehow connect them but how to achieve this with the signal and slot functionality in qt designer without programming.

Upvotes: 0

Views: 214

Answers (1)

eyllanesc
eyllanesc

Reputation: 243955

No, it is not possible without implementing code manually as there is no signal to send the text. The logic is:

    self.tableWidget.cellDoubleClicked.connect(self.handle_cellDoubleClicked)
    # or self.tableWidget.cellClicked.connect(self.handle_cellDoubleClicked)

def cellDoubleClicked(self, row, column):
    item = self.tableWidget.item(row, column)
    text = item.text() if item is not None else ""
    self.lineEdit.setText(text)

Upvotes: 1

Related Questions