Important: Please read the Qt Code of Conduct -

what's difference between real keyboard and Qevent::Keypress in QDdoublepinBox

  • Question about Qt 4.8 example project "input panel"

    I replaced first lineEdit Object in UI with QDoubleSpinBox.
    When I enter digital number from real keyboard, it shows what I entered, for example, when I enter "9", the "9" is shown in QDoubleSpinBox, after I entered second "9", it shows "99", if I enter third "9" , it shows "999"
    that's correct.

    but when I enter "9" from soft keyboard, things changed. Software keyboard generates QKeyEvent to simulate a key is pressed. when I clicked first "9", it shows "9", but after I clicked second "9", it shows "99.000". if I enter third '9", it shows "999.000". this make it difficult for me to enter "999.99", I have to select those three "000" after "." and enter "9", it will show "999.900", then I have to select last "00" and replace it with 9, This make it difficult to enter a number easily.

    Anyone knows how to prevent SpinBox appending those "0" after decimal dot? thanks for help

  • Lifetime Qt Champion


    You should add which OS/Platform you are running on

  • @SGaist Thanks, I just tried this on Windows 7 today and it works great. While under Ubuntu, it works like what I said before. I tried to disable QAbstractSpinBox.keyboardTracing property, it does not help. Anyone knows what causes the differece between windows & linux? thanks lot

  • Lifetime Qt Champion

    Which exact version of Qt 4 are you using ? And is it self-built ? From your Linux distribution ?

  • @SGaist It is Qt4.8.1 from linux distribution.

  • Lifetime Qt Champion

    Can you try with a more recent version ? Either 4.8.6 or the latest git version

  • @SGaist I tried with Qt 4.8.6, same problem. :(

Log in to reply