OSX: Fix font size in completion popups too small on Mavericks (I hope)

Fixes #1243761 [In OS 10.9 pull-down menus are to small](https://bugs.launchpad.net/calibre/+bug/1243761)
This commit is contained in:
Kovid Goyal 2013-10-24 09:52:26 +05:30
parent 849fd5dbeb
commit 9211f72cd3

View File

@ -11,8 +11,9 @@ import weakref
import sip import sip
from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject,
QApplication, QListView, QPoint, QModelIndex) QApplication, QListView, QPoint, QModelIndex, QFont, QFontInfo)
from calibre.constants import isosx, get_osx_version
from calibre.utils.icu import sort_key, primary_startswith from calibre.utils.icu import sort_key, primary_startswith
from calibre.gui2 import NONE from calibre.gui2 import NONE
from calibre.gui2.widgets import EnComboBox, LineEditECM from calibre.gui2.widgets import EnComboBox, LineEditECM
@ -165,6 +166,14 @@ class Completer(QListView): # {{{
self.setCurrentIndex(self.model().index(0)) self.setCurrentIndex(self.model().index(0))
if not p.isVisible(): if not p.isVisible():
if isosx and get_osx_version() >= (10, 9, 0):
# On mavericks the popup menu seems to use a font smaller than
# the widgets font, see for example:
# https://bugs.launchpad.net/bugs/1243761
fp = QFontInfo(widget.font())
f = QFont()
f.setPixelSize(fp.pixelSize())
self.setFont(f)
p.show() p.show()
def eventFilter(self, obj, e): def eventFilter(self, obj, e):