QTableView doubleclick and setEditTriggers(QAbstractItemView::SelectedClicked )
Hi...
I have a QTabWidget, inside 1 Tab I have a QTableView on which I have set the setEditTriggers(QAbstractItemView::SelectedClicked ).
I also have connected the doubleclick event: when I doubleclick on this TableView, I switch to the next Tab and show the required stuff... Everything is working well.
the problem is that when I doubleclick on a selectedcell... that one goes in editmode and the QCompleter::popup() is showed (even if the app already switched to the next tab).
What shoud I do, so that if I doubleClick on a selected cell, it desn't go in editmode?
Re: QTableView doubleclick and setEditTriggers(QAbstractItemView::SelectedClicked )
The QCompleter is not completely customizable, so I finished by recoding my own completer.
My class contains a QTableView, a pointer to the parent QLineEdit, and a pointer to an QAbstractTableModel.
The tricks consists on:
- writing a well coded Eventfilter method for the parentLineEdit.
- writing a well coded Eventfilter method for the QTableView
- bind the focus of parentLineEdit and QTableView -> QTableView.setFocusProxy(parentLineEdit);
- the parent of QTableView is the QMainWindow containing parentLineEdit
- I moved the QTableView on the parentLineEdit->rect().bottomLeft()
You don't need to anchor the parentLineEdit: for the time you are in editMode you can move only the mainWindow, if you click anywhere else the parentLineEdit loses focus and automatically the QTableView get closed.