Skip to content

Commit

Permalink
Merge pull request #20 from djdt/text_width
Browse files Browse the repository at this point in the history
fix spacing of error in Qt6
  • Loading branch information
djdt authored Jun 19, 2024
2 parents 7d52a4e + 26908cd commit 083c30a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spcal/gui/widgets/values.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Widget that displays a value with formatting."""

from PySide6 import QtCore, QtGui, QtWidgets

from spcal.gui.widgets.validcolorle import ValidColorLineEdit
Expand Down Expand Up @@ -107,12 +108,12 @@ def paintEvent(self, event: QtGui.QPaintEvent) -> None:

self.ensurePolished()

fm = self.fontMetrics()

panel = QtWidgets.QStyleOptionFrame()
self.initStyleOption(panel)
fm = panel.fontMetrics

rect = self.style().subElementRect(
QtWidgets.QStyle.SubElement.SE_LineEditContents, panel
QtWidgets.QStyle.SubElement.SE_LineEditContents, panel, self
)
rect = rect.marginsRemoved(self.textMargins())
rect.setX(rect.x() + fm.horizontalAdvance(self.text()))
Expand Down

0 comments on commit 083c30a

Please sign in to comment.