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. [SOLVED] QtableWidget itemChanged signal problem
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QtableWidget itemChanged signal problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.8k 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.
  • A Offline
    A Offline
    advseo32
    wrote on last edited by
    #1

    Hello,

    i have a Qtablewidget populated with editable item for the first row and none editable items for rest of rows

    i use a custom delegate "m_delegate" for that table ( Qcombobox is in the col = 2 )

    i catch when the user make a selection via comboboxx ( text of Qcombobox changed ) to emit a signal , to unlock next row . ( to unlock the next row i make item editable setIemFlags(Qt::itemIsEditable)) ;
    @
    connect(m_delegate,SIGNAL(unlockRow(QModelIndex)),this,SLOT(unlockNextRow(QModelIndex)));@

    there is no problem until this point . in other side i use

    @
    connect(ui->newCommandetableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(unlockNextRow(QTableWidgetItem*)));@

    the after using a debugger is figured out what happen,

    when some changes happened in col == 2 ( Qcombox ) a signal (unlockRow(QmodelIndex ) will be emitted and call unlockNextRow(QModelIndex) to unlock next row

    @ // unlock next
    for(int colToUnlock=0; colToUnlock <ui->newCommandetableWidget->columnCount(); colToUnlock++)
    {
    if(colToUnlock == 1 || colToUnlock == 2 || colToUnlock == 3)
    {
    ui->newCommandetableWidget->item(row,colToUnlock)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
    }

        }@ 
    

    and this force itemChanged(QTableWidgetItem*) signal also, and that it a problem , the program not stop unlocking rows and craches

    the scenario is like ( unlockRow (signal) emitted ) => call unlockNextRow(QmodelIndex) slot ) => unlockNextRow(QmodelIndex) make some changes in table items , and this make QitemChanged(QtableWidgetItem *) signal working witch call also unlockNextRow(QtableWidgetItem *) slot )

    and her is the real problem

    i wanna you can help me to solve this problem

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

      Hi,

      To understand better, why do you need both signals ?

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

        I need one signal from my custom delegate to detect that the cell in col 2 is not empty, then i will activate the next row witch is not editable

        another signal itemChanged(QtableWidgetItem *) to detect that the editig of same;

        when the first signal called, he makes the second signal working also

        witch is a problem .

        i have make a condition if ( item(row-1)->text().isEmpty) return ;
        and it works

        [quote author="SGaist" date="1381099460"]Hi,

        To understand better, why do you need both signals ?[/quote]

        sorry, the problem that i can't explain my problem !!

        thanks, i have got the solution

        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