mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
QFontDatabase is all static in Qt 6
This commit is contained in:
parent
13867e75fc
commit
e1f6f82d6e
@ -48,7 +48,7 @@ def add_fonts(parent):
|
|||||||
|
|
||||||
def writing_system_for_font(font):
|
def writing_system_for_font(font):
|
||||||
has_latin = True
|
has_latin = True
|
||||||
systems = QFontDatabase().writingSystems(font.family())
|
systems = QFontDatabase.writingSystems(font.family())
|
||||||
|
|
||||||
# this just confuses the algorithm below. Vietnamese is Latin with lots of
|
# this just confuses the algorithm below. Vietnamese is Latin with lots of
|
||||||
# special chars
|
# special chars
|
||||||
@ -140,7 +140,7 @@ class FontFamilyDelegate(QStyledItemDelegate):
|
|||||||
if (system != QFontDatabase.WritingSystem.Any):
|
if (system != QFontDatabase.WritingSystem.Any):
|
||||||
w = painter.fontMetrics().width(text + " ")
|
w = painter.fontMetrics().width(text + " ")
|
||||||
painter.setFont(font2)
|
painter.setFont(font2)
|
||||||
sample = QFontDatabase().writingSystemSample(system)
|
sample = QFontDatabase.writingSystemSample(system)
|
||||||
if (option.direction == Qt.LayoutDirection.RightToLeft):
|
if (option.direction == Qt.LayoutDirection.RightToLeft):
|
||||||
r.setRight(r.right() - w)
|
r.setRight(r.right() - w)
|
||||||
else:
|
else:
|
||||||
|
@ -66,7 +66,7 @@ _dff = None
|
|||||||
def default_font_family():
|
def default_font_family():
|
||||||
global _dff
|
global _dff
|
||||||
if _dff is None:
|
if _dff is None:
|
||||||
families = set(map(str, QFontDatabase().families()))
|
families = set(map(str, QFontDatabase.families()))
|
||||||
for x in ('Ubuntu Mono', 'Consolas', 'Liberation Mono'):
|
for x in ('Ubuntu Mono', 'Consolas', 'Liberation Mono'):
|
||||||
if x in families:
|
if x in families:
|
||||||
_dff = x
|
_dff = x
|
||||||
|
@ -616,7 +616,7 @@ class WebView(RestartingWebEngineView):
|
|||||||
if family in ('.AppleSystemUIFont', 'MS Shell Dlg 2'):
|
if family in ('.AppleSystemUIFont', 'MS Shell Dlg 2'):
|
||||||
family = 'system-ui'
|
family = 'system-ui'
|
||||||
ui_data = {
|
ui_data = {
|
||||||
'all_font_families': QFontDatabase().families(),
|
'all_font_families': QFontDatabase.families(),
|
||||||
'ui_font_family': family,
|
'ui_font_family': family,
|
||||||
'ui_font_sz': f'{fi.pixelSize()}px',
|
'ui_font_sz': f'{fi.pixelSize()}px',
|
||||||
'show_home_page_on_ready': self.show_home_page_on_ready,
|
'show_home_page_on_ready': self.show_home_page_on_ready,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user