mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Add a tweak that permits setting a style sheet for the selected cell.
This commit is contained in:
		
							parent
							
								
									3f98133107
								
							
						
					
					
						commit
						2f45ed19c3
					
				@ -544,3 +544,22 @@ highlight_virtual_library_book_count = True
 | 
			
		||||
# for a list of valid color names
 | 
			
		||||
column_header_highlight_color = 'lightgrey'
 | 
			
		||||
 | 
			
		||||
#: Control how the currently selected cell is marked.
 | 
			
		||||
# You can control how the currently selected cell is marked using something
 | 
			
		||||
# very similar to a CSS style sheet.
 | 
			
		||||
# This is a very experimental feature. There may be problems using this on some
 | 
			
		||||
# platforms or with some setting values. Some system defaults cannot be
 | 
			
		||||
# overridded. See
 | 
			
		||||
# http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-properties
 | 
			
		||||
# for a list of the CSS properties that are (in theory) supported.
 | 
			
		||||
# Example: on windows 7 the following style sheet results in a cell with the
 | 
			
		||||
# default background color, black text, and a black border around the cell.
 | 
			
		||||
# selected_cell_highlight_css = ('QTableView::item:focus { '
 | 
			
		||||
#                                    'background:transparent; '
 | 
			
		||||
#                                    'color:black;  '
 | 
			
		||||
#                                    'border: 1px; '
 | 
			
		||||
#                                    'border-style: solid; '
 | 
			
		||||
#                                    'border-color: black; '
 | 
			
		||||
#                                    '}')
 | 
			
		||||
# Default (no style): cell_highlight_css = ''
 | 
			
		||||
selected_cell_highlight_css = ''
 | 
			
		||||
 | 
			
		||||
@ -169,6 +169,9 @@ class BooksView(QTableView): # {{{
 | 
			
		||||
        self._model.sorting_done.connect(self.sorting_done,
 | 
			
		||||
                type=Qt.QueuedConnection)
 | 
			
		||||
 | 
			
		||||
        if tweaks['selected_cell_highlight_css']:
 | 
			
		||||
            self.setStyleSheet(tweaks['selected_cell_highlight_css'])
 | 
			
		||||
 | 
			
		||||
    def currentChanged(self, current, previous):
 | 
			
		||||
        self.model().set_current_cell(current)
 | 
			
		||||
        QTableView.currentChanged(self, current, previous)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user