I'm writing an interface with PyQt5 and there is a QLineEdit for the user to enter a license key. When I set .setInputMask("XXXX-XXXX-XXXX-XXXX"), it loaded very slowly and I didn't like the thick cursor. Therefore, I decided to create my own custom QLineEdit and validator. Just as I was about to start, I noticed that if you set the last character of the QLineEdit to a blank space, it loads very slowly. Using a non-breaking space instead of a space solves the issue, but it doesn't sit well with me. How can I solve this, or is there a way to make the cursor thin for this input mask, as far as I researched on the internet, it doesn't exist?
import sys
from PyQt5.QtWidgets import QApplication, QLineEdit, QWidget, QVBoxLayout
if __name__ == "__main__":
app = QApplication(sys.argv)
widget = QWidget()
layout = QVBoxLayout(widget)
lineedit = QLineEdit(" - - - \u00A0") # Fast but dosen't sit well with me
lineedit1 = QLineEdit()
lineedit1.setInputMask("XXXX-XXXX-XXXX-XXXX") # Thick cursor and slow load
lineedit2 = QLineEdit(" - - - ") # Slow load
layout.addWidget(lineedit)
layout.addWidget(lineedit1)
layout.addWidget(lineedit2)
widget.show()
sys.exit(app.exec_())
It seems that if there is only one element, it arrives late, so it's not that important after all. Is there a way to solve the thick cursor?"