Search code examples
qtqlineedit

QLineEdit. Hide the beginning of long line


I have long string into QLineEdit. The beginning of line is hide.

enter image description here

Line:"151051.50000000"

I want hide the end and show the beginning of line.

How can I do this?


Solution

    1. lineEdit->setCursorPosition(0);

    2. You can also use QDoubleSpinBox without up and down buttons for that purpose.

    3. You can also use QString::number() with limited precision:

    lineEdit->setText(QString::number(your_value, 'f', 3)); // 3 decimal places