mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the calibre item view focus settable from python
This commit is contained in:
parent
9bc391f9da
commit
0f20f1ce77
@ -873,6 +873,7 @@ class Application(QApplication):
|
|||||||
v = pcache[v]
|
v = pcache[v]
|
||||||
icon_map[type('')(getattr(style, 'SP_'+k))] = v
|
icon_map[type('')(getattr(style, 'SP_'+k))] = v
|
||||||
style.setProperty(u'calibre_icon_map', icon_map)
|
style.setProperty(u'calibre_icon_map', icon_map)
|
||||||
|
style.setProperty(u'calibre_item_view_focus', True)
|
||||||
self.__icon_map_memory_ = icon_map
|
self.__icon_map_memory_ = icon_map
|
||||||
|
|
||||||
def setup_styles(self, force_calibre_style):
|
def setup_styles(self, force_calibre_style):
|
||||||
|
@ -964,6 +964,7 @@ Style::Style()
|
|||||||
itsAnimateStep(0),
|
itsAnimateStep(0),
|
||||||
itsTitlebarHeight(0),
|
itsTitlebarHeight(0),
|
||||||
calibre_icon_map(QHash<int,QString>()),
|
calibre_icon_map(QHash<int,QString>()),
|
||||||
|
calibre_item_view_focus(0),
|
||||||
is_kde_session(0),
|
is_kde_session(0),
|
||||||
itsPos(-1, -1),
|
itsPos(-1, -1),
|
||||||
itsHoverWidget(0L),
|
itsHoverWidget(0L),
|
||||||
@ -3696,6 +3697,9 @@ bool Style::event(QEvent *event) {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (e->propertyName() == QString("calibre_item_view_focus")) {
|
||||||
|
calibre_item_view_focus = property("calibre_item_view_focus").toBool();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BASE_STYLE::event(event);
|
return BASE_STYLE::event(event);
|
||||||
@ -4784,7 +4788,7 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
|||||||
if(widget && ::qobject_cast<const QGroupBox *>(widget))
|
if(widget && ::qobject_cast<const QGroupBox *>(widget))
|
||||||
r2.adjust(0, 2, 0, 0);
|
r2.adjust(0, 2, 0, 0);
|
||||||
|
|
||||||
if(1 || FOCUS_STANDARD==opts.focus) // Changed by Kovid, as the underline focus does not work well in item views
|
if(calibre_item_view_focus || FOCUS_STANDARD==opts.focus) // Changed by Kovid, as the underline focus does not work well in item views
|
||||||
{
|
{
|
||||||
// Taken from QWindowsStyle...
|
// Taken from QWindowsStyle...
|
||||||
painter->save();
|
painter->save();
|
||||||
|
@ -355,6 +355,7 @@ class Style : public QCommonStyle
|
|||||||
mutable QList<int> itsMdiButtons[2]; // 0=left, 1=right
|
mutable QList<int> itsMdiButtons[2]; // 0=left, 1=right
|
||||||
mutable int itsTitlebarHeight;
|
mutable int itsTitlebarHeight;
|
||||||
QHash<int,QString> calibre_icon_map;
|
QHash<int,QString> calibre_icon_map;
|
||||||
|
bool calibre_item_view_focus;
|
||||||
bool is_kde_session;
|
bool is_kde_session;
|
||||||
|
|
||||||
// Required for Q3Header hover...
|
// Required for Q3Header hover...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user