From 55c1e99567baf1db9201b8486de01502e6cbee05 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sun, 24 Aug 2025 16:34:46 +0100
Subject: [PATCH] Migrate to Qt6

This was done against the stable branch independently of the migration
in the beta and master branches.
---
 arcade/glui/font.py                  |   2 +-
 arcade/glui/imageloader.py           |   4 +-
 arcade/glui/texture.py               |   4 +-
 arcade/ui/arcade_window.py           |  12 +-
 arcade/ui/event.py                   | 904 +++++++++++++--------------
 arcade/ui/gl_widget.py               |   6 +-
 fsgs/ui/mainwindow.py                |   2 +-
 fsgs/ui/qwindow.py                   |   2 +-
 fsui/qt/Application.py               |   2 +-
 fsui/qt/Choice.py                    |   4 +-
 fsui/qt/DirDialog.py                 |   2 +-
 fsui/qt/DrawingContext.py            |   4 +-
 fsui/qt/FileDialog.py                |   4 +-
 fsui/qt/Image.py                     |  10 +-
 fsui/qt/ListView.py                  |   6 +-
 fsui/qt/Panel.py                     |  10 +-
 fsui/qt/TextArea.py                  |   6 +-
 fsui/qt/TextField.py                 |   2 +-
 fsui/qt/VerticalItemView.py          |  10 +-
 fsui/qt/__init__.py                  |  10 +-
 fsui/qt/dialog.py                    |   8 +-
 fsui/qt/label.py                     |  16 +-
 fsui/qt/legacydialog.py              |   2 +-
 fsui/qt/qt.py                        |  63 +-
 fsui/qt/scrollarea.py                |   4 +-
 fsui/qt/widget.py                    |   9 +-
 fsui/qt/widget_mixin.py              |   9 +-
 fsui/qt/window.py                    |  62 +-
 fsui/qt/windowbase.py                |  14 +-
 launcher/apps/fs_game_center.py      |  12 +-
 launcher/settings/settings_dialog.py |   2 +-
 launcher/ui/skin.py                  |   6 +-
 workspace/shell/window.py            |   4 +-
 workspace/ui/label.py                |   6 +-
 workspace/ui/window.py               |   8 +-
 35 files changed, 617 insertions(+), 614 deletions(-)

diff --git a/arcade/glui/font.py b/arcade/glui/font.py
index 1719da2a..98bfb71b 100644
--- a/arcade/glui/font.py
+++ b/arcade/glui/font.py
@@ -67,7 +67,7 @@ def render(self, text, _, color):
         im = QImage(
             rect.x() + rect.width(),
             rect.height(),
-            QImage.Format_ARGB32_Premultiplied,
+            QImage.Format.Format_ARGB32_Premultiplied,
         )
         im.fill(QColor(0, 0, 0, 0))
         painter = QPainter()
diff --git a/arcade/glui/imageloader.py b/arcade/glui/imageloader.py
index 690b30a1..c3341294 100644
--- a/arcade/glui/imageloader.py
+++ b/arcade/glui/imageloader.py
@@ -92,8 +92,8 @@ def load_image(relative_path):
             if not os.path.exists(path):
                 return None, (0, 0)
             im = QImage(path)
-        if im.format() != QImage.Format_ARGB32:
-            im = im.convertToFormat(QImage.Format_ARGB32)
+        if im.format() != QImage.Format.Format_ARGB32:
+            im = im.convertToFormat(QImage.Format.Format_ARGB32)
         bits = im.bits()
         try:
             pixels = bits.tobytes()
