Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to enter a data in a Qline edit which has mask



  • I have a qline edit and i have set a mask like qlineedit->setInputMask("0000.000");

    now i have a button when it is pressed i will enter a number in the qlineedit. for example consider a calculator in which we press a number it will be displayed in qlineedit.

    similarly when i press the button it is being displayed inQlineedit as " .4 "
    when ever i press the value is being entered after the dot(.) . how to make it enter from the beginning?


  • Lifetime Qt Champion

    Hi
    Could show how you " enter a number in the qlineedit. " ? ( with the button)



  • @mrjj i changed it and it is working

    int iLen = strInput.length();
    if(iLen <= 5)
    {
    strInput.insert(iLen-1,"5");
    ui->le_FreqTxtInput->setText(strInput);
    }
    else
    {
    ui->le_FreqTxtInput->setText(strInput+"5");
    }


Log in to reply