Why?
Use a QStyleItemDelegate subclass and create your own QLineEdit with a QCompleter attached when the cell is edited. An editing widget does not exist until the user attempts to edit the cell. The editor is created by a default delegate, used, and destroyed when the user presses Enter or leaves the cell. To intercept this and substitute your enhanced editor you need to replace the delegate. The data item is accessed through the underlying model by the delegate to populate the editor and to write the edited value back at the completion of editing.since QTableWidget provide lineedit, I tried to use in order to attache it with my completer.
The problem you are facing with the code above is that you are doing nothing like attaching a completer to the default line edit... your code will only crash the program. The data item associated with a table cell is not a widget and you cannot treat it as one.The problem I am facing now is, if I attached a QLineEdit, I lost the signals of QTableWidget in row = n, col = 2, while other cells still can be notified if change some thing or click on theme,
The QTableWidget::itemChanged() signal tells you when any item in the model changes. The item can tell you which row and column it represents. This is unaffected by changing the delegate.for this reason I am looking for a way to notifier me if the widget in row =n and col=2 changed or not.





Reply With Quote
Bookmarks