diff --git a/arcade/glui/texture.py b/arcade/glui/texture.py
index 72ffb268..eff6b317 100644
--- a/arcade/glui/texture.py
+++ b/arcade/glui/texture.py
@@ -163,8 +163,8 @@ def load(
         internal_format = gl.GL_RGBA
         texture_format = gl.GL_BGRA
 
-        if im.format() != QImage.Format_ARGB32_Premultiplied:
-            im = im.convertToFormat(QImage.Format_ARGB32_Premultiplied)
+        if im.format() != QImage.Format.Format_ARGB32_Premultiplied:
+            im = im.convertToFormat(QImage.Format.Format_ARGB32_Premultiplied)
 
         bits = im.bits()
         try:
diff --git a/arcade/ui/arcade_window.py b/arcade/ui/arcade_window.py
index d5252cd5..cc9f6035 100644
--- a/arcade/ui/arcade_window.py
+++ b/arcade/ui/arcade_window.py
@@ -180,7 +180,7 @@ def __init__(self, callbacks, interval, window):
         self.interval = interval
         self.quit_flag = False
         self.first_time = None
-        # self.setCursor(Qt.BlankCursor)
+        # self.setCursor(Qt.CursorShape.BlankCursor)
         self._window = weakref.ref(window)
         self.set_blank_cursor()
         self.show_cursor_until = None
@@ -190,9 +190,9 @@ def __init__(self, callbacks, interval, window):
 
     def set_blank_cursor(self, blank=True):
         if blank:
-            cursor = Qt.BlankCursor
+            cursor = Qt.CursorShape.BlankCursor
         else:
-            cursor = Qt.ArrowCursor
+            cursor = Qt.CursorShape.ArrowCursor
         self.setCursor(cursor)
         if self.gl_widget is not None:
             self.gl_widget.setCursor(cursor)
@@ -224,7 +224,7 @@ def create_gl_window_2(self):
             self.gl_widget = GLWidget(self, self.callbacks)
             self.gl_widget.setMouseTracking(True)
             # if "--show-cursor" not in sys.argv:
-            # self.gl_widget.setCursor(Qt.BlankCursor)
+            # self.gl_widget.setCursor(Qt.CursorShape.BlankCursor)
             self.set_blank_cursor()
             self.gl_widget.setGeometry(
                 0, 0, self.size().width(), self.size().height()
@@ -309,10 +309,10 @@ def modifier():
         if event.isAutoRepeat():
             return
         if modifier():
-            if event.key() == Qt.Key_Return:
+            if event.key() == Qt.Key.Key_Return:
                 self.window().set_fullscreen(not self.window().is_fullscreen())
                 return
-            if event.key() == Qt.Key_Q:
+            if event.key() == Qt.Key.Key_Q:
                 self.window().close()
                 return
 
diff --git a/arcade/ui/event.py b/arcade/ui/event.py
index 35d415ee..705b8a9d 100644
--- a/arcade/ui/event.py
+++ b/arcade/ui/event.py
@@ -25,16 +25,16 @@ def create_key_event(cls, ev):
         # event = Event()
         # event.key = Key()
         event = {}
-        if ev.type() == QEvent.KeyPress:
+        if ev.type() == QEvent.Type.KeyPress:
             # event.type = sdl2.SDL_KEYDOWN
             event["type"] = "key-down"
-        elif ev.type() == QEvent.KeyRelease:
+        elif ev.type() == QEvent.Type.KeyRelease:
             # event.type = sdl2.SDL_KEYUP
             event["type"] = "key-up"
         else:
             raise Exception("Unexpected event type in create_key_event")
         # key_map = get_key_map()
-        # print(ev.key(), "vs", Qt.Key_Shift)
+        # print(ev.key(), "vs", Qt.Key.Key_Shift)
         # event.key.keysym.sym = key_map.get(ev.key(), 0)
         # event["key"] = key_map.get(ev.key(), 0)
         event["key"] = get_key(ev)
@@ -43,13 +43,13 @@ def create_key_event(cls, ev):
     @classmethod
     def create_mouse_event(cls, ev, window_size):
         event = {}
-        if ev.type() == QEvent.MouseMove:
+        if ev.type() == QEvent.Type.MouseMove:
             event["type"] = "mouse-motion"
-        elif ev.type() == QEvent.MouseButtonPress:
+        elif ev.type() == QEvent.Type.MouseButtonPress:
             event["type"] = "mouse-press"
-        elif ev.type() == QEvent.MouseButtonRelease:
+        elif ev.type() == QEvent.Type.MouseButtonRelease:
             event["type"] = "mouse-release"
-        elif ev.type() == QEvent.MouseButtonDblClick:
+        elif ev.type() == QEvent.Type.MouseButtonDblClick:
             event["type"] = "mouse-press"
         else:
             raise Exception("Unexpected event type in create_mouse_event")
@@ -70,21 +70,21 @@ def create_fake_mouse_event(cls, type_, x, y, window_size):
 
 
 def get_key(ev):
-    print("Qt key:", ev.key(), int(ev.modifiers()), Qt.KeypadModifier)
+    print("Qt key:", ev.key(), int(ev.modifiers()), Qt.KeyboardModifier.KeypadModifier)
     if macosx:
         # FIXME: TODO: CHECK
-        # if ev.key() == Qt.Key_Meta:
+        # if ev.key() == Qt.Key.Key_Meta:
         #     print("Control key, native virtual code:", ev.nativeVirtualCode())
-        # elif ev.key() == Qt.Key_Shift:
+        # elif ev.key() == Qt.Key.Key_Shift:
         pass
     else:
-        if ev.key() == Qt.Key_Control:
+        if ev.key() == Qt.Key.Key_Control:
             print("Control key, native scan code:", ev.nativeScanCode())
             if ev.nativeScanCode() == 105:  # Linux
                 return sdl2.SDLK_RCTRL
             # FIXME: TODO: WINDOWS
             return sdl2.SDLK_LCTRL
-        elif ev.key() == Qt.Key_Shift:
+        elif ev.key() == Qt.Key.Key_Shift:
             print("Shift key, native scan code:", ev.nativeScanCode())
             if ev.nativeScanCode() == 62:  # Linux
                 return sdl2.SDLK_RSHIFT
@@ -94,26 +94,26 @@ def get_key(ev):
     # key is pressed as the arrow keys are considered part of the keypad.
     # http://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum
     macos_arrow_key = macosx and ev.key() in [
-        Qt.Key_Left,
-        Qt.Key_Right,
-        Qt.Key_Up,
-        Qt.Key_Down,
+        Qt.Key.Key_Left,
+        Qt.Key.Key_Right,
+        Qt.Key.Key_Up,
+        Qt.Key.Key_Down,
     ]
-    if int(ev.modifiers()) & Qt.KeypadModifier and not macos_arrow_key:
+    if int(ev.modifiers()) & Qt.KeyboardModifier.KeypadModifier and not macos_arrow_key:
         print("keypad!")
-        print(ev.key(), "vs", Qt.Key_4)
+        print(ev.key(), "vs", Qt.Key.Key_4)
         return {
-            Qt.Key_Insert: sdl2.SDLK_KP_0,
-            Qt.Key_End: sdl2.SDLK_KP_1,
-            Qt.Key_Down: sdl2.SDLK_KP_2,
-            Qt.Key_PageDown: sdl2.SDLK_KP_3,
-            Qt.Key_Left: sdl2.SDLK_KP_4,
-            Qt.Key_Clear: sdl2.SDLK_KP_5,
-            Qt.Key_Right: sdl2.SDLK_KP_6,
-            Qt.Key_Home: sdl2.SDLK_KP_7,
-            Qt.Key_Up: sdl2.SDLK_KP_8,
-            Qt.Key_PageUp: sdl2.SDLK_KP_9,
-            Qt.Key_Delete: sdl2.SDLK_KP_PERIOD,
+            Qt.Key.Key_Insert: sdl2.SDLK_KP_0,
+            Qt.Key.Key_End: sdl2.SDLK_KP_1,
+            Qt.Key.Key_Down: sdl2.SDLK_KP_2,
+            Qt.Key.Key_PageDown: sdl2.SDLK_KP_3,
+            Qt.Key.Key_Left: sdl2.SDLK_KP_4,
+            Qt.Key.Key_Clear: sdl2.SDLK_KP_5,
+            Qt.Key.Key_Right: sdl2.SDLK_KP_6,
+            Qt.Key.Key_Home: sdl2.SDLK_KP_7,
+            Qt.Key.Key_Up: sdl2.SDLK_KP_8,
+            Qt.Key.Key_PageUp: sdl2.SDLK_KP_9,
+            Qt.Key.Key_Delete: sdl2.SDLK_KP_PERIOD,
         }.get(ev.key(), 0)
     key_map = get_key_map()
     return key_map.get(ev.key(), 0)
@@ -122,471 +122,471 @@ def get_key(ev):
 @lru_cache()
 def get_key_map():
     result = {
-        Qt.Key_Escape: sdl2.SDLK_ESCAPE,
-        Qt.Key_Tab: sdl2.SDLK_TAB,
-        # Qt.Key_Backtab	0x01000002
-        Qt.Key_Backspace: sdl2.SDLK_BACKSPACE,
-        Qt.Key_Return: sdl2.SDLK_RETURN,
+        Qt.Key.Key_Escape: sdl2.SDLK_ESCAPE,
+        Qt.Key.Key_Tab: sdl2.SDLK_TAB,
+        # Qt.Key.Key_Backtab	0x01000002
+        Qt.Key.Key_Backspace: sdl2.SDLK_BACKSPACE,
+        Qt.Key.Key_Return: sdl2.SDLK_RETURN,
         # Typically located on the keypad.
-        Qt.Key_Enter: sdl2.SDLK_KP_ENTER,
-        Qt.Key_Insert: sdl2.SDLK_INSERT,
-        Qt.Key_Delete: sdl2.SDLK_DELETE,
+        Qt.Key.Key_Enter: sdl2.SDLK_KP_ENTER,
+        Qt.Key.Key_Insert: sdl2.SDLK_INSERT,
+        Qt.Key.Key_Delete: sdl2.SDLK_DELETE,
         # The Pause/Break key (Note: Not anything to do with pausing media).
-        Qt.Key_Pause: sdl2.SDLK_PAUSE,
-        # Qt.Key_Print	0x01000009
-        # Qt.Key_SysReq	0x0100000a
-        # Qt.Key_Clear	0x0100000b
-        Qt.Key_Home: sdl2.SDLK_HOME,
-        Qt.Key_End: sdl2.SDLK_END,
-        Qt.Key_Left: sdl2.SDLK_LEFT,
-        Qt.Key_Up: sdl2.SDLK_UP,
-        Qt.Key_Right: sdl2.SDLK_RIGHT,
-        Qt.Key_Down: sdl2.SDLK_DOWN,
-        Qt.Key_PageUp: sdl2.SDLK_PAGEUP,
-        Qt.Key_PageDown: sdl2.SDLK_PAGEDOWN,
+        Qt.Key.Key_Pause: sdl2.SDLK_PAUSE,
+        # Qt.Key.Key_Print	0x01000009
+        # Qt.Key.Key_SysReq	0x0100000a
+        # Qt.Key.Key_Clear	0x0100000b
+        Qt.Key.Key_Home: sdl2.SDLK_HOME,
+        Qt.Key.Key_End: sdl2.SDLK_END,
+        Qt.Key.Key_Left: sdl2.SDLK_LEFT,
+        Qt.Key.Key_Up: sdl2.SDLK_UP,
+        Qt.Key.Key_Right: sdl2.SDLK_RIGHT,
+        Qt.Key.Key_Down: sdl2.SDLK_DOWN,
+        Qt.Key.Key_PageUp: sdl2.SDLK_PAGEUP,
+        Qt.Key.Key_PageDown: sdl2.SDLK_PAGEDOWN,
         # FIXME: LSHIFT vs RSHIFT
-        Qt.Key_Shift: sdl2.SDLK_LSHIFT,
+        Qt.Key.Key_Shift: sdl2.SDLK_LSHIFT,
         # On Mac OS X, this corresponds to the Command keys.
-        # Qt.Key_Control	0x01000021
+        # Qt.Key.Key_Control	0x01000021
         # FIXME: LCTRL vs RCTRL, OS X, etc
-        Qt.Key_Control: sdl2.SDLK_LCTRL,
+        Qt.Key.Key_Control: sdl2.SDLK_LCTRL,
         # On Mac OS X, this corresponds to the Control keys. On Windows
         # keyboards, this key is mapped to the Windows key.
-        # Qt.Key_Meta	0x01000022
-        # Qt.Key_Alt	0x01000023
+        # Qt.Key.Key_Meta	0x01000022
+        # Qt.Key.Key_Alt	0x01000023
         # On Windows, when the KeyDown event for this key is sent, the
         # Ctrl+Alt modifiers are also set.
-        # Qt.Key_AltGr	0x01001103
-        # Qt.Key_CapsLock	0x01000024
-        # Qt.Key_NumLock	0x01000025
-        # Qt.Key_ScrollLock	0x01000026
-        Qt.Key_F1: sdl2.SDLK_F1,
-        Qt.Key_F2: sdl2.SDLK_F2,
-        Qt.Key_F3: sdl2.SDLK_F3,
-        Qt.Key_F4: sdl2.SDLK_F4,
-        Qt.Key_F5: sdl2.SDLK_F5,
-        Qt.Key_F6: sdl2.SDLK_F6,
-        Qt.Key_F7: sdl2.SDLK_F7,
-        Qt.Key_F8: sdl2.SDLK_F8,
-        Qt.Key_F9: sdl2.SDLK_F9,
-        Qt.Key_F10: sdl2.SDLK_F10,
-        # Qt.Key_F11	0x0100003a
-        # Qt.Key_F12	0x0100003b
-        # Qt.Key_F13	0x0100003c
-        # Qt.Key_F14	0x0100003d
-        # Qt.Key_F15	0x0100003e
-        # Qt.Key_F16	0x0100003f
-        # Qt.Key_F17	0x01000040
-        # Qt.Key_F18	0x01000041
-        # Qt.Key_F19	0x01000042
-        # Qt.Key_F20	0x01000043
-        # Qt.Key_F21	0x01000044
-        # Qt.Key_F22	0x01000045
-        # Qt.Key_F23	0x01000046
-        # Qt.Key_F24	0x01000047
-        # Qt.Key_F25	0x01000048
-        # Qt.Key_F26	0x01000049
-        # Qt.Key_F27	0x0100004a
-        # Qt.Key_F28	0x0100004b
-        # Qt.Key_F29	0x0100004c
-        # Qt.Key_F30	0x0100004d
-        # Qt.Key_F31	0x0100004e
-        # Qt.Key_F32	0x0100004f
-        # Qt.Key_F33	0x01000050
-        # Qt.Key_F34	0x01000051
-        # Qt.Key_F35	0x01000052
-        # Qt.Key_Super_L	0x01000053
-        # Qt.Key_Super_R	0x01000054
-        # Qt.Key_Menu	0x01000055
-        # Qt.Key_Hyper_L	0x01000056
-        # Qt.Key_Hyper_R	0x01000057
-        # Qt.Key_Help	0x01000058
-        # Qt.Key_Direction_L	0x01000059
-        # Qt.Key_Direction_R	0x01000060
-        Qt.Key_Space: sdl2.SDLK_SPACE,
-        # Qt.Key_Any	Key_Space
-        # Qt.Key_Exclam	0x21
-        # Qt.Key_QuoteDbl	0x22
-        # Qt.Key_NumberSign	0x23
-        # Qt.Key_Dollar	0x24
-        # Qt.Key_Percent	0x25
-        # Qt.Key_Ampersand	0x26
-        # Qt.Key_Apostrophe	0x27
-        # Qt.Key_ParenLeft	0x28
-        # Qt.Key_ParenRight	0x29
-        # Qt.Key_Asterisk	0x2a
-        # Qt.Key_Plus	0x2b
-        # Qt.Key_Comma	0x2c
-        # Qt.Key_Minus	0x2d
-        # Qt.Key_Period	0x2e
-        # Qt.Key_Slash	0x2f
-        # Qt.Key_0	0x30
-        # Qt.Key_1	0x31
-        # Qt.Key_2	0x32
-        # Qt.Key_3	0x33
-        # Qt.Key_4	0x34
-        # Qt.Key_5	0x35
-        # Qt.Key_6	0x36
-        # Qt.Key_7	0x37
-        # Qt.Key_8	0x38
-        # Qt.Key_9	0x39
-        # Qt.Key_Colon	0x3a
-        # Qt.Key_Semicolon	0x3b
-        # Qt.Key_Less	0x3c
-        # Qt.Key_Equal	0x3d
-        # Qt.Key_Greater	0x3e
-        # Qt.Key_Question	0x3f
-        # Qt.Key_At	0x40
-        Qt.Key_A: sdl2.SDLK_a,
-        Qt.Key_B: sdl2.SDLK_b,
-        Qt.Key_C: sdl2.SDLK_c,
-        Qt.Key_D: sdl2.SDLK_d,
-        Qt.Key_E: sdl2.SDLK_e,
-        Qt.Key_F: sdl2.SDLK_f,
-        Qt.Key_G: sdl2.SDLK_g,
-        Qt.Key_H: sdl2.SDLK_h,
-        Qt.Key_I: sdl2.SDLK_i,
-        Qt.Key_J: sdl2.SDLK_j,
-        Qt.Key_K: sdl2.SDLK_k,
-        Qt.Key_L: sdl2.SDLK_l,
-        Qt.Key_M: sdl2.SDLK_m,
-        Qt.Key_N: sdl2.SDLK_n,
-        Qt.Key_O: sdl2.SDLK_o,
-        Qt.Key_P: sdl2.SDLK_p,
-        Qt.Key_Q: sdl2.SDLK_q,
-        Qt.Key_R: sdl2.SDLK_r,
-        Qt.Key_S: sdl2.SDLK_s,
-        Qt.Key_T: sdl2.SDLK_t,
-        Qt.Key_U: sdl2.SDLK_u,
-        Qt.Key_V: sdl2.SDLK_v,
-        Qt.Key_W: sdl2.SDLK_w,
-        Qt.Key_X: sdl2.SDLK_x,
-        Qt.Key_Y: sdl2.SDLK_y,
-        Qt.Key_Z: sdl2.SDLK_z,
+        # Qt.Key.Key_AltGr	0x01001103
+        # Qt.Key.Key_CapsLock	0x01000024
+        # Qt.Key.Key_NumLock	0x01000025
+        # Qt.Key.Key_ScrollLock	0x01000026
+        Qt.Key.Key_F1: sdl2.SDLK_F1,
+        Qt.Key.Key_F2: sdl2.SDLK_F2,
+        Qt.Key.Key_F3: sdl2.SDLK_F3,
+        Qt.Key.Key_F4: sdl2.SDLK_F4,
+        Qt.Key.Key_F5: sdl2.SDLK_F5,
+        Qt.Key.Key_F6: sdl2.SDLK_F6,
+        Qt.Key.Key_F7: sdl2.SDLK_F7,
+        Qt.Key.Key_F8: sdl2.SDLK_F8,
+        Qt.Key.Key_F9: sdl2.SDLK_F9,
+        Qt.Key.Key_F10: sdl2.SDLK_F10,
+        # Qt.Key.Key_F11	0x0100003a
+        # Qt.Key.Key_F12	0x0100003b
+        # Qt.Key.Key_F13	0x0100003c
+        # Qt.Key.Key_F14	0x0100003d
+        # Qt.Key.Key_F15	0x0100003e
+        # Qt.Key.Key_F16	0x0100003f
+        # Qt.Key.Key_F17	0x01000040
+        # Qt.Key.Key_F18	0x01000041
+        # Qt.Key.Key_F19	0x01000042
+        # Qt.Key.Key_F20	0x01000043
+        # Qt.Key.Key_F21	0x01000044
+        # Qt.Key.Key_F22	0x01000045
+        # Qt.Key.Key_F23	0x01000046
+        # Qt.Key.Key_F24	0x01000047
+        # Qt.Key.Key_F25	0x01000048
+        # Qt.Key.Key_F26	0x01000049
+        # Qt.Key.Key_F27	0x0100004a
+        # Qt.Key.Key_F28	0x0100004b
+        # Qt.Key.Key_F29	0x0100004c
+        # Qt.Key.Key_F30	0x0100004d
+        # Qt.Key.Key_F31	0x0100004e
+        # Qt.Key.Key_F32	0x0100004f
+        # Qt.Key.Key_F33	0x01000050
+        # Qt.Key.Key_F34	0x01000051
+        # Qt.Key.Key_F35	0x01000052
+        # Qt.Key.Key_Super_L	0x01000053
+        # Qt.Key.Key_Super_R	0x01000054
+        # Qt.Key.Key_Menu	0x01000055
+        # Qt.Key.Key_Hyper_L	0x01000056
+        # Qt.Key.Key_Hyper_R	0x01000057
+        # Qt.Key.Key_Help	0x01000058
+        # Qt.Key.Key_Direction_L	0x01000059
+        # Qt.Key.Key_Direction_R	0x01000060
+        Qt.Key.Key_Space: sdl2.SDLK_SPACE,
+        # Qt.Key.Key_Any	Key_Space
+        # Qt.Key.Key_Exclam	0x21
+        # Qt.Key.Key_QuoteDbl	0x22
+        # Qt.Key.Key_NumberSign	0x23
+        # Qt.Key.Key_Dollar	0x24
+        # Qt.Key.Key_Percent	0x25
+        # Qt.Key.Key_Ampersand	0x26
+        # Qt.Key.Key_Apostrophe	0x27
+        # Qt.Key.Key_ParenLeft	0x28
+        # Qt.Key.Key_ParenRight	0x29
+        # Qt.Key.Key_Asterisk	0x2a
+        # Qt.Key.Key_Plus	0x2b
+        # Qt.Key.Key_Comma	0x2c
+        # Qt.Key.Key_Minus	0x2d
+        # Qt.Key.Key_Period	0x2e
+        # Qt.Key.Key_Slash	0x2f
+        # Qt.Key.Key_0	0x30
+        # Qt.Key.Key_1	0x31
+        # Qt.Key.Key_2	0x32
+        # Qt.Key.Key_3	0x33
+        # Qt.Key.Key_4	0x34
+        # Qt.Key.Key_5	0x35
+        # Qt.Key.Key_6	0x36
+        # Qt.Key.Key_7	0x37
+        # Qt.Key.Key_8	0x38
+        # Qt.Key.Key_9	0x39
+        # Qt.Key.Key_Colon	0x3a
+        # Qt.Key.Key_Semicolon	0x3b
+        # Qt.Key.Key_Less	0x3c
+        # Qt.Key.Key_Equal	0x3d
+        # Qt.Key.Key_Greater	0x3e
+        # Qt.Key.Key_Question	0x3f
+        # Qt.Key.Key_At	0x40
+        Qt.Key.Key_A: sdl2.SDLK_a,
+        Qt.Key.Key_B: sdl2.SDLK_b,
+        Qt.Key.Key_C: sdl2.SDLK_c,
+        Qt.Key.Key_D: sdl2.SDLK_d,
+        Qt.Key.Key_E: sdl2.SDLK_e,
+        Qt.Key.Key_F: sdl2.SDLK_f,
+        Qt.Key.Key_G: sdl2.SDLK_g,
+        Qt.Key.Key_H: sdl2.SDLK_h,
+        Qt.Key.Key_I: sdl2.SDLK_i,
+        Qt.Key.Key_J: sdl2.SDLK_j,
+        Qt.Key.Key_K: sdl2.SDLK_k,
+        Qt.Key.Key_L: sdl2.SDLK_l,
+        Qt.Key.Key_M: sdl2.SDLK_m,
+        Qt.Key.Key_N: sdl2.SDLK_n,
+        Qt.Key.Key_O: sdl2.SDLK_o,
+        Qt.Key.Key_P: sdl2.SDLK_p,
+        Qt.Key.Key_Q: sdl2.SDLK_q,
+        Qt.Key.Key_R: sdl2.SDLK_r,
+        Qt.Key.Key_S: sdl2.SDLK_s,
+        Qt.Key.Key_T: sdl2.SDLK_t,
+        Qt.Key.Key_U: sdl2.SDLK_u,
+        Qt.Key.Key_V: sdl2.SDLK_v,
+        Qt.Key.Key_W: sdl2.SDLK_w,
+        Qt.Key.Key_X: sdl2.SDLK_x,
+        Qt.Key.Key_Y: sdl2.SDLK_y,
+        Qt.Key.Key_Z: sdl2.SDLK_z,
         # FIXME: Depends on keymap?
-        Qt.Key_BracketLeft: sdl2.SDLK_LEFTBRACKET,
-        # Qt.Key_Backslash	0x5c
+        Qt.Key.Key_BracketLeft: sdl2.SDLK_LEFTBRACKET,
+        # Qt.Key.Key_Backslash	0x5c
         # FIXME: Depends on keymap?
-        Qt.Key_BracketRight: sdl2.SDLK_RIGHTBRACKET,
-        # Qt.Key_BracketRight	0x5d
-        # Qt.Key_AsciiCircum	0x5e
-        # Qt.Key_Underscore	0x5f
-        # Qt.Key_QuoteLeft	0x60
-        # Qt.Key_BraceLeft	0x7b
-        # Qt.Key_Bar	0x7c
-        # Qt.Key_BraceRight	0x7d
-        # Qt.Key_AsciiTilde	0x7e
-        # Qt.Key_nobreakspace	0x0a0
-        # Qt.Key_exclamdown	0x0a1
-        # Qt.Key_cent	0x0a2
-        # Qt.Key_sterling	0x0a3
-        # Qt.Key_currency	0x0a4
-        # Qt.Key_yen	0x0a5
-        # Qt.Key_brokenbar	0x0a6
-        # Qt.Key_section	0x0a7
-        # Qt.Key_diaeresis	0x0a8
-        # Qt.Key_copyright	0x0a9
-        # Qt.Key_ordfeminine	0x0aa
-        # Qt.Key_guillemotleft	0x0ab
-        # Qt.Key_notsign	0x0ac
-        # Qt.Key_hyphen	0x0ad
-        # Qt.Key_registered	0x0ae
-        # Qt.Key_macron	0x0af
-        # Qt.Key_degree	0x0b0
-        # Qt.Key_plusminus	0x0b1
-        # Qt.Key_twosuperior	0x0b2
-        # Qt.Key_threesuperior	0x0b3
-        # Qt.Key_acute	0x0b4
-        # Qt.Key_mu	0x0b5
-        # Qt.Key_paragraph	0x0b6
-        # Qt.Key_periodcentered	0x0b7
-        # Qt.Key_cedilla	0x0b8
-        # Qt.Key_onesuperior	0x0b9
-        # Qt.Key_masculine	0x0ba
-        # Qt.Key_guillemotright	0x0bb
-        # Qt.Key_onequarter	0x0bc
-        # Qt.Key_onehalf	0x0bd
-        # Qt.Key_threequarters	0x0be
-        # Qt.Key_questiondown	0x0bf
-        # Qt.Key_Agrave	0x0c0
-        # Qt.Key_Aacute	0x0c1
-        # Qt.Key_Acircumflex	0x0c2
-        # Qt.Key_Atilde	0x0c3
-        # Qt.Key_Adiaeresis	0x0c4
-        # Qt.Key_Aring	0x0c5
-        # Qt.Key_AE	0x0c6
-        # Qt.Key_Ccedilla	0x0c7
-        # Qt.Key_Egrave	0x0c8
-        # Qt.Key_Eacute	0x0c9
-        # Qt.Key_Ecircumflex	0x0ca
-        # Qt.Key_Ediaeresis	0x0cb
-        # Qt.Key_Igrave	0x0cc
-        # Qt.Key_Iacute	0x0cd
-        # Qt.Key_Icircumflex	0x0ce
-        # Qt.Key_Idiaeresis	0x0cf
-        # Qt.Key_ETH	0x0d0
-        # Qt.Key_Ntilde	0x0d1
-        # Qt.Key_Ograve	0x0d2
-        # Qt.Key_Oacute	0x0d3
-        # Qt.Key_Ocircumflex	0x0d4
-        # Qt.Key_Otilde	0x0d5
-        # Qt.Key_Odiaeresis	0x0d6
-        # Qt.Key_multiply	0x0d7
-        # Qt.Key_Ooblique	0x0d8
-        # Qt.Key_Ugrave	0x0d9
-        # Qt.Key_Uacute	0x0da
-        # Qt.Key_Ucircumflex	0x0db
-        # Qt.Key_Udiaeresis	0x0dc
-        # Qt.Key_Yacute	0x0dd
-        # Qt.Key_THORN	0x0de
-        # Qt.Key_ssharp	0x0df
-        # Qt.Key_division	0x0f7
-        # Qt.Key_ydiaeresis	0x0ff
-        # Qt.Key_Multi_key	0x01001120
-        # Qt.Key_Codeinput	0x01001137
-        # Qt.Key_SingleCandidate	0x0100113c
-        # Qt.Key_MultipleCandidate	0x0100113d
-        # Qt.Key_PreviousCandidate	0x0100113e
-        # Qt.Key_Mode_switch	0x0100117e
-        # Qt.Key_Kanji	0x01001121
-        # Qt.Key_Muhenkan	0x01001122
-        # Qt.Key_Henkan	0x01001123
-        # Qt.Key_Romaji	0x01001124
-        # Qt.Key_Hiragana	0x01001125
-        # Qt.Key_Katakana	0x01001126
-        # Qt.Key_Hiragana_Katakana	0x01001127
-        # Qt.Key_Zenkaku	0x01001128
-        # Qt.Key_Hankaku	0x01001129
-        # Qt.Key_Zenkaku_Hankaku	0x0100112a
-        # Qt.Key_Touroku	0x0100112b
-        # Qt.Key_Massyo	0x0100112c
-        # Qt.Key_Kana_Lock	0x0100112d
-        # Qt.Key_Kana_Shift	0x0100112e
-        # Qt.Key_Eisu_Shift	0x0100112f
-        # Qt.Key_Eisu_toggle	0x01001130
-        # Qt.Key_Hangul	0x01001131
-        # Qt.Key_Hangul_Start	0x01001132
-        # Qt.Key_Hangul_End	0x01001133
-        # Qt.Key_Hangul_Hanja	0x01001134
-        # Qt.Key_Hangul_Jamo	0x01001135
-        # Qt.Key_Hangul_Romaja	0x01001136
-        # Qt.Key_Hangul_Jeonja	0x01001138
-        # Qt.Key_Hangul_Banja	0x01001139
-        # Qt.Key_Hangul_PreHanja	0x0100113a
-        # Qt.Key_Hangul_PostHanja	0x0100113b
-        # Qt.Key_Hangul_Special	0x0100113f
-        # Qt.Key_Dead_Grave	0x01001250
-        # Qt.Key_Dead_Acute	0x01001251
-        # Qt.Key_Dead_Circumflex	0x01001252
-        # Qt.Key_Dead_Tilde	0x01001253
-        # Qt.Key_Dead_Macron	0x01001254
-        # Qt.Key_Dead_Breve	0x01001255
-        # Qt.Key_Dead_Abovedot	0x01001256
-        # Qt.Key_Dead_Diaeresis	0x01001257
-        # Qt.Key_Dead_Abovering	0x01001258
-        # Qt.Key_Dead_Doubleacute	0x01001259
-        # Qt.Key_Dead_Caron	0x0100125a
-        # Qt.Key_Dead_Cedilla	0x0100125b
-        # Qt.Key_Dead_Ogonek	0x0100125c
-        # Qt.Key_Dead_Iota	0x0100125d
-        # Qt.Key_Dead_Voiced_Sound	0x0100125e
-        # Qt.Key_Dead_Semivoiced_Sound	0x0100125f
-        # Qt.Key_Dead_Belowdot	0x01001260
-        # Qt.Key_Dead_Hook	0x01001261
-        # Qt.Key_Dead_Horn	0x01001262
-        # Qt.Key_Back	0x01000061
-        # Qt.Key_Forward	0x01000062
-        # Qt.Key_Stop	0x01000063
-        # Qt.Key_Refresh	0x01000064
-        # Qt.Key_VolumeDown	0x01000070
-        # Qt.Key_VolumeMute	0x01000071
-        # Qt.Key_VolumeUp	0x01000072
-        # Qt.Key_BassBoost	0x01000073
-        # Qt.Key_BassUp	0x01000074
-        # Qt.Key_BassDown	0x01000075
-        # Qt.Key_TrebleUp	0x01000076
-        # Qt.Key_TrebleDown	0x01000077
+        Qt.Key.Key_BracketRight: sdl2.SDLK_RIGHTBRACKET,
+        # Qt.Key.Key_BracketRight	0x5d
+        # Qt.Key.Key_AsciiCircum	0x5e
+        # Qt.Key.Key_Underscore	0x5f
+        # Qt.Key.Key_QuoteLeft	0x60
+        # Qt.Key.Key_BraceLeft	0x7b
+        # Qt.Key.Key_Bar	0x7c
+        # Qt.Key.Key_BraceRight	0x7d
+        # Qt.Key.Key_AsciiTilde	0x7e
+        # Qt.Key.Key_nobreakspace	0x0a0
+        # Qt.Key.Key_exclamdown	0x0a1
+        # Qt.Key.Key_cent	0x0a2
+        # Qt.Key.Key_sterling	0x0a3
+        # Qt.Key.Key_currency	0x0a4
+        # Qt.Key.Key_yen	0x0a5
+        # Qt.Key.Key_brokenbar	0x0a6
+        # Qt.Key.Key_section	0x0a7
+        # Qt.Key.Key_diaeresis	0x0a8
+        # Qt.Key.Key_copyright	0x0a9
+        # Qt.Key.Key_ordfeminine	0x0aa
+        # Qt.Key.Key_guillemotleft	0x0ab
+        # Qt.Key.Key_notsign	0x0ac
+        # Qt.Key.Key_hyphen	0x0ad
+        # Qt.Key.Key_registered	0x0ae
+        # Qt.Key.Key_macron	0x0af
+        # Qt.Key.Key_degree	0x0b0
+        # Qt.Key.Key_plusminus	0x0b1
+        # Qt.Key.Key_twosuperior	0x0b2
+        # Qt.Key.Key_threesuperior	0x0b3
+        # Qt.Key.Key_acute	0x0b4
+        # Qt.Key.Key_mu	0x0b5
+        # Qt.Key.Key_paragraph	0x0b6
+        # Qt.Key.Key_periodcentered	0x0b7
+        # Qt.Key.Key_cedilla	0x0b8
+        # Qt.Key.Key_onesuperior	0x0b9
+        # Qt.Key.Key_masculine	0x0ba
+        # Qt.Key.Key_guillemotright	0x0bb
+        # Qt.Key.Key_onequarter	0x0bc
+        # Qt.Key.Key_onehalf	0x0bd
+        # Qt.Key.Key_threequarters	0x0be
+        # Qt.Key.Key_questiondown	0x0bf
+        # Qt.Key.Key_Agrave	0x0c0
+        # Qt.Key.Key_Aacute	0x0c1
+        # Qt.Key.Key_Acircumflex	0x0c2
+        # Qt.Key.Key_Atilde	0x0c3
+        # Qt.Key.Key_Adiaeresis	0x0c4
+        # Qt.Key.Key_Aring	0x0c5
+        # Qt.Key.Key_AE	0x0c6
+        # Qt.Key.Key_Ccedilla	0x0c7
+        # Qt.Key.Key_Egrave	0x0c8
+        # Qt.Key.Key_Eacute	0x0c9
+        # Qt.Key.Key_Ecircumflex	0x0ca
+        # Qt.Key.Key_Ediaeresis	0x0cb
+        # Qt.Key.Key_Igrave	0x0cc
+        # Qt.Key.Key_Iacute	0x0cd
+        # Qt.Key.Key_Icircumflex	0x0ce
+        # Qt.Key.Key_Idiaeresis	0x0cf
+        # Qt.Key.Key_ETH	0x0d0
+        # Qt.Key.Key_Ntilde	0x0d1
+        # Qt.Key.Key_Ograve	0x0d2
+        # Qt.Key.Key_Oacute	0x0d3
+        # Qt.Key.Key_Ocircumflex	0x0d4
+        # Qt.Key.Key_Otilde	0x0d5
+        # Qt.Key.Key_Odiaeresis	0x0d6
+        # Qt.Key.Key_multiply	0x0d7
+        # Qt.Key.Key_Ooblique	0x0d8
+        # Qt.Key.Key_Ugrave	0x0d9
+        # Qt.Key.Key_Uacute	0x0da
+        # Qt.Key.Key_Ucircumflex	0x0db
+        # Qt.Key.Key_Udiaeresis	0x0dc
+        # Qt.Key.Key_Yacute	0x0dd
+        # Qt.Key.Key_THORN	0x0de
+        # Qt.Key.Key_ssharp	0x0df
+        # Qt.Key.Key_division	0x0f7
+        # Qt.Key.Key_ydiaeresis	0x0ff
+        # Qt.Key.Key_Multi_key	0x01001120
+        # Qt.Key.Key_Codeinput	0x01001137
+        # Qt.Key.Key_SingleCandidate	0x0100113c
+        # Qt.Key.Key_MultipleCandidate	0x0100113d
+        # Qt.Key.Key_PreviousCandidate	0x0100113e
+        # Qt.Key.Key_Mode_switch	0x0100117e
+        # Qt.Key.Key_Kanji	0x01001121
+        # Qt.Key.Key_Muhenkan	0x01001122
+        # Qt.Key.Key_Henkan	0x01001123
+        # Qt.Key.Key_Romaji	0x01001124
+        # Qt.Key.Key_Hiragana	0x01001125
+        # Qt.Key.Key_Katakana	0x01001126
+        # Qt.Key.Key_Hiragana_Katakana	0x01001127
+        # Qt.Key.Key_Zenkaku	0x01001128
+        # Qt.Key.Key_Hankaku	0x01001129
+        # Qt.Key.Key_Zenkaku_Hankaku	0x0100112a
+        # Qt.Key.Key_Touroku	0x0100112b
+        # Qt.Key.Key_Massyo	0x0100112c
+        # Qt.Key.Key_Kana_Lock	0x0100112d
+        # Qt.Key.Key_Kana_Shift	0x0100112e
+        # Qt.Key.Key_Eisu_Shift	0x0100112f
+        # Qt.Key.Key_Eisu_toggle	0x01001130
+        # Qt.Key.Key_Hangul	0x01001131
+        # Qt.Key.Key_Hangul_Start	0x01001132
+        # Qt.Key.Key_Hangul_End	0x01001133
+        # Qt.Key.Key_Hangul_Hanja	0x01001134
+        # Qt.Key.Key_Hangul_Jamo	0x01001135
+        # Qt.Key.Key_Hangul_Romaja	0x01001136
+        # Qt.Key.Key_Hangul_Jeonja	0x01001138
+        # Qt.Key.Key_Hangul_Banja	0x01001139
+        # Qt.Key.Key_Hangul_PreHanja	0x0100113a
+        # Qt.Key.Key_Hangul_PostHanja	0x0100113b
+        # Qt.Key.Key_Hangul_Special	0x0100113f
+        # Qt.Key.Key_Dead_Grave	0x01001250
+        # Qt.Key.Key_Dead_Acute	0x01001251
+        # Qt.Key.Key_Dead_Circumflex	0x01001252
+        # Qt.Key.Key_Dead_Tilde	0x01001253
+        # Qt.Key.Key_Dead_Macron	0x01001254
+        # Qt.Key.Key_Dead_Breve	0x01001255
+        # Qt.Key.Key_Dead_Abovedot	0x01001256
+        # Qt.Key.Key_Dead_Diaeresis	0x01001257
+        # Qt.Key.Key_Dead_Abovering	0x01001258
+        # Qt.Key.Key_Dead_Doubleacute	0x01001259
+        # Qt.Key.Key_Dead_Caron	0x0100125a
+        # Qt.Key.Key_Dead_Cedilla	0x0100125b
+        # Qt.Key.Key_Dead_Ogonek	0x0100125c
+        # Qt.Key.Key_Dead_Iota	0x0100125d
+        # Qt.Key.Key_Dead_Voiced_Sound	0x0100125e
+        # Qt.Key.Key_Dead_Semivoiced_Sound	0x0100125f
+        # Qt.Key.Key_Dead_Belowdot	0x01001260
+        # Qt.Key.Key_Dead_Hook	0x01001261
+        # Qt.Key.Key_Dead_Horn	0x01001262
+        # Qt.Key.Key_Back	0x01000061
+        # Qt.Key.Key_Forward	0x01000062
+        # Qt.Key.Key_Stop	0x01000063
+        # Qt.Key.Key_Refresh	0x01000064
+        # Qt.Key.Key_VolumeDown	0x01000070
+        # Qt.Key.Key_VolumeMute	0x01000071
+        # Qt.Key.Key_VolumeUp	0x01000072
+        # Qt.Key.Key_BassBoost	0x01000073
+        # Qt.Key.Key_BassUp	0x01000074
+        # Qt.Key.Key_BassDown	0x01000075
+        # Qt.Key.Key_TrebleUp	0x01000076
+        # Qt.Key.Key_TrebleDown	0x01000077
         # A key setting the state of the media player to play
-        # Qt.Key_MediaPlay	0x01000080
+        # Qt.Key.Key_MediaPlay	0x01000080
         # A key setting the state of the media player to stop
-        # Qt.Key_MediaStop	0x01000081
-        # Qt.Key_MediaPrevious	0x01000082
-        # Qt.Key_MediaNext	0x01000083
-        # Qt.Key_MediaRecord	0x01000084
+        # Qt.Key.Key_MediaStop	0x01000081
+        # Qt.Key.Key_MediaPrevious	0x01000082
+        # Qt.Key.Key_MediaNext	0x01000083
+        # Qt.Key.Key_MediaRecord	0x01000084
         # A key setting the state of the media player to pause
         # (Note: not the pause/break key)
-        # Qt.Key_MediaPause	0x1000085
+        # Qt.Key.Key_MediaPause	0x1000085
         # A key to toggle the play/pause state in the media player
         # (rather than setting an absolute state)
-        # Qt.Key_MediaTogglePlayPause	0x1000086
-        # Qt.Key_HomePage	0x01000090
-        # Qt.Key_Favorites	0x01000091
-        # Qt.Key_Search	0x01000092
-        # Qt.Key_Standby	0x01000093
-        # Qt.Key_OpenUrl	0x01000094
-        # Qt.Key_LaunchMail	0x010000a0
-        # Qt.Key_LaunchMedia	0x010000a1
+        # Qt.Key.Key_MediaTogglePlayPause	0x1000086
+        # Qt.Key.Key_HomePage	0x01000090
+        # Qt.Key.Key_Favorites	0x01000091
+        # Qt.Key.Key_Search	0x01000092
+        # Qt.Key.Key_Standby	0x01000093
+        # Qt.Key.Key_OpenUrl	0x01000094
+        # Qt.Key.Key_LaunchMail	0x010000a0
+        # Qt.Key.Key_LaunchMedia	0x010000a1
         # On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key
         # for legacy reasons.
-        # Qt.Key_Launch0	0x010000a2
+        # Qt.Key.Key_Launch0	0x010000a2
         # On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key
         # for legacy reasons.
-        # Qt.Key_Launch1	0x010000a3
+        # Qt.Key.Key_Launch1	0x010000a3
         # On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons.
-        # Qt.Key_Launch2	0x010000a4
-        # Qt.Key_Launch3	0x010000a5	On X11 this key is mapped to
+        # Qt.Key.Key_Launch2	0x010000a4
+        # Qt.Key.Key_Launch3	0x010000a5	On X11 this key is mapped to
         # XF86XK_Launch1 key for legacy reasons.
-        # Qt.Key_Launch4	0x010000a6	On X11 this key is mapped to
+        # Qt.Key.Key_Launch4	0x010000a6	On X11 this key is mapped to
         # XF86XK_Launch2 key for legacy reasons.
-        # Qt.Key_Launch5	0x010000a7	On X11 this key is mapped to
+        # Qt.Key.Key_Launch5	0x010000a7	On X11 this key is mapped to
         # XF86XK_Launch3 key for legacy reasons.
-        # Qt.Key_Launch6	0x010000a8	On X11 this key is mapped to
+        # Qt.Key.Key_Launch6	0x010000a8	On X11 this key is mapped to
         # XF86XK_Launch4 key for legacy reasons.
-        # Qt.Key_Launch7	0x010000a9	On X11 this key is mapped to
+        # Qt.Key.Key_Launch7	0x010000a9	On X11 this key is mapped to
         # XF86XK_Launch5 key for legacy reasons.
-        # Qt.Key_Launch8	0x010000aa	On X11 this key is mapped to
+        # Qt.Key.Key_Launch8	0x010000aa	On X11 this key is mapped to
         # XF86XK_Launch6 key for legacy reasons.
-        # Qt.Key_Launch9	0x010000ab	On X11 this key is mapped to
+        # Qt.Key.Key_Launch9	0x010000ab	On X11 this key is mapped to
         # XF86XK_Launch7 key for legacy reasons.
-        # Qt.Key_LaunchA	0x010000ac	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchA	0x010000ac	On X11 this key is mapped to
         # XF86XK_Launch8 key for legacy reasons.
-        # Qt.Key_LaunchB	0x010000ad	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchB	0x010000ad	On X11 this key is mapped to
         # XF86XK_Launch9 key for legacy reasons.
-        # Qt.Key_LaunchC	0x010000ae	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchC	0x010000ae	On X11 this key is mapped to
         # XF86XK_LaunchA key for legacy reasons.
-        # Qt.Key_LaunchD	0x010000af	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchD	0x010000af	On X11 this key is mapped to
         # XF86XK_LaunchB key for legacy reasons.
-        # Qt.Key_LaunchE	0x010000b0	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchE	0x010000b0	On X11 this key is mapped to
         # XF86XK_LaunchC key for legacy reasons.
-        # Qt.Key_LaunchF	0x010000b1	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchF	0x010000b1	On X11 this key is mapped to
         # XF86XK_LaunchD key for legacy reasons.
-        # Qt.Key_LaunchG	0x0100010e	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchG	0x0100010e	On X11 this key is mapped to
         # XF86XK_LaunchE key for legacy reasons.
-        # Qt.Key_LaunchH	0x0100010f	On X11 this key is mapped to
+        # Qt.Key.Key_LaunchH	0x0100010f	On X11 this key is mapped to
         # XF86XK_LaunchF key for legacy reasons.
-        # Qt.Key_MonBrightnessUp	0x010000b2
-        # Qt.Key_MonBrightnessDown	0x010000b3
-        # Qt.Key_KeyboardLightOnOff	0x010000b4
-        # Qt.Key_KeyboardBrightnessUp	0x010000b5
-        # Qt.Key_KeyboardBrightnessDown	0x010000b6
-        # Qt.Key_PowerOff	0x010000b7
-        # Qt.Key_WakeUp	0x010000b8
-        # Qt.Key_Eject	0x010000b9
-        # Qt.Key_ScreenSaver	0x010000ba
-        # Qt.Key_WWW	0x010000bb
-        # Qt.Key_Memo	0x010000bc
-        # Qt.Key_LightBulb	0x010000bd
-        # Qt.Key_Shop	0x010000be
-        # Qt.Key_History	0x010000bf
-        # Qt.Key_AddFavorite	0x010000c0
-        # Qt.Key_HotLinks	0x010000c1
-        # Qt.Key_BrightnessAdjust	0x010000c2
-        # Qt.Key_Finance	0x010000c3
-        # Qt.Key_Community	0x010000c4
-        # Qt.Key_AudioRewind	0x010000c5
-        # Qt.Key_BackForward	0x010000c6
-        # Qt.Key_ApplicationLeft	0x010000c7
-        # Qt.Key_ApplicationRight	0x010000c8
-        # Qt.Key_Book	0x010000c9
-        # Qt.Key_CD	0x010000ca
+        # Qt.Key.Key_MonBrightnessUp	0x010000b2
+        # Qt.Key.Key_MonBrightnessDown	0x010000b3
+        # Qt.Key.Key_KeyboardLightOnOff	0x010000b4
+        # Qt.Key.Key_KeyboardBrightnessUp	0x010000b5
+        # Qt.Key.Key_KeyboardBrightnessDown	0x010000b6
+        # Qt.Key.Key_PowerOff	0x010000b7
+        # Qt.Key.Key_WakeUp	0x010000b8
+        # Qt.Key.Key_Eject	0x010000b9
+        # Qt.Key.Key_ScreenSaver	0x010000ba
+        # Qt.Key.Key_WWW	0x010000bb
+        # Qt.Key.Key_Memo	0x010000bc
+        # Qt.Key.Key_LightBulb	0x010000bd
+        # Qt.Key.Key_Shop	0x010000be
+        # Qt.Key.Key_History	0x010000bf
+        # Qt.Key.Key_AddFavorite	0x010000c0
+        # Qt.Key.Key_HotLinks	0x010000c1
+        # Qt.Key.Key_BrightnessAdjust	0x010000c2
+        # Qt.Key.Key_Finance	0x010000c3
+        # Qt.Key.Key_Community	0x010000c4
+        # Qt.Key.Key_AudioRewind	0x010000c5
+        # Qt.Key.Key_BackForward	0x010000c6
+        # Qt.Key.Key_ApplicationLeft	0x010000c7
+        # Qt.Key.Key_ApplicationRight	0x010000c8
+        # Qt.Key.Key_Book	0x010000c9
+        # Qt.Key.Key_CD	0x010000ca
         # On X11 this key is not mapped for legacy reasons.
-        # Use Qt.Key_Launch1 instead.
-        # Qt.Key_Calculator	0x010000cb
-        # Qt.Key_ToDoList	0x010000cc
-        # Qt.Key_ClearGrab	0x010000cd
-        # Qt.Key_Close	0x010000ce
-        # Qt.Key_Copy	0x010000cf
-        # Qt.Key_Cut	0x010000d0
-        # Qt.Key_Display	0x010000d1
-        # Qt.Key_DOS	0x010000d2
-        # Qt.Key_Documents	0x010000d3
-        # Qt.Key_Excel	0x010000d4
-        # Qt.Key_Explorer	0x010000d5
-        # Qt.Key_Game	0x010000d6
-        # Qt.Key_Go	0x010000d7
-        # Qt.Key_iTouch	0x010000d8
-        # Qt.Key_LogOff	0x010000d9
-        # Qt.Key_Market	0x010000da
-        # Qt.Key_Meeting	0x010000db
-        # Qt.Key_MenuKB	0x010000dc
-        # Qt.Key_MenuPB	0x010000dd
-        # Qt.Key_MySites	0x010000de
-        # Qt.Key_News	0x010000df
-        # Qt.Key_OfficeHome	0x010000e0
-        # Qt.Key_Option	0x010000e1
-        # Qt.Key_Paste	0x010000e2
-        # Qt.Key_Phone	0x010000e3
-        # Qt.Key_Calendar	0x010000e4
-        # Qt.Key_Reply	0x010000e5
-        # Qt.Key_Reload	0x010000e6
-        # Qt.Key_RotateWindows	0x010000e7
-        # Qt.Key_RotationPB	0x010000e8
-        # Qt.Key_RotationKB	0x010000e9
-        # Qt.Key_Save	0x010000ea
-        # Qt.Key_Send	0x010000eb
-        # Qt.Key_Spell	0x010000ec
-        # Qt.Key_SplitScreen	0x010000ed
-        # Qt.Key_Support	0x010000ee
-        # Qt.Key_TaskPane	0x010000ef
-        # Qt.Key_Terminal	0x010000f0
-        # Qt.Key_Tools	0x010000f1
-        # Qt.Key_Travel	0x010000f2
-        # Qt.Key_Video	0x010000f3
-        # Qt.Key_Word	0x010000f4
-        # Qt.Key_Xfer	0x010000f5
-        # Qt.Key_ZoomIn	0x010000f6
-        # Qt.Key_ZoomOut	0x010000f7
-        # Qt.Key_Away	0x010000f8
-        # Qt.Key_Messenger	0x010000f9
-        # Qt.Key_WebCam	0x010000fa
-        # Qt.Key_MailForward	0x010000fb
-        # Qt.Key_Pictures	0x010000fc
-        # Qt.Key_Music	0x010000fd
-        # Qt.Key_Battery	0x010000fe
-        # Qt.Key_Bluetooth	0x010000ff
-        # Qt.Key_WLAN	0x01000100
-        # Qt.Key_UWB	0x01000101
-        # Qt.Key_AudioForward	0x01000102
-        # Qt.Key_AudioRepeat	0x01000103
-        # Qt.Key_AudioRandomPlay	0x01000104
-        # Qt.Key_Subtitle	0x01000105
-        # Qt.Key_AudioCycleTrack	0x01000106
-        # Qt.Key_Time	0x01000107
-        # Qt.Key_Hibernate	0x01000108
-        # Qt.Key_View	0x01000109
-        # Qt.Key_TopMenu	0x0100010a
-        # Qt.Key_PowerDown	0x0100010b
-        # Qt.Key_Suspend	0x0100010c
-        # Qt.Key_ContrastAdjust	0x0100010d
-        # Qt.Key_MediaLast	0x0100ffff
-        # Qt.Key_unknown	0x01ffffff
-        # A key to answer or initiate a call (see Qt.Key_ToggleCallHangup
+        # Use Qt.Key.Key_Launch1 instead.
+        # Qt.Key.Key_Calculator	0x010000cb
+        # Qt.Key.Key_ToDoList	0x010000cc
+        # Qt.Key.Key_ClearGrab	0x010000cd
+        # Qt.Key.Key_Close	0x010000ce
+        # Qt.Key.Key_Copy	0x010000cf
+        # Qt.Key.Key_Cut	0x010000d0
+        # Qt.Key.Key_Display	0x010000d1
+        # Qt.Key.Key_DOS	0x010000d2
+        # Qt.Key.Key_Documents	0x010000d3
+        # Qt.Key.Key_Excel	0x010000d4
+        # Qt.Key.Key_Explorer	0x010000d5
+        # Qt.Key.Key_Game	0x010000d6
+        # Qt.Key.Key_Go	0x010000d7
+        # Qt.Key.Key_iTouch	0x010000d8
+        # Qt.Key.Key_LogOff	0x010000d9
+        # Qt.Key.Key_Market	0x010000da
+        # Qt.Key.Key_Meeting	0x010000db
+        # Qt.Key.Key_MenuKB	0x010000dc
+        # Qt.Key.Key_MenuPB	0x010000dd
+        # Qt.Key.Key_MySites	0x010000de
+        # Qt.Key.Key_News	0x010000df
+        # Qt.Key.Key_OfficeHome	0x010000e0
+        # Qt.Key.Key_Option	0x010000e1
+        # Qt.Key.Key_Paste	0x010000e2
+        # Qt.Key.Key_Phone	0x010000e3
+        # Qt.Key.Key_Calendar	0x010000e4
+        # Qt.Key.Key_Reply	0x010000e5
+        # Qt.Key.Key_Reload	0x010000e6
+        # Qt.Key.Key_RotateWindows	0x010000e7
+        # Qt.Key.Key_RotationPB	0x010000e8
+        # Qt.Key.Key_RotationKB	0x010000e9
+        # Qt.Key.Key_Save	0x010000ea
+        # Qt.Key.Key_Send	0x010000eb
+        # Qt.Key.Key_Spell	0x010000ec
+        # Qt.Key.Key_SplitScreen	0x010000ed
+        # Qt.Key.Key_Support	0x010000ee
+        # Qt.Key.Key_TaskPane	0x010000ef
+        # Qt.Key.Key_Terminal	0x010000f0
+        # Qt.Key.Key_Tools	0x010000f1
+        # Qt.Key.Key_Travel	0x010000f2
+        # Qt.Key.Key_Video	0x010000f3
+        # Qt.Key.Key_Word	0x010000f4
+        # Qt.Key.Key_Xfer	0x010000f5
+        # Qt.Key.Key_ZoomIn	0x010000f6
+        # Qt.Key.Key_ZoomOut	0x010000f7
+        # Qt.Key.Key_Away	0x010000f8
+        # Qt.Key.Key_Messenger	0x010000f9
+        # Qt.Key.Key_WebCam	0x010000fa
+        # Qt.Key.Key_MailForward	0x010000fb
+        # Qt.Key.Key_Pictures	0x010000fc
+        # Qt.Key.Key_Music	0x010000fd
+        # Qt.Key.Key_Battery	0x010000fe
+        # Qt.Key.Key_Bluetooth	0x010000ff
+        # Qt.Key.Key_WLAN	0x01000100
+        # Qt.Key.Key_UWB	0x01000101
+        # Qt.Key.Key_AudioForward	0x01000102
+        # Qt.Key.Key_AudioRepeat	0x01000103
+        # Qt.Key.Key_AudioRandomPlay	0x01000104
+        # Qt.Key.Key_Subtitle	0x01000105
+        # Qt.Key.Key_AudioCycleTrack	0x01000106
+        # Qt.Key.Key_Time	0x01000107
+        # Qt.Key.Key_Hibernate	0x01000108
+        # Qt.Key.Key_View	0x01000109
+        # Qt.Key.Key_TopMenu	0x0100010a
+        # Qt.Key.Key_PowerDown	0x0100010b
+        # Qt.Key.Key_Suspend	0x0100010c
+        # Qt.Key.Key_ContrastAdjust	0x0100010d
+        # Qt.Key.Key_MediaLast	0x0100ffff
+        # Qt.Key.Key_unknown	0x01ffffff
+        # A key to answer or initiate a call (see Qt.Key.Key_ToggleCallHangup
         # for a key to toggle current call state)
-        # Qt.Key_Call	0x01100004
+        # Qt.Key.Key_Call	0x01100004
         # A key to activate the camera shutter
-        # Qt.Key_Camera	0x01100020
-        # Qt.Key_CameraFocus	0x01100021	A key to focus the camera
-        # Qt.Key_Context1	0x01100000
-        # Qt.Key_Context2	0x01100001
-        # Qt.Key_Context3	0x01100002
-        # Qt.Key_Context4	0x01100003
-        # Qt.Key_Flip	0x01100006
-        # A key to end an ongoing call (see Qt.Key_ToggleCallHangup for a
+        # Qt.Key.Key_Camera	0x01100020
+        # Qt.Key.Key_CameraFocus	0x01100021	A key to focus the camera
+        # Qt.Key.Key_Context1	0x01100000
+        # Qt.Key.Key_Context2	0x01100001
+        # Qt.Key.Key_Context3	0x01100002
+        # Qt.Key.Key_Context4	0x01100003
+        # Qt.Key.Key_Flip	0x01100006
+        # A key to end an ongoing call (see Qt.Key.Key_ToggleCallHangup for a
         # key to toggle current call state)
-        # Qt.Key_Hangup	0x01100005
-        # Qt.Key_No	0x01010002
-        # Qt.Key_Select	0x01010000
-        # Qt.Key_Yes	0x01010001
+        # Qt.Key.Key_Hangup	0x01100005
+        # Qt.Key.Key_No	0x01010002
+        # Qt.Key.Key_Select	0x01010000
+        # Qt.Key.Key_Yes	0x01010001
         # A key to toggle the current call state (ie. either answer, or
         # hangup) depending on current call state
-        # Qt.Key_ToggleCallHangup	0x01100007
-        # Qt.Key_VoiceDial	0x01100008
-        # Qt.Key_LastNumberRedial	0x01100009
-        # Qt.Key_Execute	0x01020003
-        # Qt.Key_Printer	0x01020002
-        # Qt.Key_Play	0x01020005
-        # Qt.Key_Sleep	0x01020004
-        # Qt.Key_Zoom	0x01020006
-        # Qt.Key_Cancel	0x01020001
+        # Qt.Key.Key_ToggleCallHangup	0x01100007
+        # Qt.Key.Key_VoiceDial	0x01100008
+        # Qt.Key.Key_LastNumberRedial	0x01100009
+        # Qt.Key.Key_Execute	0x01020003
+        # Qt.Key.Key_Printer	0x01020002
+        # Qt.Key.Key_Play	0x01020005
+        # Qt.Key.Key_Sleep	0x01020004
+        # Qt.Key.Key_Zoom	0x01020006
+        # Qt.Key.Key_Cancel	0x01020001
     }
     return result
diff --git a/arcade/ui/gl_widget.py b/arcade/ui/gl_widget.py
index d4f7a651..847ff890 100644
--- a/arcade/ui/gl_widget.py
+++ b/arcade/ui/gl_widget.py
@@ -2,13 +2,13 @@
 import traceback
 
 from arcade.glui.opengl import gl
-from fsui.qt import QGLWidget
+from fsui.qt import QtOpenGLWidget
 
 
 # noinspection PyPep8Naming
-class GLWidget(QGLWidget):
+class GLWidget(QtOpenGLWidget):
     def __init__(self, parent, callbacks):
-        QGLWidget.__init__(self, parent)
+        QtOpenGLWidget.__init__(self, parent)
         self._callbacks = callbacks
         self._initialized = False
         self._first_initialize_gl_call = True
diff --git a/fsgs/ui/mainwindow.py b/fsgs/ui/mainwindow.py
index 2c86ede6..da329df2 100644
--- a/fsgs/ui/mainwindow.py
+++ b/fsgs/ui/mainwindow.py
@@ -15,7 +15,7 @@ def __init__(self):
         self.resize(960, 540)
         self.game_center_widget.resize(960, 540)
         # self.game_center_widget.setFocus()
-        # self.game_center_widget.setFocusPolicy(Qt.TabFocus)
+        # self.game_center_widget.setFocusPolicy(Qt.FocusPolicy.TabFocus)
 
         self.game_center_view.requestActivate()
         self.setFocus()
diff --git a/fsgs/ui/qwindow.py b/fsgs/ui/qwindow.py
index 4e65fd0e..08562456 100644
--- a/fsgs/ui/qwindow.py
+++ b/fsgs/ui/qwindow.py
@@ -47,7 +47,7 @@ def __init__(self, parent=None):
         # self.resize(960, 540)
 
         # self.game_center_widget.setFocus()
-        # self.game_center_widget.setFocusPolicy(Qt.TabFocus)
+        # self.game_center_widget.setFocusPolicy(Qt.FocusPolicy.TabFocus)
 
         # self.game_center_view.requestActivate()
         # self.setFocus()
diff --git a/fsui/qt/Application.py b/fsui/qt/Application.py
index 49f4ccae..4edd47e6 100644
--- a/fsui/qt/Application.py
+++ b/fsui/qt/Application.py
@@ -12,7 +12,7 @@ def on_create(self):
         pass
 
     def run(self):
-        self.qapplication.exec_()
+        self.qapplication.exec()
         self.stop()
 
     def set_icon(self, icon):
diff --git a/fsui/qt/Choice.py b/fsui/qt/Choice.py
index 33f077dc..883c1534 100644
--- a/fsui/qt/Choice.py
+++ b/fsui/qt/Choice.py
@@ -30,8 +30,8 @@ def __init__(self, parent, items=None, cursor_keys=True):
 
     def keyPressEvent(self, event):
         if not self.cursor_keys:
-            print("cursor keys is false", event.key(), Qt.Key_Up)
-            if event.key() == Qt.Key_Up or event.key() == Qt.Key_Down:
+            print("cursor keys is false", event.key(), Qt.Key.Key_Up)
+            if event.key() == Qt.Key.Key_Up or event.key() == Qt.Key.Key_Down:
                 print("ignoring")
                 return
         super().keyPressEvent(event)
diff --git a/fsui/qt/DirDialog.py b/fsui/qt/DirDialog.py
index 521ea132..262330ef 100644
--- a/fsui/qt/DirDialog.py
+++ b/fsui/qt/DirDialog.py
@@ -5,4 +5,4 @@
 class DirDialog(FileDialog):
     def __init__(self, parent=None, message="", directory=""):
         FileDialog.__init__(self, parent, message, directory, dir_mode=True)
-        self.setAttribute(Qt.WA_DeleteOnClose)
+        self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
diff --git a/fsui/qt/DrawingContext.py b/fsui/qt/DrawingContext.py
index b1361606..e1c79c2b 100644
--- a/fsui/qt/DrawingContext.py
+++ b/fsui/qt/DrawingContext.py
@@ -61,14 +61,14 @@ def draw_text(self, text: str, x: int, y: int) -> None:
         # self.qpainter.drawText(QPoint(x, y), text)
         self.qpainter.setPen(QPen(self.text_color))
         self.qpainter.drawText(
-            x, y, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, text
+            x, y, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, text
         )
 
     def measure_text(self, text: str) -> Tuple[int, int]:
         # return self.dc.GetTextExtent(text)
         # return (10, 10)
         rect = self.qpainter.boundingRect(
-            0, 0, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, text
+            0, 0, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, text
         )
         return rect.width(), rect.height()
 
diff --git a/fsui/qt/FileDialog.py b/fsui/qt/FileDialog.py
index fc10638e..a0650b2f 100644
--- a/fsui/qt/FileDialog.py
+++ b/fsui/qt/FileDialog.py
@@ -37,7 +37,7 @@ def get_paths(self):
         return self.selectedFiles()
 
     def show_modal(self):
-        result = self.exec_()
+        result = self.exec()
         print("File dialog result is", result)
         return result
 
@@ -78,7 +78,7 @@ def pick_file(parent=None, message="", directory="", what=FILE):
             dialog.setFileMode(QFileDialog.Directory)
         elif what == FILES:
             dialog.setFileMode(QFileDialog.ExistingFiles)
-        modal_result = dialog.exec_()
+        modal_result = dialog.exec()
         if not modal_result:
             result = None
         elif what == FILES:
diff --git a/fsui/qt/Image.py b/fsui/qt/Image.py
index 908a547e..446bcf6e 100644
--- a/fsui/qt/Image.py
+++ b/fsui/qt/Image.py
@@ -55,8 +55,8 @@ def qicon(self):
 
     def grey_scale(self):
         # return Image(object=self.qimage.convertToFormat(
-        #     QImage.Format_ARGB32, Qt.AutoOnly))
-        copy = self.qimage.convertToFormat(QImage.Format_ARGB32, Qt.AutoColor)
+        #     QImage.Format.Format_ARGB32, Qt.ImageConversionFlag.AutoOnly))
+        copy = self.qimage.convertToFormat(QImage.Format.Format_ARGB32, Qt.ImageConversionFlag.AutoColor)
         # copy = self.qimage.copy(0, 0, *self.size)
 
         # WARNING: this is presumably a bit slow...
@@ -89,10 +89,10 @@ def resize(self, size, filter=1):
         if size == self.size:
             return
         if filter:
-            q = Qt.SmoothTransformation
+            q = Qt.TransformationMode.SmoothTransformation
         else:
-            q = Qt.FastTransformation
+            q = Qt.TransformationMode.FastTransformation
         self.qimage = self.qimage.scaled(
-            size[0], size[1], Qt.IgnoreAspectRatio, q
+            size[0], size[1], Qt.AspectRatioMode.IgnoreAspectRatio, q
         )
         # self._bitmap = None
diff --git a/fsui/qt/ListView.py b/fsui/qt/ListView.py
index 3d3890f5..ec2ad677 100644
--- a/fsui/qt/ListView.py
+++ b/fsui/qt/ListView.py
@@ -27,7 +27,7 @@ def __init__(self, parent, border=True):
         selection_model = self.selectionModel()
         print("QListView selectionModel", selection_model)
         selection_model.selectionChanged.connect(self.__selection_changed)
-        self.setEditTriggers(QListView.NoEditTriggers)
+        self.setEditTriggers(QListView.EditTrigger.NoEditTriggers)
         self.doubleClicked.connect(self.__double_clicked)
         # self.returnPressed.connect(self.__double_clicked)
         # self.activated.connect(self.__double_clicked)
@@ -37,7 +37,7 @@ def set_row_height(self, height):
         self._row_height = height
 
     def keyPressEvent(self, event):
-        if event.key() == Qt.Key_Return:
+        if event.key() == Qt.Key.Key_Return:
             self.__double_clicked()
         else:
             super().keyPressEvent(event)
@@ -86,7 +86,7 @@ def add_item(self, label, icon=None, bold=False):
         item.setSizeHint(QSize(-1, self._row_height))
         if bold:
             font = self.font()
-            font.setWeight(QFont.Bold)
+            font.setWeight(QFont.Weight.Bold)
             item.setFont(font)
         self._model.appendRow(item)
 
diff --git a/fsui/qt/Panel.py b/fsui/qt/Panel.py
index 486b3699..8e596d1e 100644
--- a/fsui/qt/Panel.py
+++ b/fsui/qt/Panel.py
@@ -25,7 +25,7 @@ def __init__(self, parent, paintable=False):
         # super(Panel, self).__init__(parent.get_container())
         # super().__init__()
         self._ignore_next_left_down_event = False
-        # self._widget.setFocusPolicy(Qt.NoFocus)
+        # self._widget.setFocusPolicy(Qt.FocusPolicy.NoFocus)
 
     def on_left_down(self):
         pass
@@ -79,7 +79,7 @@ def paintEvent(self, event):
         #     return
 
         self.owner()._painter = QPainter(self)
-        self.owner()._painter.setRenderHint(QPainter.Antialiasing)
+        self.owner()._painter.setRenderHint(QPainter.RenderHint.Antialiasing)
         # self._painter.setRenderHint(QPainter.Qt4CompatiblePainting)
         try:
             self.owner().on_paint()
@@ -89,7 +89,7 @@ def paintEvent(self, event):
             self.owner()._painter = None
 
     def mousePressEvent(self, event):
-        if event.button() == Qt.LeftButton:
+        if event.button() == Qt.MouseButton.LeftButton:
             # A temp code is made in case _ignore_next_left_down_event is
             # altered inside on_left_down.
             ignore = self.owner()._ignore_next_left_down_event
@@ -103,14 +103,14 @@ def keyPressEvent(self, event):
         self.owner().on_key_press(event)
 
     def mouseReleaseEvent(self, event):
-        if event.button() == Qt.LeftButton:
+        if event.button() == Qt.MouseButton.LeftButton:
             self.owner().on_left_up()
 
     def mouseMoveEvent(self, event):
         self.owner().on_mouse_motion()
 
     def mouseDoubleClickEvent(self, event):
-        if event.button() == Qt.LeftButton:
+        if event.button() == Qt.MouseButton.LeftButton:
             self.owner().on_left_dclick()
 
     def showEvent(self, event):
diff --git a/fsui/qt/TextArea.py b/fsui/qt/TextArea.py
index bf462159..8e6af7e4 100644
--- a/fsui/qt/TextArea.py
+++ b/fsui/qt/TextArea.py
@@ -33,16 +33,16 @@ def set_text(self, text):
     def append_text(self, text, color=None):
         # text = text.replace("\n", "\r\n")
         # print("Appending text:", repr(text))
-        # self.moveCursor(QTextCursor.End)
+        # self.moveCursor(QTextCursor.MoveOperation.End)
         # self.insertPlainText(text.strip())
         if color is not None:
             self.setTextColor(fsui.qt.QColor(*color))
         # self.appendPlainText(text.strip())
         self.append(text.strip())
-        self.moveCursor(fsui.qt.QTextCursor.End)
+        self.moveCursor(fsui.qt.QTextCursor.MoveOperation.End)
 
     def scroll_to_start(self):
-        self.moveCursor(fsui.qt.QTextCursor.Start)
+        self.moveCursor(fsui.qt.QTextCursor.MoveOperation.Start)
 
     def __text_changed(self):
         self.changed.emit()
diff --git a/fsui/qt/TextField.py b/fsui/qt/TextField.py
index 60bb489d..464ccd02 100644
--- a/fsui/qt/TextField.py
+++ b/fsui/qt/TextField.py
@@ -47,4 +47,4 @@ def __return_pressed(self):
 class PasswordField(TextField):
     def __init__(self, parent, text=""):
         TextField.__init__(self, parent, text)
-        self.setEchoMode(QLineEdit.Password)
+        self.setEchoMode(QLineEdit.EchoMode.Password)
diff --git a/fsui/qt/VerticalItemView.py b/fsui/qt/VerticalItemView.py
index acc177ca..8f268b48 100644
--- a/fsui/qt/VerticalItemView.py
+++ b/fsui/qt/VerticalItemView.py
@@ -20,16 +20,16 @@ def rowCount(self, parent):
     def data(self, index, role):
         row = index.row()
         # print("data for", index, "role", role)
-        if role == Qt.SizeHintRole:
+        if role == Qt.ItemDataRole.SizeHintRole:
             height = self.parent()._row_height
             return QSize(height, height)
-        elif role == Qt.DecorationRole:
+        elif role == Qt.ItemDataRole.DecorationRole:
             icon = self.parent().get_item_icon(row)
             if icon:
                 return icon.qpixmap
-        elif role == Qt.DisplayRole:
+        elif role == Qt.ItemDataRole.DisplayRole:
             return self.parent().get_item_text(row)
-        elif role == Qt.ForegroundRole:
+        elif role == Qt.ItemDataRole.ForegroundRole:
             color = self.parent().get_item_text_color(row)
             if color is not None:
                 return QBrush(color)
@@ -67,7 +67,7 @@ def set_row_height(self, height):
         self._row_height = height
 
     def keyPressEvent(self, event):
-        if event.key() == Qt.Key_Return:
+        if event.key() == Qt.Key.Key_Return:
             self.__double_clicked()
         else:
             QListView.keyPressEvent(self, event)
diff --git a/fsui/qt/__init__.py b/fsui/qt/__init__.py
index a6b1ad23..92b66994 100644
--- a/fsui/qt/__init__.py
+++ b/fsui/qt/__init__.py
@@ -4,7 +4,7 @@
 from fsui.res import gettext
 from fsui.qt.qt import (
     init_qt,
-    QDesktopWidget,
+    QGuiApplication,
     QEvent,
     QObject,
     QCoreApplication,
@@ -18,8 +18,8 @@
 
 def get_screen_size():
     init_qt()
-    desktop = QDesktopWidget()
-    geometry = desktop.geometry()
+    screen = QGuiApplication.primaryScreen()
+    geometry = screen.geometry()
     size = geometry.width(), geometry.height()
     print("using screen size", size)
     return size
@@ -33,7 +33,7 @@ def get_mouse_position():
 
 class CustomEvent(QEvent):
     def __init__(self):
-        QEvent.__init__(self, QEvent.User)
+        QEvent.__init__(self, QEvent.Type.User)
 
 
 class EventHandler(QObject):
@@ -84,7 +84,7 @@ def show_error(message, title=None, parent=None):
     # message_box = QMessageBox()
     # message_box.setIcon(QMessageBox.Critical)
     # message_box.setText(message)
-    # message_box.exec_()
+    # message_box.exec()
     QMessageBox.critical(QParent(parent), title, message)
 
 
diff --git a/fsui/qt/dialog.py b/fsui/qt/dialog.py
index 34c3e9a4..642cbc60 100644
--- a/fsui/qt/dialog.py
+++ b/fsui/qt/dialog.py
@@ -15,13 +15,13 @@ def real_window(self):
 
     def show_modal(self):
         self.center_on_initial_show()
-        # self.setWindowModality(Qt.WindowModal)
-        return self.exec_()
+        # self.setWindowModality(Qt.WindowModality.WindowModal)
+        return self.exec()
 
     def show(self):
         self.center_on_initial_show()
-        self.setWindowModality(Qt.WindowModal)
-        return self.exec_()
+        self.setWindowModality(Qt.WindowModality.WindowModal)
+        return self.exec()
 
     def end_modal(self, value):
         self.done(value)
diff --git a/fsui/qt/label.py b/fsui/qt/label.py
index f69f8a80..b6ef89d7 100644
--- a/fsui/qt/label.py
+++ b/fsui/qt/label.py
@@ -9,13 +9,13 @@ def __init__(self, parent, label):
         fsui.qt.QLabel.__init__(self, label, parent.get_container())
         self.init_widget(parent)
 
-        self.setTextFormat(fsui.qt.Qt.RichText)
-        # self.setTextInteractionFlags(fsui.qt.Qt.TextBrowserInteraction)
+        self.setTextFormat(fsui.qt.Qt.TextFormat.RichText)
+        # self.setTextInteractionFlags(fsui.qt.Qt.TextInteractionFlag.TextBrowserInteraction)
         self.setTextInteractionFlags(
-            Qt.TextSelectableByMouse | Qt.LinksAccessibleByMouse
+            Qt.TextInteractionFlag.TextSelectableByMouse | Qt.TextInteractionFlag.LinksAccessibleByMouse
         )
         self.setOpenExternalLinks(True)
-        # self.setFocusPolicy(Qt.NoFocus)
+        # self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
 
         # FIXME: focusPolicy()
         # FIXME: make Label more plain, and rather make a InteractiveLabel
@@ -44,7 +44,7 @@ def __init__(self, parent, label, url):
         self._label = label
         self._url = url
         Label.__init__(self, parent, self._fix_label())
-        # self.setFocusPolicy(Qt.StrongFocus)
+        # self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
 
     def set_text(self, label):
         self._label = label
@@ -74,10 +74,10 @@ def __init__(self, parent, label, min_width=None):
         if min_width:
             self.set_min_width(min_width)
 
-        self._widget.setTextFormat(fsui.qt.Qt.RichText)
-        self._widget.setTextInteractionFlags(fsui.qt.Qt.TextBrowserInteraction)
+        self._widget.setTextFormat(fsui.qt.Qt.TextFormat.RichText)
+        self._widget.setTextInteractionFlags(fsui.qt.Qt.TextInteractionFlag.TextBrowserInteraction)
         self._widget.setOpenExternalLinks(True)
-        self._widget.setAlignment(fsui.qt.Qt.AlignLeft | fsui.qt.Qt.AlignTop)
+        self._widget.setAlignment(fsui.qt.Qt.AlignmentFlag.AlignLeft | fsui.qt.Qt.AlignmentFlag.AlignTop)
 
     def set_text(self, label):
         self._widget.setText(label)
diff --git a/fsui/qt/legacydialog.py b/fsui/qt/legacydialog.py
index 43b959cd..8e594268 100644
--- a/fsui/qt/legacydialog.py
+++ b/fsui/qt/legacydialog.py
@@ -54,7 +54,7 @@ def get_container(self):
     def show_modal(self):
         # self.setModal(True)
         # return self.showModal()
-        return self.exec_()
+        return self.exec()
 
     def end_modal(self, value):
         # self.EndModal(value)
diff --git a/fsui/qt/qt.py b/fsui/qt/qt.py
index 67596d90..4d6d8e1d 100644
--- a/fsui/qt/qt.py
+++ b/fsui/qt/qt.py
@@ -9,22 +9,22 @@
 from fsbc.settings import Settings
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtCore import *
+from PyQt6.QtCore import *
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtGui import *
+from PyQt6.QtGui import *
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtCore import pyqtSignal as Signal
+from PyQt6.QtCore import pyqtSignal as Signal
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtCore import pyqtSignal as QSignal
+from PyQt6.QtCore import pyqtSignal as QSignal
 
 # noinspection PyUnresolvedReferences, PyPackageRequirements
-from PyQt5.QtOpenGL import *
+from PyQt6.QtOpenGL import *
 
 from fsgs.option import Option
 
@@ -69,7 +69,8 @@ def init_qt():
     # Should not be necessary with Qt 5.2.x:
     # fix_qt_for_maverick()
 
-    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
+    # FIXME commented out cause couldn't make work with Qt6
+    #QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling)
 
     fsbc.desktop.set_open_url_in_browser_function(open_url_in_browser)
     qapplication = QtBaseApplication(sys.argv)
@@ -126,40 +127,40 @@ def initialize_qt_style(qapplication):
             pa = QPalette()
             # background = QColor("#f6f5f4")
             background = QColor("#eae7e5")
-            pa.setColor(QPalette.Window, background)
-            pa.setColor(QPalette.AlternateBase, background)
-            pa.setColor(QPalette.Button, background)
-            # pa.setColor(QPalette.Base, QColor(255, 255, 255))
+            pa.setColor(QPalette.ColorRole.Window, background)
+            pa.setColor(QPalette.ColorRole.AlternateBase, background)
+            pa.setColor(QPalette.ColorRole.Button, background)
+            # pa.setColor(QPalette.ColorRole.Base, QColor(255, 255, 255))
             pa.setColor(
-                QPalette.Disabled, QPalette.Base, QColor(241, 241, 241)
+                QPalette.ColorGroup.Disabled, QPalette.ColorRole.Base, QColor(241, 241, 241)
             )
 
-            # pa.setColor(QPalette.Window, QColor("#aeaeae"))
-            # pa.setColor(QPalette.AlternateBase, QColor("#aeaeae"))
-            # pa.setColor(QPalette.Button, QColor("#aeaeae"))
+            # pa.setColor(QPalette.ColorRole.Window, QColor("#aeaeae"))
+            # pa.setColor(QPalette.ColorRole.AlternateBase, QColor("#aeaeae"))
+            # pa.setColor(QPalette.ColorRole.Button, QColor("#aeaeae"))
 
             qapplication.setPalette(pa)
         elif fusion_variant == "fws" or fusion_variant == "windows10":
             pa = QPalette()
-            pa.setColor(QPalette.Window, QColor(242, 242, 242))
-            pa.setColor(QPalette.AlternateBase, QColor(242, 242, 242))
-            pa.setColor(QPalette.Button, QColor(242, 242, 242))
+            pa.setColor(QPalette.ColorRole.Window, QColor(242, 242, 242))
+            pa.setColor(QPalette.ColorRole.AlternateBase, QColor(242, 242, 242))
+            pa.setColor(QPalette.ColorRole.Button, QColor(242, 242, 242))
             qapplication.setPalette(pa)
         elif fusion_variant == "dark":
             pa = QPalette()
-            pa.setColor(QPalette.Window, QColor(53, 53, 53))
-            pa.setColor(QPalette.WindowText, Qt.white)
-            pa.setColor(QPalette.Base, QColor(25, 25, 25))
-            pa.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
-            pa.setColor(QPalette.ToolTipBase, Qt.white)
-            pa.setColor(QPalette.ToolTipText, Qt.white)
-            pa.setColor(QPalette.Text, Qt.white)
-            pa.setColor(QPalette.Button, QColor(53, 53, 53))
-            pa.setColor(QPalette.ButtonText, Qt.white)
-            pa.setColor(QPalette.BrightText, Qt.red)
-            pa.setColor(QPalette.Link, QColor(42, 130, 218))
-            pa.setColor(QPalette.Highlight, QColor(42, 130, 218))
-            pa.setColor(QPalette.HighlightedText, Qt.black)
+            pa.setColor(QPalette.ColorRole.Window, QColor(53, 53, 53))
+            pa.setColor(QPalette.ColorRole.WindowText, Qt.GlobalColor.white)
+            pa.setColor(QPalette.ColorRole.Base, QColor(25, 25, 25))
+            pa.setColor(QPalette.ColorRole.AlternateBase, QColor(53, 53, 53))
+            pa.setColor(QPalette.ColorRole.ToolTipBase, Qt.GlobalColor.white)
+            pa.setColor(QPalette.ColorRole.ToolTipText, Qt.GlobalColor.white)
+            pa.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.white)
+            pa.setColor(QPalette.ColorRole.Button, QColor(53, 53, 53))
+            pa.setColor(QPalette.ColorRole.ButtonText, Qt.GlobalColor.white)
+            pa.setColor(QPalette.ColorRole.BrightText, Qt.GlobalColor.red)
+            pa.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
+            pa.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218))
+            pa.setColor(QPalette.ColorRole.HighlightedText, Qt.GlobalColor.black)
             qapplication.setPalette(pa)
             qapplication.setStyleSheet(
                 "QToolTip { color: #ffffff; background-color: #2a82da; "
diff --git a/fsui/qt/scrollarea.py b/fsui/qt/scrollarea.py
index b077819c..4335efd6 100644
--- a/fsui/qt/scrollarea.py
+++ b/fsui/qt/scrollarea.py
@@ -13,8 +13,8 @@ def __init__(self, parent):
 
         self.move(0, 2000)
         # self.setAutoFillBackground(True)
-        self.setFrameShape(QFrame.NoFrame)
-        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+        self.setFrameShape(QFrame.Shape.NoFrame)
+        self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
 
     @property
     def size(self):
diff --git a/fsui/qt/widget.py b/fsui/qt/widget.py
index eeb7716e..3cb5958a 100644
--- a/fsui/qt/widget.py
+++ b/fsui/qt/widget.py
@@ -85,13 +85,14 @@ def is_visible(self):
     def measure_text(self, text):
         font = self.widget().font()
         metrics = QFontMetrics(font)
-        return metrics.width(text), metrics.height()
+        rect = metrics.boundingRect(text)
+        return rect.width(), rect.height()
 
     def set_hand_cursor(self):
-        self.widget().setCursor(Qt.PointingHandCursor)
+        self.widget().setCursor(Qt.CursorShape.PointingHandCursor)
 
     def set_normal_cursor(self):
-        self.widget().setCursor(Qt.ArrowCursor)
+        self.widget().setCursor(Qt.CursorShape.ArrowCursor)
 
     def is_enabled(self):
         return self.widget().isEnabled()
@@ -206,7 +207,7 @@ def on_resize(self):
 
     def get_background_color(self):
         # noinspection PyUnresolvedReferences
-        return Color(self.widget().palette().color(QPalette.Window))
+        return Color(self.widget().palette().color(QPalette.ColorRole.Window))
 
     def set_background_color(self, color):
         widget = self.widget()
diff --git a/fsui/qt/widget_mixin.py b/fsui/qt/widget_mixin.py
index a131560c..1e89f4f7 100644
--- a/fsui/qt/widget_mixin.py
+++ b/fsui/qt/widget_mixin.py
@@ -90,15 +90,16 @@ def measure_text(self, text):
         widget = getattr(self, "_widget", self)
         font = widget.font()
         metrics = QFontMetrics(font)
-        return metrics.width(text), metrics.height()
+        rect = metrics.boundingRect(text)
+        return rect.width(), rect.height()
 
     def set_hand_cursor(self):
         widget = getattr(self, "_widget", self)
-        widget.setCursor(Qt.PointingHandCursor)
+        widget.setCursor(Qt.CursorShape.PointingHandCursor)
 
     def set_normal_cursor(self):
         widget = getattr(self, "_widget", self)
-        widget.setCursor(Qt.ArrowCursor)
+        widget.setCursor(Qt.CursorShape.ArrowCursor)
 
     def is_enabled(self):
         widget = getattr(self, "_widget", self)
@@ -245,7 +246,7 @@ def on_resize(self):
 
     def get_background_color(self):
         # noinspection PyUnresolvedReferences
-        return Color(self.palette().color(QPalette.Window))
+        return Color(self.palette().color(QPalette.ColorRole.Window))
 
     def set_background_color(self, color):
         # noinspection PyUnresolvedReferences
diff --git a/fsui/qt/window.py b/fsui/qt/window.py
index 70f57a1a..7af35d6f 100644
--- a/fsui/qt/window.py
+++ b/fsui/qt/window.py
@@ -4,7 +4,7 @@
 from fsbc.system import macosx
 
 # from fsui import default_window_center, default_window_parent
-from fsui.qt import QMainWindow, QObject, QSignal, QWidget, Qt, QDesktopWidget
+from fsui.qt import QMainWindow, QObject, QSignal, QWidget, Qt, QGuiApplication
 from fsui.qt import QPainter, QPoint, QRect
 from fsui.qt.Image import Image
 from fsui.qt.qt import init_qt, QEvent
@@ -45,27 +45,27 @@ def __init__(
         super().__init__(parent)
         self.margins = Margins()
 
-        flags = Qt.Window
+        flags = Qt.WindowType.Window
         if macosx:
-            flags &= ~Qt.WindowFullscreenButtonHint
+            flags &= ~Qt.WindowType.WindowFullscreenButtonHint
 
         if border:
-            flags |= Qt.CustomizeWindowHint
-            flags |= Qt.WindowCloseButtonHint
-            flags |= Qt.WindowTitleHint
+            flags |= Qt.WindowType.CustomizeWindowHint
+            flags |= Qt.WindowType.WindowCloseButtonHint
+            flags |= Qt.WindowType.WindowTitleHint
             if minimizable:
-                flags |= Qt.WindowMinimizeButtonHint
+                flags |= Qt.WindowType.WindowMinimizeButtonHint
             if maximizable:
-                flags |= Qt.WindowMaximizeButtonHint
+                flags |= Qt.WindowType.WindowMaximizeButtonHint
             # else:
-            #     flags &= ~Qt.WindowMaximizeButtonHint
+            #     flags &= ~Qt.WindowType.WindowMaximizeButtonHint
         else:
-            flags |= Qt.FramelessWindowHint
-            flags |= Qt.NoDropShadowWindowHint
+            flags |= Qt.WindowType.FramelessWindowHint
+            flags |= Qt.WindowType.NoDropShadowWindowHint
             if below:
-                flags |= Qt.WindowStaysOnBottomHint
+                flags |= Qt.WindowType.WindowStaysOnBottomHint
         self.setWindowFlags(flags)
-        # self.setAttribute(Qt.WA_DeleteOnClose, True)
+        # self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
 
         # self._child = weakref.ref(child)
         self._child = child
@@ -144,8 +144,8 @@ def resizeEvent(self, event):
         self.resize_to((size.width(), size.height()))
 
     def changeEvent(self, event):
-        # print(event.type(), QEvent.WindowStateChange)
-        if event.type() == QEvent.WindowStateChange:
+        # print(event.type(), QEvent.Type.WindowStateChange)
+        if event.type() == QEvent.Type.WindowStateChange:
             # print("RealWindow.changeEvent(WindowStateChange)")
             self.child.on_resize()
         QMainWindow.changeEvent(self, event)
@@ -171,10 +171,10 @@ def __on_closed(self):
             traceback.print_exc()
 
     def is_maximized(self):
-        return self.windowState() == Qt.WindowMaximized
+        return self.windowState() == Qt.WindowState.WindowMaximized
 
     def is_fullscreen(self):
-        return self.windowState() == Qt.WindowFullScreen
+        return self.windowState() == Qt.WindowState.WindowFullscreen
 
     def restore_margins(self):
         self.margins.set(0)
@@ -200,7 +200,7 @@ def set_maximized(self, maximize=True, geometry=None):
             )
         else:
             self.restore_margins()
-            self.setWindowState(Qt.WindowNoState)
+            self.setWindowState(Qt.WindowState.WindowNoState)
 
     def set_fullscreen(self, fullscreen=True, geometry=None):
         print("set_fullscreen", fullscreen)
@@ -224,10 +224,10 @@ def set_fullscreen(self, fullscreen=True, geometry=None):
             )
         else:
             self.restore_margins()
