On Thursday, October 31, 2024 at 7:45:05 AM UTC-4 Thomas Passin wrote:

Either of these work in the sense of executing without producing an error.  
I haven't tried applying the font to see the results:

from leo.core.leoQt import QtGui, QtWidgets
QFont = QtGui.QFont

newfont = QFont('Georgia')
newfont.setWeight(QFont.Weight.Bold)
# or
newfont.setWeight(700)


Now I've tried it and yes, I do get bold text.  That detour with arg = 
getAttr() isn't needed.
 


On Wednesday, October 30, 2024 at 2:58:37 PM UTC-4 jkn wrote:

... I see that the values for the Weight enum for QFont.setWeight() seem to 
have changed for PyQt6. It is now a scale of 1 to 1000, instead of 1 to 99 
as previously.

https://doc.qt.io/qt-6/qfont.html#Weight-enum

Changing this in qt_tree helps:

--- a/leo/plugins/qt_tree.py 
+++ b/leo/plugins/qt_tree.py 
@@ -307,7 +307,7 @@ class LeoQtTree(leoFrame.LeoTree): 
            elif cmd == 'WEIGHT': 
 
                def weight_modifier(item: Item, param: str) -> None: 
-                    arg = getattr(QtGui.QFont, param, 75) 
+                    arg = getattr(QtGui.QFont, param, 700) # WAS 75 
                    font = item.font(0) 
                    font.setWeight(arg) 
                    item.setFont(0, font)

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/8ce53fe4-982f-4eed-b840-e81fc2fcd51an%40googlegroups.com.

Reply via email to