how to customize edit key in QTableView?
Hi, everyone.
How to customize a edit key in QTableView?
I use a customized delegate to edit data in model. The cell editor can be triggered by a way defined by setEditTriggers ( EditTriggers ).
But I don't find a way to define custom key, such an enter or some other key. There are only 7 trigger types, but no one is what I need.
Thank you.
Re: how to customize edit key in QTableView?
Use a QShortcut, connect the activated() signal to a slot, and call the view's edit() slot. Something like:
Code:
{
Q_OBJECT
public:
connect(s, SIGNAL(activated()), SLOT(editActivated()));
}
private slots:
void editActivated() {
edit(currentIndex());
}
};
If you intercept Enter to start and edit you may lose it as a way to end the edit as it is by default.