mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-30 14:54:13 +02:00
dcb79b6553
Three bugs stacked to produce the symptom in issue #409 (move button does nothing): 1. selectionChanged() was declared in freeterminaleditor.h but had no body and was never connected to the selection model, so the move button had no awareness of whether a terminal was selected. The button could appear enabled with nothing selected, then silently return early in on_m_move_pb_clicked() at the real_t_vector.isEmpty() guard. 2. The dataChanged→setDisabledMove(true) connection was a one-way trap: any cell edit (including accidentally opening and closing a type/function combo, or toggling LED back to its current value) permanently disabled the move button until reload() was called. There was no tooltip explaining why the button was greyed out, so the user had no way to recover. 3. FreeTerminalModel::setData() for LED_CELL had no change guard, unlike LABEL_CELL which checks label != value. Clicking the LED combo while it was already at the same value still emitted dataChanged and triggered the disable. Fix: - Implement selectionChanged() to enable the move controls only when at least one row is selected AND there are no pending (yellow) edits. - Connect it to both selectionModel::selectionChanged and model::dataChanged so the button state is always consistent with actual UI state. - Route reload()'s re-enable through selectionChanged() instead of calling setDisabledMove(false) directly, so the selection state is respected immediately after a move. - Add a tooltip to m_move_pb explaining the disabled state. - Add the missing change guard to LED_CELL in setData(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>