Results 1 to 3 of 3

Thread: QTableView how to do something on start/end editing

  1. #1
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView how to do something on start/end editing

    Are there any signals (I cannot find anything in the docs) emitted when tha
    user starts and ends the QTableView widget cell editation?

    I want to execute some function from table model then user begins edit eny cell and execute another function when user ends editing. How can i do this?

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTableView how to do something on start/end editing

    If you have own data model then
    On start editing QAbstractItemModel::data is called with role Qt::EditRole.
    On finish editing QAbstractItemModel::setData is called. See subclasing section in QAbstractTableModel and QAbstractItemModel.

  3. #3
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView how to do something on start/end editing

    I put qDebug() but there is no output in console and my timer does not stop.

    Qt Code:
    1. QVariant TxTableModel::data(const QModelIndex & index, int role) const
    2. {
    3. if (role == Qt::DisplayRole) {
    4. return m_Data.getCell(index.row(), index.column());
    5. }
    6. if (role == Qt::SizeHintRole) {
    7. return QSize(400, 50);
    8. }
    9. if (role == Qt::EditRole) {
    10. //timer->stop();
    11. qDebug() << "timer stop";
    12. return m_Data.getCell(index.row(), index.column());
    13. }
    14. return QVariant();
    15. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. problems editing rows in a QTableView
    By cyrfer in forum Qt Programming
    Replies: 4
    Last Post: 6th January 2010, 08:34
  2. Problem with editing QTableView
    By TimoSan in forum Qt Programming
    Replies: 0
    Last Post: 23rd November 2009, 10:46
  3. QTableView, editing, validating input
    By jml in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2007, 00:57
  4. Replies: 5
    Last Post: 18th July 2006, 22:31

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.