【发布时间】:2021-11-23 23:38:16
【问题描述】:
我有一个启用日历的 QDateEdit,并试图捕捉编辑的结束:
the_date = QDateEdit(...)
<some more initialization>
the_date.setCalendarPopup(True)
the_date.editingFinished.connect(checkDate)
...
def checkDate():
print ("checkDate called")
如果我从键盘编辑日期,当焦点通过 Tab、回车等离开小部件时,会调用 checkDate()。但如果我点击强制显示日历的向下箭头,则会调用 checkDate()当日历出现时立即,当小部件失去焦点时再次。
我不想与 userDateChanged 绑定,因为它会在编辑框中的每次击键时发出信号。
【问题讨论】: