Unsolved Display One data at a time when clicked
-
Hi. I have created an application which displays list of data in one tableview. whenever I click that data it should bedisplayed in textedit. Everythingis fine. Whenever I click the data, it is displayed in textedit, after that when I pressed another data, this data is added to the previous data. What I need is to display what is pressed, previous data should be refreshed.
self.tableView_2.doubleClicked.connect(self.doubleClicked_table) def doubleClicked_table(self,index): print( "Column is " + str(index.column())) print ("Row is " + str(index.row())) #print(index.data()) fullmaildata = index.data() print(fullmaildata) self.fullmail.textCursor().insertText(fullmaildata)
-
There is a class that takes care of this, you don't have to do it manually: https://doc.qt.io/qt-5/qdatawidgetmapper.html
-
@VRonin
can you give some example in python? -
@praneshpk
You say this each time. You really need to make the effort to adapt C++ examples to Python, that is the nature of the Qt example world. It really isn't hard, and indeed is easier than going the other way.Otherwise do your own Google searching for Python code, because people here aren't going to rewrite each one in Python for you.
-
@JonB I am not asking everyone to rewrite code for me, I am new to programming. So I'm starting with python. I have my code and Everywhere I'm pasting the relevant code. So it doesn't mean that I'm asking for rewriting of code from someone. I just need to know what function should I need to replace in place of my code, so that's how a forum works. Thank you
-
Hi,
You can check the Python documentation of the class.