How can I tell QTableWidget to finish editing a cell?

I am showing a popup menu to select some values ​​in a QTableWidget. The lowest item is the "Edit List" entry, when I select it, a new window should automatically appear, and the QComboBox should disappear, and the cell will return to the Qt :: DisplayRole state.

Now Qt has all these nice API calls, such as, QTableWidget.edit()and QTableWidget.editItem()what I'm really looking for is QTableWidget.endEditing(), preferably without specifying a cell index, although I could get this using this call:

table.currentIndex()

... but I don’t know if I can guarantee that the current cell is an editable cell.

Is there an API for closing such editors?

Popup menu

+5
4

QTableWidget 19 QWidget. - setDisabled(), .

:

table.setDisabled( true );
table.setDisabled( false );

, , : ( , ), EditTriggers. :

table.setEditTriggers( QAbstractItemView::NoEditTriggers );
+7

table.setCurrentItem(None) - , . ( , cellChanged/itemChanged.)

PyQt. ++ , None NULL.

+2

QTableWidget.closePersistentEditor(), . QAbstractItemView.closeEditor() , , , , API QModelIndex .

+1

. - .

, , , , .

, "" , !

Finally, I realized that my double click selects a cell, i.e. editing.

One click selects a cell, but does not open edit mode.

Side note: it could never make this subform act really modally, so I created a loop in a defiant form: while the subform was visible, with app.processEvents () being the only code

0
source

All Articles