mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix focus highlighting obsucring text in listviews
This commit is contained in:
parent
28d6e85913
commit
45d35b283e
@ -2,7 +2,13 @@
|
|||||||
let $PYFLAKES_BUILTINS = "_,dynamic_property,__,P,I,lopen,icu_lower,icu_upper,icu_title,ngettext"
|
let $PYFLAKES_BUILTINS = "_,dynamic_property,__,P,I,lopen,icu_lower,icu_upper,icu_title,ngettext"
|
||||||
|
|
||||||
" Include directories for C++ modules
|
" Include directories for C++ modules
|
||||||
let g:syntastic_cpp_include_dirs = [ '/usr/include/podofo', '/usr/include/qt4/QtCore', '/usr/include/qt4/QtGui', '/usr/include/qt4']
|
let g:syntastic_cpp_include_dirs = [
|
||||||
|
\'/usr/include/podofo',
|
||||||
|
\'/usr/include/qt4/QtCore',
|
||||||
|
\'/usr/include/qt4/QtGui',
|
||||||
|
\'/usr/include/qt4',
|
||||||
|
\'src/qtcurve/common', 'src/qtcurve',
|
||||||
|
\]
|
||||||
|
|
||||||
fun! CalibreLog()
|
fun! CalibreLog()
|
||||||
" Setup buffers to edit the calibre changelog and version info prior to
|
" Setup buffers to edit the calibre changelog and version info prior to
|
||||||
|
@ -368,7 +368,8 @@ class Build(Command):
|
|||||||
self.info('\n####### Building calibre style', '#'*7)
|
self.info('\n####### Building calibre style', '#'*7)
|
||||||
sdir = self.j(self.SRC, 'qtcurve')
|
sdir = self.j(self.SRC, 'qtcurve')
|
||||||
def path(x):
|
def path(x):
|
||||||
return '"%s"'%self.j(sdir, x).replace(os.sep, '/')
|
if x: x=self.j(sdir, x)
|
||||||
|
return ('"%s"'%x).replace(os.sep, '/')
|
||||||
headers = [
|
headers = [
|
||||||
"common/colorutils.h",
|
"common/colorutils.h",
|
||||||
"common/common.h",
|
"common/common.h",
|
||||||
@ -404,7 +405,7 @@ class Build(Command):
|
|||||||
DESTDIR = .
|
DESTDIR = .
|
||||||
TARGET = calibre
|
TARGET = calibre
|
||||||
QT *= svg
|
QT *= svg
|
||||||
INCLUDEPATH *= . {inc}
|
INCLUDEPATH *= {conf} {inc}
|
||||||
win32-msvc*:DEFINES *= _CRT_SECURE_NO_WARNINGS
|
win32-msvc*:DEFINES *= _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
# Force C++ language
|
# Force C++ language
|
||||||
@ -412,7 +413,7 @@ class Build(Command):
|
|||||||
*msvc*:QMAKE_CFLAGS *= -TP
|
*msvc*:QMAKE_CFLAGS *= -TP
|
||||||
*msvc*:QMAKE_CXXFLAGS += /MP
|
*msvc*:QMAKE_CXXFLAGS += /MP
|
||||||
|
|
||||||
''').format(inc=path('common'))
|
''').format(conf=path(''), inc=path('common'))
|
||||||
if isosx:
|
if isosx:
|
||||||
pro += '\nCONFIG += x86 x86_64\n'
|
pro += '\nCONFIG += x86 x86_64\n'
|
||||||
else:
|
else:
|
||||||
@ -422,18 +423,6 @@ class Build(Command):
|
|||||||
pro += 'HEADERS += %s\n'%path(x)
|
pro += 'HEADERS += %s\n'%path(x)
|
||||||
for x in sources:
|
for x in sources:
|
||||||
pro += 'SOURCES += %s\n'%path(x)
|
pro += 'SOURCES += %s\n'%path(x)
|
||||||
config = textwrap.dedent('''
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/* #define VERSION "1.5.3" */
|
|
||||||
#define KDE3PREFIX "/usr"
|
|
||||||
#define KDE4PREFIX "/usr"
|
|
||||||
|
|
||||||
#define QTC_QT_ONLY
|
|
||||||
/* #undef QTC_OLD_NVIDIA_ARROW_FIX */
|
|
||||||
#undef QTC_STYLE_SUPPORT
|
|
||||||
/* #undef QTC_KWIN_MAX_BUTTON_HACK */
|
|
||||||
''')
|
|
||||||
odir = self.j(self.d(self.SRC), 'build', 'qtcurve')
|
odir = self.j(self.d(self.SRC), 'build', 'qtcurve')
|
||||||
if not os.path.exists(odir):
|
if not os.path.exists(odir):
|
||||||
os.makedirs(odir)
|
os.makedirs(odir)
|
||||||
@ -444,10 +433,6 @@ class Build(Command):
|
|||||||
'rb').read() != pro):
|
'rb').read() != pro):
|
||||||
with open('qtcurve.pro', 'wb') as f:
|
with open('qtcurve.pro', 'wb') as f:
|
||||||
f.write(pro)
|
f.write(pro)
|
||||||
if not os.path.exists('config.h') or (open('config.h',
|
|
||||||
'rb').read() != config):
|
|
||||||
with open('config.h', 'wb') as f:
|
|
||||||
f.write(config)
|
|
||||||
qmc = [QMAKE, '-o', 'Makefile']
|
qmc = [QMAKE, '-o', 'Makefile']
|
||||||
if iswindows:
|
if iswindows:
|
||||||
qmc += ['-spec', 'win32-msvc2008']
|
qmc += ['-spec', 'win32-msvc2008']
|
||||||
|
@ -720,7 +720,7 @@ gui_thread = None
|
|||||||
qt_app = None
|
qt_app = None
|
||||||
class Application(QApplication):
|
class Application(QApplication):
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args, force_calibre_style=False):
|
||||||
self.file_event_hook = None
|
self.file_event_hook = None
|
||||||
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
||||||
QApplication.__init__(self, qargs)
|
QApplication.__init__(self, qargs)
|
||||||
@ -731,7 +731,7 @@ class Application(QApplication):
|
|||||||
qt_app = self
|
qt_app = self
|
||||||
self._file_open_paths = []
|
self._file_open_paths = []
|
||||||
self._file_open_lock = RLock()
|
self._file_open_lock = RLock()
|
||||||
self.setup_styles()
|
self.setup_styles(force_calibre_style)
|
||||||
|
|
||||||
def load_calibre_style(self):
|
def load_calibre_style(self):
|
||||||
# On OS X QtCurve resets the palette, so we preserve it explicitly
|
# On OS X QtCurve resets the palette, so we preserve it explicitly
|
||||||
@ -743,7 +743,7 @@ class Application(QApplication):
|
|||||||
pi.load_style(path, 'Calibre')
|
pi.load_style(path, 'Calibre')
|
||||||
self.setPalette(orig_pal)
|
self.setPalette(orig_pal)
|
||||||
|
|
||||||
def setup_styles(self):
|
def setup_styles(self, force_calibre_style):
|
||||||
self.original_font = QFont(QApplication.font())
|
self.original_font = QFont(QApplication.font())
|
||||||
fi = gprefs['font']
|
fi = gprefs['font']
|
||||||
if fi is not None:
|
if fi is not None:
|
||||||
@ -753,7 +753,7 @@ class Application(QApplication):
|
|||||||
font.setStretch(s)
|
font.setStretch(s)
|
||||||
QApplication.setFont(font)
|
QApplication.setFont(font)
|
||||||
|
|
||||||
if gprefs['widget_style'] != 'system':
|
if force_calibre_style or gprefs['widget_style'] != 'system':
|
||||||
self.load_calibre_style()
|
self.load_calibre_style()
|
||||||
else:
|
else:
|
||||||
st = self.style()
|
st = self.style()
|
||||||
|
12
src/qtcurve/config.h
Normal file
12
src/qtcurve/config.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* #define VERSION "1.5.3" */
|
||||||
|
#define KDE3PREFIX "/usr"
|
||||||
|
#define KDE4PREFIX "/usr"
|
||||||
|
|
||||||
|
#define QTC_QT_ONLY
|
||||||
|
/* #undef QTC_OLD_NVIDIA_ARROW_FIX */
|
||||||
|
#undef QTC_STYLE_SUPPORT
|
||||||
|
/* #undef QTC_KWIN_MAX_BUTTON_HACK */
|
||||||
|
|
||||||
|
|
@ -4986,6 +4986,10 @@ 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);
|
||||||
|
|
||||||
|
// Added by Kovid so that the highlight does not cover the text
|
||||||
|
if(widget && ::qobject_cast<const QListView *>(widget))
|
||||||
|
r2.adjust(0, 0, 0, 2);
|
||||||
|
|
||||||
if(FOCUS_STANDARD==opts.focus)
|
if(FOCUS_STANDARD==opts.focus)
|
||||||
{
|
{
|
||||||
// Taken from QWindowsStyle...
|
// Taken from QWindowsStyle...
|
||||||
|
28
src/qtcurve/test_rendering.py
Normal file
28
src/qtcurve/test_rendering.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import,
|
||||||
|
print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.gui2 import Application
|
||||||
|
from PyQt4.Qt import (QDialog, QGridLayout, QListWidget, QDialogButtonBox)
|
||||||
|
|
||||||
|
app = Application([], force_calibre_style=True)
|
||||||
|
|
||||||
|
d = QDialog()
|
||||||
|
d.l = l = QGridLayout()
|
||||||
|
d.setLayout(l)
|
||||||
|
lw = QListWidget()
|
||||||
|
lw.addItem('Some text guy')
|
||||||
|
l.addWidget(lw, 0, 0, 2, 1)
|
||||||
|
bb = QDialogButtonBox()
|
||||||
|
bb.setStandardButtons(bb.Close)
|
||||||
|
bb.accepted.connect(d.accept)
|
||||||
|
bb.rejected.connect(d.reject)
|
||||||
|
l.addWidget(bb, 2, 0, 1, 2)
|
||||||
|
|
||||||
|
d.exec_()
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user