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. Qtablewideget detect change after click.
Forum Update on Monday, May 27th 2025

Qtablewideget detect change after click.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 901 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi,

    I have a vector list of object id and names etc. If we detect an object listed in that vector space we will add this item to the qtablewidget . than we want to change or edit the detail from qtablewidget.

    If we use change detect it is detecting the first change which means putting in the list from detection of object. But we want to first click the cell and change it then ENTER . we want to detect this.

    Is this possible ?

    thnx

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

      Hi,

      Do you mean what is provided by QTableWidget::itemChanged ?

      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
      • R Offline
        R Offline
        RahibeMeryem
        wrote on last edited by
        #3

        Yes, the problem here our QTableWidget is empty in the beginning. And we are filling it automatically when we detect new object from the video. Thats is also detected as a change.

        what we want to do is ; we want to edit qTablewidget if the label is incorrect. But detect change also detect for first insert / add.

        What we try a workaround is first detect doubleclick and set a t_row t_column and than check if edited row and column equals to the t_row , t_column. So we understanda user changed somethin not program.

        any other way ?

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

          Hi
          You can use blockSignals(true/false); on the qtablewidget when you fill data from code to avoid it triggering
          change actions alike when user changes.

          1 Reply Last reply
          2
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5

            I'm afraid blocking signals might prevent the view from updating.

            And we are filling it automatically when we detect new object from the video.

            When you fill it automatically, before adding the QTableWidgetItem call item->setData(Qt::UserRole+88,true)

            then in the slot connected to itemChanged do

            if(item->data(Qt::UserRole+88).toBool()){
            const QSignalBlocker blocker(item->tableWidget());
            item->setData(Qt::UserRole+88,QVariant());
            return;
            }
            

            P.S.
            Starting from Qt 5.11 there will be a more elegant solution to this problem

            "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

            • Login

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