Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with selection highlight in master-details tableViews



  • Hello all,

    I'm new to QT5 on Python.

    Please have a look to following picture.

    I have two tableViews as master (left)-details (right)

    I manage the details refresh in the selectionModel().selectionChanged signal of the master

    The master and detail TV selection mode is "SingleSelection" and both selectionBahaviors are "SelectRows"

    But when I click on a cell in the master or the detail, the behavior on page is strange. Only the selected cell on the newly selected row becomes blue. The previously selected cells remain blue. I have tto click outside of the TableView and come back to it to have the whole newly selected row blue and the previously selected row unselected.

    You can also see some of the column titles turning bold.

    Any idea of what is happening ?

    Not: the TableView was correctly refreshed after the printScreen. Again, when coming back to the page after the focus was lost.

    Here is the signal connect

    self.managedFeaturesTableview.selectionModel().selectionChanged.connect(self.selectedFeatureChanged)
    

    And here is the signal management code for master TableView

        def selectedFeatureChanged(self, aoSelectedRow, aoDeselectedRow):
    
            if aoSelectedRow.indexes() is None:
                return False
    
            lnSelectedRowIndex  = aoSelectedRow.indexes()[0].row()
            loRowData           = self.managedFeaturesTableview.model().getRowData(lnSelectedRowIndex)
    
            self.updateDetails(loRowData)
    
            self.managedFeaturesTableview.repaint()
            self.managedFeaturesTableview.resizeRowsToContents()
    

    qt5MasterDetailTVrefresh.png



  • @faldo1 please provide a minimal and reproducible example.


Log in to reply