Skip to content

[Qt] Make colorimeter correction web-check dialog columns sortable - #959

Merged
eoyilmaz merged 1 commit into
developfrom
958-qt-colorimeter-correction-dialog-columns-not-sortable
Jul 28, 2026
Merged

[Qt] Make colorimeter correction web-check dialog columns sortable#959
eoyilmaz merged 1 commit into
developfrom
958-qt-colorimeter-correction-dialog-columns-not-sortable

Conversation

@eoyilmaz

Copy link
Copy Markdown
Owner

Summary

  • Closes [Qt] Colorimeter correction web-check dialog columns aren't sortable #958. _WebCheckChooserDialog's QTableWidget now has setSortingEnabled(True), so clicking a column header sorts ascending/descending as usual.
  • The ΔE*00 avg/max columns sort numerically instead of lexicographically, via a _NumericTableWidgetItem subclass overriding __lt__() to compare as float (falling back to text comparison for non-numeric placeholders like "Not applicable").
  • Fixed a latent bug that sorting would have exposed: accept() picked the selected row's data by indexing the original rows list with the table's visual row number, which is wrong once sorting reorders rows. Each row's source dict is now stashed on its first-column item via Qt.UserRole and read back from the table, independent of sort order.
  • Fixed a RecursionError found while testing: the numeric item's non-numeric fallback originally called super().__lt__(other), but PySide's vtable slot for that virtual still resolves back to the Python override regardless of super(), so it recursed infinitely on any pairing involving a non-numeric ΔE*00 value (e.g. CCSS entries showing "Not applicable"). Replaced with a direct text comparison.
  • Confirmed against the wx equivalent (colorimeter_correction_web_check_choose in display_cal.py), which uses a plain, unsorted wx.ListCtrl, so this is a net-new Qt enhancement rather than a parity fix.

Test plan

  • pytest tests/test_ui_colorimeter_correction_io.py — 19/20 pass (one pre-existing, unrelated ImportController failure present on develop too)
  • New tests: sorting is enabled, ΔE*00 columns sort numerically not lexicographically, row selection resolves correctly after sorting, and a regression test for the mixed numeric/non-numeric recursion bug (verified it actually catches the bug by temporarily reintroducing super().__lt__())
  • ruff check DisplayCAL/ui/colorimeter_correction_io.py clean

_WebCheckChooserDialog now enables QTableWidget sorting, and sorts the
ΔE*00 avg/max columns numerically instead of lexicographically via a
custom QTableWidgetItem.__lt__(). The row-lookup in accept() previously
indexed the original rows list by visual row position, which would have
returned the wrong row once sorting reorders the table, so it now reads
the row dict back from the item itself.
@eoyilmaz eoyilmaz linked an issue Jul 28, 2026 that may be closed by this pull request
@eoyilmaz
eoyilmaz merged commit c16f11c into develop Jul 28, 2026
14 of 15 checks passed
@eoyilmaz
eoyilmaz deleted the 958-qt-colorimeter-correction-dialog-columns-not-sortable branch July 28, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Qt] Colorimeter correction web-check dialog columns aren't sortable

1 participant