How to get input from tableview inside the itemDelegate file?
lcg2025882 last edited by
Hello, I am working on a QT project. I faced up with an problem recently.
What I am going to do is to implement a table view (historysheet.cpp). In order to change some table cell into combobox, I used item delegate (comboboxitemdelegate.cpp). This works perfectly. Then what I am going to do is to add a fucntion that when the user presses TAB it copies the content of the previous row same column into current row same column. When I add eventFilter(QObject *object, QEvent *event) into comboboxitemdelegate.cpp, it can not get the input from table view (historysheep.cpp) and current index of row and column. However if I add a function eventFilter into historysheet.cpp, it seems that it conflicts with the itemdelegate. Because when it comes to a combobox cell the TAB function won't work any more. ui->tableView->installEventFilter(this); ui->tableView->setItemDelegate(cbid);
The final goal for me is that two functions are needed. 1. Some table cells are combobox 2 When TAB is pressed it copies the content from last row to current row ( same column )