問題タブ [qvalidator]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
qt - QLineEdit がフォーカスを失ったかどうかを認識する
私のプロジェクトの 1 つにQLineEdit
、特定の範囲内にある 2 つの数値を受け入れる一連のウィジェットがあります。諸事情により使えませんQDoubleSpinBox
。
今、私はQDoubleValidator
自分の番号が指定された範囲内にあるかどうかを確認するために使用しています。残念ながら、シグナルは が与えられたeditingFinished
場合にのみ発信されます。QValidator
QValidator::Acceptable
ここで、一連のそのようなQLineEdit
ウィジェットがあるとします。1 つでは、間違った数字を入力してから、フォーカスを別のウィジェットに切り替えます。ユーザーには、 内に不適切な値が残されますQLineEdit
。
代わりに、不適切な入力を含むウィジェットにフォーカスを設定し、警告を発することをお勧めします。
何らかの理由で、この機能の実装に失敗しています。Qtのドキュメントを調べた後でも。
これが私の完全なコードです。
ValidatedDoubleEditorWidget.h
ValidatedDoubleEditorWidget.cpp
TestRunner.cpp
python - QIntValidator's 'bottom' property is not being actioned at the user input stage
I'm new to PyQt5 and trying to implement some code in Python and PyQt5 to validate a QLineEdit field's user input.
The QIntValidator 'bottom' integer value is set to 100 and the 'top' to 200. When inputting data to the field, values over 200 can't be input but values under 100 can. Have I missed out some steps or misunderstood this validator's functioning? This is my first question on stackoverflow - hope I've described the problem clearly. Any help much appreciated!