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 a slot for a cell of a QTableWidget (solved)
Forum Updated to NodeBB v4.3 + New Features

Add a slot for a cell of a QTableWidget (solved)

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.1k 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.
  • M Offline
    M Offline
    mohamaddanesh44
    wrote on last edited by
    #1

    hi
    i have a "QTableWidget" with 4 columns and 10 rows. i want to set a signal and a slot for cell(4,4). how can i do that???

    thanks

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

      Hi,

      Before trying,, could you explain why you need that ?

      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
      0
      • M Offline
        M Offline
        mohamaddanesh44
        wrote on last edited by
        #3

        i program a kind of mailbox.
        emails are shown in a QTableWidget.
        now when i click on a cell i want to see my mail, something like yahoo mail or gmail.
        get it?

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

          Then you should rather use QTableWidget's itemClicked and do the rest from there

          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
          0
          • M Offline
            M Offline
            mohamaddanesh44
            wrote on last edited by
            #5

            could you explain it with some source codes?

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

              @
              MyWidget::MyWidget(QWidget parent):
              QWidget(parent)
              {
              // rest of initialization
              connect(tableWidget, SIGNAL(itemClicked(QTableWidgetItem
              )), SLOT(onItemClicked(QTableWidgetItem*)));
              }

              void MyWidget::onItemClicked(QTableWidgetItem *item)
              {
              // Do your processing based on the item content
              }
              @

              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
              0
              • M Offline
                M Offline
                mohamaddanesh44
                wrote on last edited by
                #7

                thanks dude :)

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

                  You're welcome

                  If this solves your problem, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                  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
                  0

                  • Login

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