![]() ![]() Width (int): The width of the input caret in pixels. This allows us to set the width of the default widget input caret. from PySide2.QtCore import Qt, QRectįrom PySide2.QtGui import QPainter, QColor, QFont, QFontMetricsFįrom PySide2.QtWidgets import QWidget, QLineEdit, QCommonStyle, QStyle, QStyleOption If you change the font, you may need to re-evaluate some of the math to get the caret step feeling good. ![]() Maybe there is a less convoluted way to go about this, but this works for me. In this widget, I am using the Hasklig Nerd Font. My solution makes an assumption that you're assigning a font to the field. I have thought about this for about 2 years and, after stumbling on this thread, decided to try to find a solution. It uses the paintEvent to generate a custom caret. Here's a solution I came up with using QLineEdit. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |