Make Variable Explorer column headers movable
See original GitHub issueThe variable explorer currently has the columns as Name -> Type -> Size -> Value, which is kind of annoying as the main thing I usually care about is Value which is way off at the end. There is no way to change this order but a simple one-liner in Qt could make the column headers draggable. In collectionseditor.py
, in class BaseTableView
’s def setup_table(self)
, simply add the one line
def setup_table(self):
"""Setup table"""
self.horizontalHeader().setStretchLastSection(True)
self.horizontalHeader().setSectionsMovable(True) # <--- NEW LINE HERE
self.adjust_columns()
# Sorting columns
self.setSortingEnabled(True)
self.sortByColumn(0, Qt.AscendingOrder)
and you’re done. Note this is for BaseTableView; you could also do this instead in RemoteCollectionsEditorTableView and CollectionsEditorTableView (not sure which subclass is the best to do this in, or what other things subclass BaseTableView).
FWIW, I’d much prefer it if the default were changed to Name -> Value -> Type -> Size, but that seems more involved and I’d be happy enough with this.
Versions
Spyder: 5.0.5 | Python 3.9.5 64-bit | Qt 5.9.7 | PyQt5 5.9.2 | Darwin 17.7.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (18 by maintainers)
Top GitHub Comments
Thank you all! I will submit when I get the chance.
OK, implemented in #17022.