mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Draw a simple rounded rectangle to indicate keyboard focus in the tag browser
This commit is contained in:
parent
9ac1509053
commit
a575a05530
@ -352,7 +352,22 @@ class CalibreStyle: public QProxyStyle {
|
||||
}
|
||||
}
|
||||
return; // }}}
|
||||
|
||||
case PE_FrameFocusRect: // }}}
|
||||
if (!widget || !widget->property("frame_for_focus").toBool())
|
||||
break;
|
||||
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
|
||||
if (!(fropt->state & State_KeyboardFocusChange))
|
||||
break;
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->translate(0.5, 0.5);
|
||||
painter->setPen(option->palette.color(QPalette::Text));
|
||||
painter->setBrush(Qt::transparent);
|
||||
painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 4, 4);
|
||||
painter->restore();
|
||||
return;
|
||||
}
|
||||
break; // }}}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ class TagsView(QTreeView): # {{{
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTreeView.__init__(self, parent=None)
|
||||
self.setProperty('frame_for_focus', True)
|
||||
self.setMouseTracking(True)
|
||||
self.alter_tb = None
|
||||
self.disable_recounting = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user