Changeset f37cab0 in sasview for src/sas/qtgui/Perspectives/Fitting


Ignore:
Timestamp:
Sep 12, 2018 8:12:44 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
676a430
Parents:
33b3e4d
Message:

Remember custom column width. SASVIEW-1041

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r2d47985 rf37cab0  
    273273        self.theory_item = None 
    274274 
     275        # list column widths 
     276        self.lstParamHeaderSizes = {} 
     277 
    275278        # signal communicator 
    276279        self.communicate = self.parent.communicate 
     
    361364        self.lstParams.customContextMenuRequested.connect(self.showModelContextMenu) 
    362365        self.lstParams.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 
     366        # Column resize signals 
     367        self.lstParams.header().sectionResized.connect(self.onColumnWidthUpdate) 
     368 
    363369        # Poly model displayed in poly list 
    364370        self.lstPoly.setModel(self._poly_model) 
     
    11081114        self.SASModelToQModel(model, structure_factor) 
    11091115 
     1116        for column, width in self.lstParamHeaderSizes.items(): 
     1117            self.lstParams.setColumnWidth(column, width) 
     1118 
    11101119        # Update plot 
    11111120        self.updateData() 
     
    16691678        self._model_model.itemChanged.connect(self.onMainParamsChange) 
    16701679 
    1671         # Adjust the table cells width. 
    1672         # TODO: find a way to dynamically adjust column width while resized expanding 
    1673         self.lstParams.resizeColumnToContents(0) 
    1674         self.lstParams.resizeColumnToContents(4) 
    1675         self.lstParams.resizeColumnToContents(5) 
    1676         self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    1677  
    16781680    def iterateOverPolyModel(self, func): 
    16791681        """ 
     
    20142016            self.magnet_params = {} 
    20152017            self.setMagneticModel() 
    2016  
    2017         # Adjust the table cells width 
    2018         self.lstParams.resizeColumnToContents(0) 
    2019         self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    20202018 
    20212019        # Now we claim the model has been loaded 
     
    27282726        self._poly_model.setData(fname_index, fname) 
    27292727 
     2728    def onColumnWidthUpdate(self, index, old_size, new_size): 
     2729        """ 
     2730        Simple state update of the current column widths in the  param list 
     2731        """ 
     2732        self.lstParamHeaderSizes[index] = new_size 
     2733 
    27302734    def setMagneticModel(self): 
    27312735        """ 
Note: See TracChangeset for help on using the changeset viewer.