mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-01 23:54:13 +02:00
Fix the terminal strip's move button saying the wrong thing (#409)
The button that moves free terminals into a strip is disabled when there is nothing it can do, but its tooltip always gave the same reason: apply or cancel the pending edits. With no row selected, which is what the screenshot on #409 shows, that sends the user looking for edits they never made. It also stayed enabled when the project had no terminal strip at all. The "move to" list is then empty and a click did nothing. The button is now disabled in all three cases and the tooltip names the one that applies, the most basic first: no strip yet (create one with the + button), edits pending, or nothing selected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -278,7 +278,19 @@ void FreeTerminalEditor::selectionChanged()
|
||||
{
|
||||
const bool has_selection = !ui->m_table_view->selectionModel()->selectedIndexes().isEmpty();
|
||||
const bool has_pending = !m_model->modifiedModelRealTerminalData().isEmpty();
|
||||
setDisabledMove(!has_selection || has_pending);
|
||||
const bool has_strip = ui->m_move_in_cb->count() > 0;
|
||||
setDisabledMove(!has_strip || !has_selection || has_pending);
|
||||
|
||||
//Say why the button is disabled, the most basic reason first
|
||||
if (!has_strip) {
|
||||
ui->m_move_pb->setToolTip(tr("Le projet n'a aucun bornier : créez-en un avec le bouton +"));
|
||||
} else if (has_pending) {
|
||||
ui->m_move_pb->setToolTip(tr("Appliquez ou annulez les modifications en cours avant de déplacer"));
|
||||
} else if (!has_selection) {
|
||||
ui->m_move_pb->setToolTip(tr("Sélectionnez dans le tableau les bornes à déplacer"));
|
||||
} else {
|
||||
ui->m_move_pb->setToolTip(tr("Déplacer les bornes sélectionnées vers le bornier choisi"));
|
||||
}
|
||||
}
|
||||
|
||||
void FreeTerminalEditor::setDisabledMove(bool b)
|
||||
@@ -286,7 +298,5 @@ void FreeTerminalEditor::setDisabledMove(bool b)
|
||||
ui->m_move_label->setDisabled(b);
|
||||
ui->m_move_in_cb->setDisabled(b);
|
||||
ui->m_move_pb->setDisabled(b);
|
||||
ui->m_move_pb->setToolTip(b ? tr("Appliquez ou annulez les modifications en cours avant de déplacer")
|
||||
: tr("Déplacer les bornes sélectionnées vers le bornier choisi"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user