Allow entry in QLineEdit only within range of QDoubleValidator

前端 未结 7 714
傲寒
傲寒 2020-12-16 05:52

I have a set of QLineEdits that are supposed to accept double values within a certain range, (e.g., -15 to 15).

I have something along these lines when

相关标签:
7条回答
  • 2020-12-16 06:44

    Here is a workaround: you can simply use QDoubleSpinBox with its buttonSymbols set to NoButtons, which would looks like a QLineEdit but you can set its range with native setMinimum(double min) and setMaximum(double max).

    This method is directly available in Qt Designer.

    0 讨论(0)
提交回复
热议问题