mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the icon size in the Preferences dialog depend on the UI font size
This commit is contained in:
parent
69d311033e
commit
729cdb6306
@ -8,7 +8,7 @@ from urllib import unquote
|
|||||||
from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt
|
from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QFileInfo, QObject, QBuffer, Qt, QByteArray, QTranslator, QSocketNotifier,
|
QFileInfo, QObject, QBuffer, Qt, QByteArray, QTranslator, QSocketNotifier,
|
||||||
QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime,
|
QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime, QFontMetrics,
|
||||||
QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon,
|
QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon,
|
||||||
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo)
|
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo)
|
||||||
|
|
||||||
@ -895,6 +895,7 @@ class Application(QApplication):
|
|||||||
if s is not None:
|
if s is not None:
|
||||||
font.setStretch(s)
|
font.setStretch(s)
|
||||||
QApplication.setFont(font)
|
QApplication.setFont(font)
|
||||||
|
self.line_height = max(12, QFontMetrics(self.font()).lineSpacing())
|
||||||
|
|
||||||
dl = QLocale(get_lang())
|
dl = QLocale(get_lang())
|
||||||
if unicode(dl.bcp47Name()) != u'C':
|
if unicode(dl.bcp47Name()) != u'C':
|
||||||
|
@ -13,7 +13,7 @@ from PyQt5.Qt import (
|
|||||||
Qt, QIcon, QFont, QWidget, QScrollArea, QStackedWidget, QVBoxLayout,
|
Qt, QIcon, QFont, QWidget, QScrollArea, QStackedWidget, QVBoxLayout,
|
||||||
QLabel, QFrame, QToolBar, QSize, pyqtSignal, QPixmap, QDialogButtonBox,
|
QLabel, QFrame, QToolBar, QSize, pyqtSignal, QPixmap, QDialogButtonBox,
|
||||||
QHBoxLayout, QDialog, QSizePolicy, QPainter, QTextLayout, QPointF,
|
QHBoxLayout, QDialog, QSizePolicy, QPainter, QTextLayout, QPointF,
|
||||||
QStatusTipEvent)
|
QStatusTipEvent, QApplication)
|
||||||
|
|
||||||
from calibre.constants import __appname__, __version__, islinux
|
from calibre.constants import __appname__, __version__, islinux
|
||||||
from calibre.gui2 import (gprefs, min_available_height, available_width,
|
from calibre.gui2 import (gprefs, min_available_height, available_width,
|
||||||
@ -121,7 +121,8 @@ class Category(QWidget): # {{{
|
|||||||
self.bar = QToolBar(self)
|
self.bar = QToolBar(self)
|
||||||
self.bar.setStyleSheet(
|
self.bar.setStyleSheet(
|
||||||
'QToolBar { border: none; background: none }')
|
'QToolBar { border: none; background: none }')
|
||||||
self.bar.setIconSize(QSize(32, 32))
|
lh = QApplication.instance().line_height
|
||||||
|
self.bar.setIconSize(QSize(2*lh, 2*lh))
|
||||||
self.bar.setMovable(False)
|
self.bar.setMovable(False)
|
||||||
self.bar.setFloatable(False)
|
self.bar.setFloatable(False)
|
||||||
self.bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
|
self.bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user