Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Display One data at a time when clicked

Display One data at a time when clicked

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 4 Posters 757 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    praneshpk
    wrote on last edited by
    #1

    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)
    
    VRoninV 1 Reply Last reply
    0
    • P praneshpk

      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)
      
      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      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

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2
      • P Offline
        P Offline
        praneshpk
        wrote on last edited by
        #3

        @VRonin
        can you give some example in python?

        JonBJ 1 Reply Last reply
        0
        • P praneshpk

          @VRonin
          can you give some example in python?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            praneshpk
            wrote on last edited by
            #5

            @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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              You can check the Python documentation of the class.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved