有时候我们不想一下一下的按QPushButton来执行某个事件,希望一直按着按钮,就使事件不断的执行,比如翻页等操作。Qt中三个函数可以帮助我们实现这个操作:

1 void setAutoRepeat ( bool )
2 void setAutoRepeatDelay ( int )
3 void setAutoRepeatInterval ( int )

顾名思义,三个函数的作用分别为:设置是否允许自动重复,设置重复操作的时延,设置自动操作的间隔

由此,我们可以按下面这样设置:

1 setAutoRepeat (true);
2 setAutoRepeatDelay(任意值);
3 setAutoRepeatInterval(任意值);

应该注意,后面两个函数的单位都是毫秒

相关文章:

  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-04-30
  • 2021-10-17
  • 2021-08-24
  • 2021-06-26
相关资源
相似解决方案