Repository navigation
[FIX] Select Rows: Keep condition rows in sync after removing one - #7335
raashish1601 wants to merge 3 commits into
Conversation
|
It seems to be "hacky" solution. This function is invoked as single responsibility to delete row - encapsulating for There is |
|
That was merely "seems" :) — this was my first look. btw: Changing |
|
Thanks for looking deeper. The crash before the patch matches what I see: on the unpatched widget the test process dies too. Only updating column 0 isn't enough, though: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7335 +/- ##
=======================================
Coverage 88.98% 88.98%
=======================================
Files 337 337
Lines 74598 74604 +6
=======================================
+ Hits 66378 66390 +12
+ Misses 8220 8214 -6 🚀 New features to boost your workflow:
|
|
The "Scientific Python nightly wheels" failure is unrelated to this change: the nightly pyqtgraph turned |
|
I agree with @krystofair that this is a hacky solution, but the problem is that underlying code was already hacky. I added another commit that uses persistent model indices instead of rows; this eliminates the need to update because Qt does it for us. Furthermore, this allows putting them into callback function's closure instead of having to store them as attributes. @raashish1601, thanks for tests (and, of course, for reporting the problem and a fix that helped toward a more persistent fix.) @VesnaT, could you please review this some time next week? |
Issue
Fixes #7333
Description of changes
Each condition's variable and operator combos remember their table row in a
rowattribute, set once inadd_row.set_new_operatorsandset_new_valuesuse it to find the cells to replace. When a condition is removed, the rows below move up but their combos keep the old number, so changing one of them rebuilds the widgets of the next line (or a line that no longer exists).remove_one_rownow updatesrowon the variable and operator combos of the rows that moved up. The remove button already used aQPersistentModelIndex, so it was not affected.Tests:
test_remove_condition_keeps_rowsadds three conditions, removes the first, and then changes the variable of the new first row and the operator of the second row, checking that each change stays on its own line. It fails without the fix (on my machine the unpatched widget even crashes the test process) and passes with it. The wholetest_owselectrows.pypasses locally (run on Windows against the Orange 3.40 wheel with this patch applied toowselectrows.py).Includes