autoRepeat、autoRepeatDelay、autoRepeatInterval這三個屬性為一組屬性,用於控制按鈕的按下事件是否重復、重復的頻次等。
autoRepeat
如果啟用了autoRepeat,則當按鈕按下且鼠標未釋放時,會定期發出pressed()、released()和clicked()信號。默認情況下,autoRepeat處於禁用狀態。autoRepeat處於允許狀態時,延遲時間和重復間隔由autoRepeatDelay、autoRepeatInterva以毫秒為單位定義。
可以通過autoRepeat() 、setAutoRepeat(bool)來訪問和設置autoRepeat屬性。
注意:如果用快捷鍵按下某個按鈕,則系統將啟用自動重復並計時,而不是QAbstractButton類來啟用。此種情況下,pressed()、released()和clicked()信號將像正常情況一樣發出。
autoRepeatDelay
此屬性保持自動重復的初始延遲,單位是毫秒。
如果啟用了autoRepeat,則autoRepeatDelay定義自動重復開始之前的初始延遲。即首次發送信號之前的延時,也就是在按鈕被按下到首次發送信號之間的時間間隔。
可以通過autoRepeatDelay () 、setAutoRepeatDelay (int)來訪問和設置autoRepeatDelay 屬性。
autoRepeatInterval
autoRepeatInterval屬性保存自動重復觸發按鈕的pressed()、released()和clicked()信號每次之間的時間間隔,單位是毫秒。
可以通過autoRepeatInterval() 、setAutoRepeatInterval (int)來訪問和設置autoRepeatDelay 屬性。