Results 1 to 2 of 2

Thread: How can i capture the cellChanged() signal ONLY WHEN user editing

  1. #1
    Join Date
    Jul 2010
    Posts
    20
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How can i capture the cellChanged() signal ONLY WHEN user editing

    in QTableWidge,the itemChanged() or cellChanged() signal simply emits whenever a item or cell content changed, but i want save the item.text() only when user edited it ,not by setItem() method in program.coz i have write some code to add a new row into QTableWidget, after the new row added, the itemChanged() emitted row*col times, coz,the program called setItem() row*col time.

    i was trying to find some signal like itemFocusOut() to ensure user side editing, but there is no signal like this ,only have itemEnter()

    is there a better way to resolve this, currently when i update the table from dataSet, first disconnect itemChanged() then ,connect it again .

    sry for my english
    Last edited by vertusd; 28th October 2010 at 03:06.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How can i capture the cellChanged() signal ONLY WHEN user editing

    QAbstractItemView::currentChanged() will tell you when the current cell changes as the user moves off it (although the program can trigger that also). QAbstractItemModel::dataChanged() can tell you when the data is actually changed in the model.

Similar Threads

  1. Replies: 2
    Last Post: 26th April 2010, 10:46
  2. signal emitted when I zoom
    By mastupristi in forum Qwt
    Replies: 1
    Last Post: 8th July 2009, 17:02
  3. Signal emitted more than once?
    By dbrmik in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2009, 12:44
  4. Program crash when a signal is emitted
    By croscato in forum Qt Programming
    Replies: 7
    Last Post: 22nd November 2008, 22:24
  5. When itemChanged is emitted, can the change type be detected?
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2006, 17:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.