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. Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget
Forum Updated to NodeBB v4.3 + New Features

Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 1.0k 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.
  • H Offline
    H Offline
    hbatalha
    wrote on last edited by hbatalha
    #1

    I need to add button to table cells and I have been using setCellWidget but it's a very slow operation and I need an alternative. I have been able to use a delegate but the problem is I haven't been able to add things like icons, stylesheet, connect signals the way I do with QPushButton.

    1 Reply Last reply
    0
    • JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      Where is @VRonin just when you need him...? ;-)

      H 1 Reply Last reply
      1
      • JonBJ JonB

        Where is @VRonin just when you need him...? ;-)

        H Offline
        H Offline
        hbatalha
        wrote on last edited by
        #3

        @JonB Yeah I have been waiting on his answer here too.

        JonBJ VRoninV 2 Replies Last reply
        0
        • H hbatalha

          @JonB Yeah I have been waiting on his answer here too.

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

          @hbatalha
          :) He is your man. He should be delighted to see you wanting to abandon setCellWidget() in favour of QStyledItemDelegate! But he is doubtless a busy man, he will be around soon....

          H 1 Reply Last reply
          1
          • JonBJ JonB

            @hbatalha
            :) He is your man. He should be delighted to see you wanting to abandon setCellWidget() in favour of QStyledItemDelegate! But he is doubtless a busy man, he will be around soon....

            H Offline
            H Offline
            hbatalha
            wrote on last edited by
            #5

            @JonB yeah that's because of his warning that I noticed how slow 'setCellWidget()` was.

            JonBJ 1 Reply Last reply
            1
            • H hbatalha

              @JonB yeah that's because of his warning that I noticed how slow 'setCellWidget()` was.

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

              @hbatalha Hi will like you even more for that :)

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                So why not simply use a QStyledItemDelegate as already said. There are a lot of examples around how to use this...

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                H 1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  So why not simply use a QStyledItemDelegate as already said. There are a lot of examples around how to use this...

                  H Offline
                  H Offline
                  hbatalha
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher I couldn't one example that handled signals mentioned in the OP.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    What's wrong with QAIM::activated() or clicked() ?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    H 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      What's wrong with QAIM::activated() or clicked() ?

                      H Offline
                      H Offline
                      hbatalha
                      wrote on last edited by
                      #10

                      @Christian-Ehrlicher isn't that for the table cells instead of a widget like QPushButton?
                      I don't understand how that would work to solve the OP issue.

                      1 Reply Last reply
                      0
                      • H hbatalha

                        @JonB Yeah I have been waiting on his answer here too.

                        VRoninV Offline
                        VRoninV Offline
                        VRonin
                        wrote on last edited by
                        #11

                        @hbatalha said in Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget:

                        @JonB Yeah I have been waiting on his answer here too.

                        Sorry, I was away for a few days, answered on the previous thread

                        "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

                        JonBJ 1 Reply Last reply
                        1
                        • VRoninV VRonin

                          @hbatalha said in Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget:

                          @JonB Yeah I have been waiting on his answer here too.

                          Sorry, I was away for a few days, answered on the previous thread

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

                          @VRonin
                          You are also wanted pretty desperately over at https://forum.qt.io/topic/131508/avoid-not-responding-when-adding-rows-to-qtablewidget/28, though I fear we may be fighting a losing battle, but it's funny/instructional to read....

                          VRoninV 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @VRonin
                            You are also wanted pretty desperately over at https://forum.qt.io/topic/131508/avoid-not-responding-when-adding-rows-to-qtablewidget/28, though I fear we may be fighting a losing battle, but it's funny/instructional to read....

                            VRoninV Offline
                            VRoninV Offline
                            VRonin
                            wrote on last edited by
                            #13

                            @JonB said in Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget:

                            @VRonin
                            You are also wanted pretty desperately over at https://forum.qt.io/topic/131508/avoid-not-responding-when-adding-rows-to-qtablewidget/28, though I fear we may be fighting a losing battle, but it's funny/instructional to read....

                            Given the same OP and very similar problem I'd say https://forum.qt.io/post/687439 addresses it too

                            "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

                            JonBJ 1 Reply Last reply
                            0
                            • VRoninV VRonin

                              @JonB said in Add QPushButton to QTableWidget cell without using QTableWidget::setCellWidget:

                              @VRonin
                              You are also wanted pretty desperately over at https://forum.qt.io/topic/131508/avoid-not-responding-when-adding-rows-to-qtablewidget/28, though I fear we may be fighting a losing battle, but it's funny/instructional to read....

                              Given the same OP and very similar problem I'd say https://forum.qt.io/post/687439 addresses it too

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

                              @VRonin
                              As he pleases, if he sees this (unless you want to refer him to that from there). He doesn't seem to want to change, and thinks other things are at fault too, so it's probably a losing battle...

                              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