简体   繁体   English

PyQt5 - 在 QlineEdit 上检测 DeleteKey

[英]PyQt5 - Detect DeleteKey on QlineEdit

I would like to know the easiest way to detect when I delete text (with protentially Qt.Key_Delete ) from a QlineEdit?我想知道当我从 QlineEdit 中删除文本(可能是Qt.Key_Delete )时检测到的最简单方法?

The goal is that I can delete text from all 3 QLEdit when I use the Delete key of a single QLEdit目标是当我使用单个 QLEdit 的 Delete 键时,我可以从所有 3 个 QLEdit 中删除文本

Thanks谢谢

The whole objective is this: I have 3LineEdit : Frequency Min , Frequency Max and Frequency Span .整个目标是这样的:我有3LineEditFrequency MinFrequency MaxFrequency Span When I write in one of the 3 fields, it should automatically change the value of all other fields because: Frequency Min = Frequency Span - Frequency Max .当我在 3 个字段之一中写入时,它应该会自动更改所有其他字段的值,因为:频率最小值 = 频率跨度 - 频率最大值 //// Frequency Max = Frequency Span + Frequency Min //// Frequency Span = Frequency Max - Frequency Min ////. ////最大频率 = 频率跨度 + 最小频率////频率跨度 = 最大频率 - 最小频率////。 It doesn't really work but I'm close.它并没有真正起作用,但我很接近。 I'm only testing with the Frequency Min modification .我只是在使用Frequency Min 修改进行测试。 This is new for me.这对我来说是新的。 My current concern is that when I delete Frequency Min, I would like it to **delete text in QLE Frequency Span and Frequency Max **.我目前担心的是,当我删除频率最小值时,我希望它**删除 QLE 频率跨度和频率最大值**中的文本。

But, they keep their value so it distorts the result if I rewrite in Frequency Min.但是,它们保持它们的值,所以如果我用最小频率重写,它会扭曲结果。 So I would like to delete both when my program detects that I am deleting text in the Frequency Min QLineEdit .因此,当我的程序检测到我正在删除 Frequency Min QLineEdit 中的文本时,我想删除两者。 Then I would make this case with the other data然后我会用其他数据来做这个案例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM