Skip to content

Commit 049ca66

Browse files
committed
fix: PySide6 errors when using slicer.
* Using class enums cannot be done from an instance. * QFontMetrics.width has been deprecated since PySide2 5.* and removed in PySide6.
1 parent 1552fc2 commit 049ca66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

NodeGraphQt/qgraphics/slicer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ def paint(self, painter, option, widget):
3333
arrow_size = 4.0
3434

3535
painter.save()
36-
painter.setRenderHint(painter.Antialiasing, True)
36+
painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
3737

3838
font = painter.font()
3939
font.setPointSize(12)
4040
painter.setFont(font)
4141
text = 'slice'
42-
text_x = painter.fontMetrics().width(text) / 2
42+
text_x = painter.fontMetrics().horizontalAdvance(text) / 2
4343
text_y = painter.fontMetrics().height() / 1.5
4444
text_pos = QtCore.QPointF(p1.x() - text_x, p1.y() - text_y)
4545
text_color = QtGui.QColor(*PipeSlicerEnum.COLOR.value)

0 commit comments

Comments
 (0)