1+ from __future__ import annotations
2+
13from typing import TYPE_CHECKING
24
35from qtpy .QtCore import Qt
6+ from qtpy .QtWidgets import QAction , QApplication
47
58from app_model .backends .qt import QModelMainWindow , QModelToolBar
9+ from app_model .types ._action import Action
610
711if TYPE_CHECKING :
12+ from pytestqt .qtbot import QtBot
13+
814 from ..conftest import FullApp # noqa: TID252
915
1016
11- def test_qmodel_main_window (qtbot , full_app : "FullApp" ) -> None :
17+ def test_qmodel_main_window (
18+ qtbot : QtBot , qapp : QApplication , full_app : FullApp
19+ ) -> None :
1220 win = QModelMainWindow (full_app )
1321 qtbot .addWidget (win )
1422
@@ -27,3 +35,16 @@ def test_qmodel_main_window(qtbot, full_app: "FullApp") -> None:
2735 )
2836 assert isinstance (tb , QModelToolBar )
2937 win .addModelToolBar (full_app .Menus .EDIT , area = Qt .ToolBarArea .RightToolBarArea )
38+
39+ full_app .register_action (
40+ Action (
41+ id = "late-action" ,
42+ title = "Late Action" ,
43+ keybindings = [{"primary" : "Shift+L" }],
44+ menus = [{"id" : full_app .Menus .FILE }],
45+ callback = lambda : None ,
46+ )
47+ )
48+
49+ action = qapp .findChild (QAction , "late-action" )
50+ assert action .shortcut ().toString () == "Shift+L"
0 commit comments