Using a Mask in QLineEdit Changes Cursor Thickness and Position
I have a line edit that I specified with right alignment. When I do not have a mask set the cursor starts on the right side of the edit box and is normal. When I set a Mask, the cursor now starts in the middle of the box and is thicker than normal. I don't know why this is happening. I will admit I am just learning Qt but reading through the QLineEdit description I see nothing that indicates this change will happen. How do I get this to act the same way with a Mask as it does without a Mask.
lineEditUnitProdCode = new QLineEdit;
[edit: added missing coding tags @ SGaist]
Hi and welcome to devnet,
AFAIK, the thicker cursor is a visual cue that allows the user to know that it's not a generic line edit and not get angry because he can't see everything he's typing in.
The wrong cursor position comes from the fact that it's on the last masked position but since there are no char it looks like it's in the middle of the placeholder text. However that could be a bug. You should have a look at the "bug report system":http://bugreports.qt-project.org to see if it's something known. If not please consider opening a new report providing a minimal compilable example that allows to reproduce the problem.
Hi, thank you. Learn something new every day. I will check the bug report system about the cursor position. It seems easy to reproduce. After all this I found out about spin boxes and they will work better in this situation. Years of embedded programming in C but all new to C++, Qt and GUIs in general. Thanks again.
Indeed, if you only need numerical values a QSpinBox is much better, you can even hide the buttons if needed