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. Adding button to QTableview .

Adding button to QTableview .

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 12.4k Views
  • 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.
  • B Offline
    B Offline
    BibekKumar
    wrote on last edited by
    #1

    I have created one table by using QTableview and QAbstractTableModel .
    In one of the cell i want to add one help button (right corner of that cell ).

    Is there any way to achieve the above one ?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Does it need to really be a button, or is a clickable area or icon enough for your purposes?

      A 1 Reply Last reply
      0
      • B Offline
        B Offline
        BibekKumar
        wrote on last edited by
        #3

        actually i need a button only ..
        could you please share some codes ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on last edited by
          #4

          check "here":http://qt-project.org/forums/viewthread/16673/ and "here":http://qt-project.org/forums/viewthread/16837/

          1 Reply Last reply
          0
          • B Offline
            B Offline
            BibekKumar
            wrote on last edited by
            #5

            but through QItemDelegate we can only display the widget during editing the cell..
            Is there any way to display it permanently ?
            [quote author="Sam" date="1343938922"]check "here":http://qt-project.org/forums/viewthread/16673/ and "here":http://qt-project.org/forums/viewthread/16837/[/quote]

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sam
              wrote on last edited by
              #6

              In the second link its specified that you need to use "setIndexWidget()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setIndexWidget for ItemViews and setItemWidget() for ItemWidgets. So for adding a pushButton to a tableView you need to use "setIndexWidget()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setIndexWidget

              1 Reply Last reply
              0
              • SavedS Offline
                SavedS Offline
                Saved
                wrote on last edited by
                #7

                [quote author="Andre" date="1343915387"]Does it need to really be a button, or is a clickable area or icon enough for your purposes?[/quote]

                Hello,

                I need also something like a small button in a QTableView cell corner. But I think for me a clickable area is also ok. What was your purpose?

                If I use custom widget and put in in the CustomQItemDelegates paint methode, I get only the picture of the widget and my button is not clickable.

                If I use setIndexWidget, the button takes the full cell.

                Which approch is better for my purpose?

                Thank you.

                1 Reply Last reply
                0
                • A andre

                  Does it need to really be a button, or is a clickable area or icon enough for your purposes?

                  A Offline
                  A Offline
                  andsun
                  wrote on last edited by
                  #8

                  @andre Hi, I'm struggling with the equal problem. However I want to just on click open upp a couple of cells for editing and change the 'button' to a save button and if clicked -perform a save of data. Is it possible with an icon/image as you suggest/ask ? How??

                  1 Reply Last reply
                  0

                  • Login

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