-            self.setWindowState(Qt.WindowNoState)
+            self.setWindowState(Qt.WindowState.WindowNoState)
 
     def minimize(self):
-        self.setWindowState(Qt.WindowMinimized)
+        self.setWindowState(Qt.WindowState.WindowMinimized)
 
 
 # noinspection PyProtectedMember
@@ -321,12 +321,12 @@ def __init__(
         # _windows.add(self)
         self.destroyed.connect(self.__destroyed)
 
-        self._real_window.setAttribute(Qt.WA_DeleteOnClose, True)
+        self._real_window.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
 
         # if not border:
-        #     self.setWindowFlags(Qt.FramelessWindowHint |
-        #                         Qt.NoDropShadowWindowHint)
-        #     # self.setWindowFlags(Qt.FramelessWindowHint)
+        #     self.setWindowFlags(Qt.WindowType.FramelessWindowHint |
+        #                         Qt.WindowType.NoDropShadowWindowHint)
+        #     # self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
 
         self.center_on_show = True
         self._centered_on_initial_show = False
@@ -481,7 +481,7 @@ def show(self, maximized=False, center=False, offset=False):
             self._real_window.show()
 
     def is_maximized(self):
-        # return self._real_window.windowState() == Qt.WindowMaximized
+        # return self._real_window.windowState() == Qt.WindowState.WindowMaximized
         return self._real_window.is_maximized()
 
     def is_fullscreen(self):
@@ -503,7 +503,7 @@ def set_maximized(self, maximize=True, geometry=None):
         self._real_window.set_maximized(maximize, geometry)
 
     def minimize(self):
-        # self.setWindowState(Qt.WindowMinimized)
+        # self.setWindowState(Qt.WindowState.WindowMinimized)
         return self._real_window.minimize()
 
     def get_window_center(self):
@@ -542,7 +542,7 @@ def offset_from_parent(self, offset):
 
     def center_on_screen(self):
         frame_rect = self._real_window.frameGeometry()
-        frame_rect.moveCenter(QDesktopWidget().availableGeometry().center())
+        frame_rect.moveCenter(QGuiApplication.primaryScreen().availableGeometry().center())
         self._real_window.move(frame_rect.topLeft())
 
     def set_background_color(self, color):
@@ -633,12 +633,12 @@ def __init__(self, parent, child, below=False):
         # self.layout.add(self.hori_layout, fill=True)
         # self.layout.add(child, fill=True, expand=True)
 
-        # self.setWindowFlags(Qt.FramelessWindowHint)
+        # self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
         from fsui.qt import Qt
 
-        self.setAttribute(Qt.WA_NoSystemBackground)
-        self.setAttribute(Qt.WA_TranslucentBackground)
-        self.setAttribute(Qt.WA_TransparentForMouseEvents)
+        self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
+        self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
+        self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
 
     def restore_margins(self):
         self.margins.set(10)
diff --git a/fsui/qt/windowbase.py b/fsui/qt/windowbase.py
index 2b767d26..10a45fe8 100644
--- a/fsui/qt/windowbase.py
+++ b/fsui/qt/windowbase.py
@@ -1,5 +1,5 @@
 from weakref import ref
-from .qt import Qt, QDesktopWidget, QSignal
+from .qt import Qt, QGuiApplication, QSignal
 
 # from .. import default_window_center, default_window_parent
 
@@ -37,12 +37,12 @@ def __init__(self, parent, *args, title="", border=True, **kwargs):
             self.destroyed.connect(self.__destroyed)
             self.closed.connect(self.__closed)
             self._window = ref(self)
-            self.setAttribute(Qt.WA_DeleteOnClose, True)
+            self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
             if not border:
                 self.setWindowFlags(
-                    Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint
+                    Qt.WindowType.FramelessWindowHint | Qt.WindowType.NoDropShadowWindowHint
                 )
-                # self.setWindowFlags(Qt.FramelessWindowHint)
+                # self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
             self._centered_on_initial_show = False
             if hasattr(self, "accepted"):
                 self.accepted.connect(self.__accepted)
@@ -115,10 +115,10 @@ def maximize(self, maximize=True):
             if maximize:
                 self.showMaximized()
             else:
-                self.setWindowState(Qt.WindowNoState)
+                self.setWindowState(Qt.WindowState.WindowNoState)
 
         def minimize(self):
-            self.setWindowState(Qt.WindowMinimized)
+            self.setWindowState(Qt.WindowState.WindowMinimized)
 
         def get_window_center(self):
             return self.x() + self.width() // 2, self.y() + self.height() // 2
@@ -139,7 +139,7 @@ def center_on_parent(self):
 
         def center_on_screen(self):
             frect = self.frameGeometry()
-            frect.moveCenter(QDesktopWidget().availableGeometry().center())
+            frect.moveCenter(QGuiApplication.primaryScreen().availableGeometry().center())
             self.move(frect.topLeft())
 
         def set_background_color(self, color):
diff --git a/launcher/apps/fs_game_center.py b/launcher/apps/fs_game_center.py
index 95b42deb..66e7bdbb 100644
--- a/launcher/apps/fs_game_center.py
+++ b/launcher/apps/fs_game_center.py
@@ -28,17 +28,17 @@ def http_server_thread():
     window = GameCenterView()
     from fsui.qt import Qt
 
-    # window.setFlags(Qt.FramelessWindowHint)
+    # window.setFlags(Qt.WindowType.FramelessWindowHint)
     window.setFlags(
-        Qt.Window
-        | Qt.FramelessWindowHint
-        | Qt.WindowMinimizeButtonHint
-        | Qt.WindowSystemMenuHint
+        Qt.WindowType.Window
+        | Qt.WindowType.FramelessWindowHint
+        | Qt.WindowType.WindowMinimizeButtonHint
+        | Qt.WindowType.WindowSystemMenuHint
     )
     # window.show()
     window.showMaximized()
     # window.showFullScreen()
-    # window.setWindowState(Qt.WindowFullScreen)
+    # window.setWindowState(Qt.WindowState.WindowFullScreen)
     # window.setVisible(True)
 
     # from fs_uae_launcher.FSUAELauncher import FSUAELauncher
diff --git a/launcher/settings/settings_dialog.py b/launcher/settings/settings_dialog.py
index 044a9334..3c4d663e 100644
--- a/launcher/settings/settings_dialog.py
+++ b/launcher/settings/settings_dialog.py
@@ -43,7 +43,7 @@ def __init__(self, parent, index=0):
         )
 
         # FIXME: remove this once the dialog uses Window as base class
