Solved Is there a way to detect if QTableWidgetItem is doubleClicked?
-
QTableWidgetItem::isSelected() only detects if it is literally selected or not. (Single clicked is included)
Also, Can I retrieve current-typing text on QTableWidgetItem after the item is focused? I checked that QTableWidgetItem::text() just retrieves text before focusing the item.
-
Hi
There is
http://doc.qt.io/qt-5/qtablewidget.html#itemDoubleClickedAbout getting text While typing it.
its somewhat hacky as it lives inside the default item Delegate.Why do you need that ?
-
@mrjj
This is what I want to make. If those buttons are pressed, 𝒙 (or 𝒚) should be simply appended to current text.
item->setText(item->text() + "𝒙") can not do that because item->text() retrieves text before focusing, not the text current typing. -
Hi,
From a quick check, you would likely have to implement a custom QStyledItemDelegate from which you modify the createEditor function to emit a signal with the editor created as parameter. In a slot connected to that signal you can store that editor widget and thus you can modify its content when needed. Don't forget to also handle the case when the editor is destroyed. For example using a QPointer for that.
-
I just solved this just with making a cell QLineEdit. Thanks for reply!