Double click in QTableWidget and putting data in QLabels
-
Posting your code is not an issue. On the contrary, it will allow you to get feedback to improve it :-)
-
Posting your code is not an issue. On the contrary, it will allow you to get feedback to improve it :-)
-
With your code show me sibling has no attibute text()...
I'm actually using a QTW, but in PySide6 hasn't "onITemDoubleClicked", as you said. But I've tried it with all kinds of signals, without success.
I am trying this code, shows the index, but i can't grab the cell content.
But doesn't matter... i'm just studying... Maybe I need more practice.
If i get an answer i will post. Thanks.if not self.ui.tx_A.text() and not self.ui.tx_B.text(): for idx in self.ui.tb_Dados.selectionModel().selectedIndexes(): self.ui.tx_A.setText(str(idx.row())) self.ui.tx_B.setText(str(idx.column()))
-
With your code show me sibling has no attibute text()...
I'm actually using a QTW, but in PySide6 hasn't "onITemDoubleClicked", as you said. But I've tried it with all kinds of signals, without success.
I am trying this code, shows the index, but i can't grab the cell content.
But doesn't matter... i'm just studying... Maybe I need more practice.
If i get an answer i will post. Thanks.if not self.ui.tx_A.text() and not self.ui.tx_B.text(): for idx in self.ui.tb_Dados.selectionModel().selectedIndexes(): self.ui.tx_A.setText(str(idx.row())) self.ui.tx_B.setText(str(idx.column()))
@Andrade33 said in Double click in QTableWidget and putting data in QLabels:
With your code show me sibling has no attibute text()...
I'm actually using a QTW, but in PySide6 hasn't "onITemDoubleClicked", as you said. But I've tried it with all kinds of signals, without success.onItemDoubleClicked is a slot that you have to add to your class and to which you have to connect the itemDoubleClicked signal.
-
@Andrade33 said in Double click in QTableWidget and putting data in QLabels:
With your code show me sibling has no attibute text()...
I'm actually using a QTW, but in PySide6 hasn't "onITemDoubleClicked", as you said. But I've tried it with all kinds of signals, without success.onItemDoubleClicked is a slot that you have to add to your class and to which you have to connect the itemDoubleClicked signal.
@SGaist
I understood your explanation very well. And I'm grateful.
This is the implementation class.################################################# (...) #Populate table self.populate_table_Widget() ################################################# # Button to save self.ui.bt_salvar.clicked.connect(self.cadDados) ################################################# def populate_table_Widget(self): (...) self.ui.tb_Dados.itemDoubleClicked.connect(self.onItemDoubleClicked) self.PreencherTabela() (...) ################################################# def onItemDoubleClicked(self, item): if not self.ui.tx_A.text() and not self.ui.tx_B.text(): for column, label in [(0, self.ui.tx_A), (1, self.ui.tx_B)]: sibling = self.ui.tb_Dados.item(item.row(), column) self.ui.tx_A.setText(sibling.text()) ################################################# def preencher_Tabela(self): lista = CrudDados() lista.listaDados() i = 0 while self.ui.tb_Dados.rowCount() > 0: (...) #################################################
-
So you have it working ?
-
Can you create a minimal runnable script that shows that issue ?
-
@SGaist
Hi friend.
I've already created a minimal app and it's running very well... add data to the database, populate the table dynamically, get the data from database and show the data in the table cells...
There is communication between signal and slot... everything is ok.
However, I'll try to isolate some parts...As I said, it's just a study... and I've already wasted a lot of time on it... let's move on.
At another time I will see this.
Now i'm learning to use github... as soon as i learn i'll put the code there and if you can see I pass the link to you (if you want, obviously)
For now, thank you very much for your attention.Just answer me one more thing:
As the problem was not resolved (or unsolved), how I proceed with the post? -
@SGaist
Hi friend.
I've already created a minimal app and it's running very well... add data to the database, populate the table dynamically, get the data from database and show the data in the table cells...
There is communication between signal and slot... everything is ok.
However, I'll try to isolate some parts...As I said, it's just a study... and I've already wasted a lot of time on it... let's move on.
At another time I will see this.
Now i'm learning to use github... as soon as i learn i'll put the code there and if you can see I pass the link to you (if you want, obviously)
For now, thank you very much for your attention.Just answer me one more thing:
As the problem was not resolved (or unsolved), how I proceed with the post?@Andrade33 said in Double click in QTableWidget and putting data in QLabels:
As the problem was not resolved (or unsolved), how I proceed with the post?
Just leave thread as-is Unsolved if you wish, the forum will continue to function OK :) Or mark it as solved even though it wasn't for you, again the forum will work OK!