mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: don't update notes field when executing command
User report: when switching focus between windows, the cursor position gets lost. This is due to a note-edit command being fired, which then overwrites the notes tab. To prevent this, don't update the notes field when placing a command. Moreover, generally don't update the dive selection when placing a command as that also rewrites all the values. Should this be extended to other fields? Fixes #3365 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1b8f3a06ec
commit
889827aadb
4 changed files with 6 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- desktop: Don't lose cursor position in notes when switching between windows [#3369]
|
||||||
- Uemis support: fix the ability disconnect/reconnect the Zurich when its filesystem is full
|
- Uemis support: fix the ability disconnect/reconnect the Zurich when its filesystem is full
|
||||||
- libdivecomputer: add support for latest BLE hardware in OSTC dive computers
|
- libdivecomputer: add support for latest BLE hardware in OSTC dive computers
|
||||||
|
|
||||||
|
|
|
@ -112,5 +112,3 @@ bool placingCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Command
|
} // namespace Command
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,8 @@ void EditBase<T>::undo()
|
||||||
// Send signals.
|
// Send signals.
|
||||||
DiveField id = fieldId();
|
DiveField id = fieldId();
|
||||||
emit diveListNotifier.divesChanged(stdToQt<dive *>(dives), id);
|
emit diveListNotifier.divesChanged(stdToQt<dive *>(dives), id);
|
||||||
setSelection(selectedDives, current);
|
if (!placingCommand())
|
||||||
|
setSelection(selectedDives, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to manually instantiate the constructors of the EditBase class,
|
// We have to manually instantiate the constructors of the EditBase class,
|
||||||
|
|
|
@ -248,7 +248,7 @@ void MainTab::divesChanged(const QVector<dive *> &dives, DiveField field)
|
||||||
ui.depth->setText(get_depth_string(current_dive->maxdepth, true));
|
ui.depth->setText(get_depth_string(current_dive->maxdepth, true));
|
||||||
if (field.rating)
|
if (field.rating)
|
||||||
ui.rating->setCurrentStars(current_dive->rating);
|
ui.rating->setCurrentStars(current_dive->rating);
|
||||||
if (field.notes)
|
if (field.notes && !Command::placingCommand())
|
||||||
updateNotes(current_dive);
|
updateNotes(current_dive);
|
||||||
if (field.datetime) {
|
if (field.datetime) {
|
||||||
updateDateTime(current_dive);
|
updateDateTime(current_dive);
|
||||||
|
@ -306,11 +306,10 @@ static bool isHtml(const QString &s)
|
||||||
void MainTab::updateNotes(const struct dive *d)
|
void MainTab::updateNotes(const struct dive *d)
|
||||||
{
|
{
|
||||||
QString tmp(d->notes);
|
QString tmp(d->notes);
|
||||||
if (isHtml(tmp)) {
|
if (isHtml(tmp))
|
||||||
ui.notes->setHtml(tmp);
|
ui.notes->setHtml(tmp);
|
||||||
} else {
|
else
|
||||||
ui.notes->setPlainText(tmp);
|
ui.notes->setPlainText(tmp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::updateDateTime(const struct dive *d)
|
void MainTab::updateDateTime(const struct dive *d)
|
||||||
|
|
Loading…
Add table
Reference in a new issue