-        # self.setAttribute(Qt.WA_DeleteOnClose, True)
+        # self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
 
         # self.add_page(
         #     # gettext("Appearance"), LanguageSettingsPage,
diff --git a/launcher/ui/skin.py b/launcher/ui/skin.py
index 6b76530f..026bd703 100644
--- a/launcher/ui/skin.py
+++ b/launcher/ui/skin.py
@@ -29,13 +29,13 @@ def __init__(self):
         from fsui.qt import QPalette
 
         palette = QPalette()
-        self.sidebar_list_background = fsui.Color(palette.color(QPalette.Base))
+        self.sidebar_list_background = fsui.Color(palette.color(QPalette.ColorRole.Base))
         self.sidebar_list_row_height = 28
         self.sidebar_list_row_text = fsui.Color(
-            palette.color(QPalette.HighlightedText)
+            palette.color(QPalette.ColorRole.HighlightedText)
         )
         self.sidebar_list_row_background = fsui.Color(
-            palette.color(QPalette.Highlight)
+            palette.color(QPalette.ColorRole.Highlight)
         )
 
         if Skin.fws():
diff --git a/workspace/shell/window.py b/workspace/shell/window.py
index f3f897d8..ad4e3a6d 100644
--- a/workspace/shell/window.py
+++ b/workspace/shell/window.py
@@ -64,14 +64,14 @@ def __init__(self, parent, *, argv, columns=80, rows=24):
         # FIXME: Using Qt directly
         from fsui.qt import Qt, QPainter, QPixmap
 
