mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Handle dark colorschemes when highlighting current cell
This commit is contained in:
parent
1e06698942
commit
b5ddd3a4e5
@ -139,7 +139,7 @@ class BooksView(QTableView): # {{{
|
|||||||
|
|
||||||
def __init__(self, parent, modelcls=BooksModel, use_edit_metadata_dialog=True):
|
def __init__(self, parent, modelcls=BooksModel, use_edit_metadata_dialog=True):
|
||||||
QTableView.__init__(self, parent)
|
QTableView.__init__(self, parent)
|
||||||
self.setProperty('highlight_current_item', 140)
|
self.setProperty('highlight_current_item', 150)
|
||||||
self.row_sizing_done = False
|
self.row_sizing_done = False
|
||||||
|
|
||||||
if not tweaks['horizontal_scrolling_per_column']:
|
if not tweaks['horizontal_scrolling_per_column']:
|
||||||
|
@ -5250,8 +5250,13 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
|||||||
QColor color(hasCustomBackground && hasSolidBackground
|
QColor color(hasCustomBackground && hasSolidBackground
|
||||||
? v4Opt->backgroundBrush.color()
|
? v4Opt->backgroundBrush.color()
|
||||||
: palette.color(cg, QPalette::Highlight));
|
: palette.color(cg, QPalette::Highlight));
|
||||||
if (state & State_HasFocus && widget && widget->property("highlight_current_item").toBool())
|
if (state & State_HasFocus && widget && widget->property("highlight_current_item").toBool()) {
|
||||||
color = color.darker(widget->property("highlight_current_item").toInt()); // Added by Kovid to highlight the current cell in the book list
|
// Added by Kovid to highlight the current cell in the book list
|
||||||
|
if (color.lightness() > 128)
|
||||||
|
color = color.darker(widget->property("highlight_current_item").toInt());
|
||||||
|
else
|
||||||
|
color = color.lighter();
|
||||||
|
}
|
||||||
|
|
||||||
bool square((opts.square&SQUARE_LISTVIEW_SELECTION) &&
|
bool square((opts.square&SQUARE_LISTVIEW_SELECTION) &&
|
||||||
(/*(!widget && r.height()<=40 && r.width()>=48) || */
|
(/*(!widget && r.height()<=40 && r.width()>=48) || */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user