Qt 6.11 is out! See what's new in the release
blog
Changing cursor type when focus shifts from QTableView cell
-
Hi,
In my delegate's setModelData I would like to change the cursor to hourglass and at the end of setModelData back to arrow.
This is what I have now:void WhatFixViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* fixModel, const QModelIndex& index) const { QCursor* hold = new QCursor(); hold->setShape (Qt::WaitCursor); QComboBox* whatComboEditor = editor->findChild<QComboBox*>(); Q_ASSERT(whatComboEditor); if (whatComboEditor) { QString newWhatText; newWhatText = whatComboEditor->currentText (); fixModel->setData (index, newWhatText, Qt::EditRole); fixModel->submit (); FixDb* mFixDb = new FixDb; mFixDb->exec (); } }How can I set the cursor in this case, when the user clicks outside the box?
Thank you. -
Hi,
From your description you should rather emit signals at the start and end of your setModelData call and in the slot you connect to it use setCursor.
Note that currently it looks like you have two memory leaks.
-
You never delete
holdnormFixDb. -
Do you mean replace the cursor with a BusyIndicator or just show a widget with that indicator ?
-
Do you mean replace the cursor with a BusyIndicator or just show a widget with that indicator ?
-
Then yes.
-
The Qt documentation.