-        self._widget.setFocusPolicy(Qt.StrongFocus)
+        self._widget.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
 
         painter = QPainter()
         pixmap = QPixmap(100, 100)
         painter.begin(pixmap)
         painter.setFont(self.font.qfont())
         size = painter.boundingRect(
-            0, 0, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, " " * columns
+            0, 0, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, " " * columns
         )
         painter.end()
         print(size)
diff --git a/workspace/ui/label.py b/workspace/ui/label.py
index 022abe3e..6d5f0c18 100644
--- a/workspace/ui/label.py
+++ b/workspace/ui/label.py
@@ -13,11 +13,11 @@ def __init__(self, parent, text="", font=None):
                 font.setPixelSize(int(size[:-2]))
                 weight = weight.lower()
                 if weight == "regular":
-                    font.setWeight(QFont.Normal)
+                    font.setWeight(QFont.Weight.Normal)
                 elif weight == "medium":
-                    font.setWeight(QFont.DemiBold)
+                    font.setWeight(QFont.Weight.DemiBold)
                 elif weight == "bold":
-                    font.setWeight(QFont.Bold)
+                    font.setWeight(QFont.Weight.Bold)
                 else:
                     raise Exception("Unknown weight")
                 font = fsui.Font(font)
diff --git a/workspace/ui/window.py b/workspace/ui/window.py
index 32770b89..479475d9 100644
--- a/workspace/ui/window.py
+++ b/workspace/ui/window.py
@@ -39,12 +39,12 @@ def __init__(self, parent, title, child):
         # self.layout.add(self.hori_layout, fill=True)
         # self.layout.add(child, fill=True, expand=True)
 
-        # self.setWindowFlags(Qt.FramelessWindowHint)
+        # self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
         from fsui.qt import Qt
 
-        self.setAttribute(Qt.WA_NoSystemBackground)
-        self.setAttribute(Qt.WA_TranslucentBackground)
-        self.setAttribute(Qt.WA_TransparentForMouseEvents)
+        self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
+        self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
+        self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
 
     def paintEvent(self, event):
         # noinspection PyNoneFunctionAssignment
