|
17 | 17 | # You should have received a copy of the GNU General Public License |
18 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
|
20 | | -from PyQt6.QtCore import QObject, pyqtSignal, QTime, QTimer |
| 20 | +from PyQt6.QtCore import QObject, pyqtSignal, QElapsedTimer, QTimer |
21 | 21 |
|
22 | 22 | from sdl2 import SDL_WasInit, SDL_InitSubSystem, SDL_INIT_JOYSTICK |
23 | 23 | from sdl2 import SDL_JoystickOpen, SDL_JoystickClose, SDL_NumJoysticks, SDL_JoystickNameForIndex |
@@ -104,17 +104,17 @@ def open(self, stick=0): |
104 | 104 |
|
105 | 105 | for i in range(self.num_axes): |
106 | 106 | self.axes[i] = SDL_JoystickGetAxis(self.joystick, i) |
107 | | - self.axis_repeat_timers[i] = QTime() |
| 107 | + self.axis_repeat_timers[i] = QElapsedTimer() |
108 | 108 | self.deadzones[i] = self.joystick_deadzone |
109 | 109 | self.sensitivities[i] = self.joystick_sensitivity |
110 | 110 |
|
111 | 111 | for i in range(self.num_buttons): |
112 | 112 | self.buttons[i] = SDL_JoystickGetButton(self.joystick, i) |
113 | | - self.button_repeat_timers[i] = QTime() |
| 113 | + self.button_repeat_timers[i] = QElapsedTimer() |
114 | 114 |
|
115 | 115 | for i in range(self.num_hats): |
116 | 116 | self.hats[i] = SDL_JoystickGetHat(self.joystick, i) |
117 | | - self.hat_repeat_timers[i] = QTime() |
| 117 | + self.hat_repeat_timers[i] = QElapsedTimer() |
118 | 118 |
|
119 | 119 | self.clear_events() |
120 | 120 | self.joystick_timer.start(self.event_timeout) |
|
0 commit comments