Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to make QTableWidget copyable?
Qt 6.11 is out! See what's new in the release blog

Is it possible to make QTableWidget copyable?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 3.3k Views 3 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.
  • V Offline
    V Offline
    viniltc
    wrote on last edited by
    #1

    Hi,

    I have a basic question, is it possible to make QTableWidget cells copyable?

    For ex, I wonder if there is a feature to select cells on QTableWidget and copy contents into a spreadsheet.

    JonBJ 1 Reply Last reply
    1
    • V viniltc

      Hi,

      I have a basic question, is it possible to make QTableWidget cells copyable?

      For ex, I wonder if there is a feature to select cells on QTableWidget and copy contents into a spreadsheet.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @viniltc
      In a word: you cannot/would not want to copy QTableWidget cells (with all their layout etc.), but you can indeed certainly copy the data in the cells easily. Just iterate the table rows/columns outputting data(index(row, column)) e.g. to a CSV file.

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

        Hi,

        Do you mean doing Ctrl+C from your QTableWidget and Ctrl+V in Excel ?

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

        V 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Do you mean doing Ctrl+C from your QTableWidget and Ctrl+V in Excel ?

          V Offline
          V Offline
          viniltc
          wrote on last edited by
          #4

          @SGaist Hi,
          Yes, at present I cant copy multiple cell contents from the QTableWidget

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

            Can you be more precise ?

            "Can't" can mean several different things like:

            • can't select multiple cells
            • can't paste
              etc.

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

            V 1 Reply Last reply
            1
            • C Offline
              C Offline
              ChrisW67
              wrote on last edited by
              #6

              I would assume then that QAbstractItemView::selectionMode() is QAbstractItemView::SingleSelection

              1 Reply Last reply
              1
              • SGaistS SGaist

                Can you be more precise ?

                "Can't" can mean several different things like:

                • can't select multiple cells
                • can't paste
                  etc.
                V Offline
                V Offline
                viniltc
                wrote on last edited by
                #7

                @SGaist

                I can select multiple cells from the QTableWidget but can't right-click and copy contents from it.

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

                  It's up to you to implement a contextual menu for that. See customContextMenuRequested.

                  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
                  3

                  • Login

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