handle text flags like axisitem
This commit is contained in:
parent
d70a009c29
commit
e02fc10a40
@ -418,18 +418,6 @@ if QT_LIB == PYQT6:
|
|||||||
for e in QtCore.Qt.Key:
|
for e in QtCore.Qt.Key:
|
||||||
setattr(QtCore.Qt, e.name, e.value)
|
setattr(QtCore.Qt, e.name, e.value)
|
||||||
|
|
||||||
# TextFlags are not accepted as appropriate types
|
|
||||||
# Example:
|
|
||||||
# TypeError: QFontMetric.size(
|
|
||||||
# self,
|
|
||||||
# int,
|
|
||||||
# str,
|
|
||||||
# tabStops: int = 0,
|
|
||||||
# tabArray: Optional[List[int]] = 0
|
|
||||||
# ): argument 1 has unexpected type 'TextFlag'
|
|
||||||
for e in QtCore.Qt.TextFlag:
|
|
||||||
setattr(QtCore.Qt, e.name, e.value)
|
|
||||||
|
|
||||||
# shim the old names for QPointF mouse coords
|
# shim the old names for QPointF mouse coords
|
||||||
QtGui.QSinglePointEvent.localPos = lambda o : o.position()
|
QtGui.QSinglePointEvent.localPos = lambda o : o.position()
|
||||||
QtGui.QSinglePointEvent.windowPos = lambda o : o.scenePosition()
|
QtGui.QSinglePointEvent.windowPos = lambda o : o.scenePosition()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtGui, QtCore
|
from ..Qt import QtGui, QtCore, QT_LIB
|
||||||
from ..python2_3 import asUnicode
|
from ..python2_3 import asUnicode
|
||||||
import os, weakref, re
|
import os, weakref, re
|
||||||
|
|
||||||
@ -162,7 +162,14 @@ class ParameterItem(QtGui.QTreeWidgetItem):
|
|||||||
# called when the user-visble title has changed (either opts['title'], or name if title is None)
|
# called when the user-visble title has changed (either opts['title'], or name if title is None)
|
||||||
self.setText(0, self.param.title())
|
self.setText(0, self.param.title())
|
||||||
fm = QtGui.QFontMetrics(self.font(0))
|
fm = QtGui.QFontMetrics(self.font(0))
|
||||||
size = fm.size(QtCore.Qt.TextSingleLine, self.text(0))
|
|
||||||
|
if QT_LIB == 'PyQt6':
|
||||||
|
# PyQt6 doesn't allow or-ing of different enum types
|
||||||
|
# so we need to take its value property
|
||||||
|
textFlags = QtCore.Qt.TextSingleLine.value
|
||||||
|
else:
|
||||||
|
textFlags = QtCore.Qt.TextSingleLine
|
||||||
|
size = fm.size(textFlags, self.text(0))
|
||||||
size.setHeight(int(size.height() * 1.35))
|
size.setHeight(int(size.height() * 1.35))
|
||||||
size.setWidth(int(size.width() * 1.15))
|
size.setWidth(int(size.width() * 1.15))
|
||||||
self.setSizeHint(0, size)
|
self.setSizeHint(0, size)
|
||||||
|
Loading…
Reference in New Issue
Block a user