MCPcopy Create free account
hub / github.com/Skycoder42/QHotkey / HotTestWidget

Method HotTestWidget

HotkeyTest/hottestwidget.cpp:6–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4//#define TEST_MAPPING
5
6HotTestWidget::HotTestWidget(QWidget *parent) :
7 QWidget(parent),
8 ui(new Ui::HotTestWidget),
9 hotkey_1(new QHotkey(this)),
10 hotkey_2(new QHotkey(this)),
11 hotkey_3(new QHotkey(this)),
12 hotkey_4(new QHotkey(NULL)),
13 hotkey_5(new QHotkey(NULL)),
14 thread4(new QThread(this)),
15 thread5(new QThread(this)),
16 testHotkeys(),
17 nativeHotkey(new QHotkey(this))
18{
19 ui->setupUi(this);
20 this->thread4->start();
21 this->thread5->start();
22
23#ifdef TEST_MAPPING
24 //shortcut mapping override
25 QHotkey::addGlobalMapping(QKeySequence("X"), QHotkey::NativeShortcut());// add invalid mapping to test if the overwrite works for all platforms
26#endif
27
28 //1
29 connect(this->ui->hotkeyCheckbox_1, &QCheckBox::toggled,
30 this->hotkey_1, &QHotkey::setRegistered);
31 connect(this->ui->hotkeySequenceEdit_1, &QKeySequenceEdit::keySequenceChanged,
32 this, &HotTestWidget::setShortcut_1);
33 connect(this->hotkey_1, &QHotkey::activated,
34 this, &HotTestWidget::increase_1);
35
36 //2
37 connect(this->ui->hotkeyCheckbox_2, &QCheckBox::toggled,
38 this->hotkey_2, &QHotkey::setRegistered);
39 connect(this->ui->hotkeySequenceEdit_2, &QKeySequenceEdit::keySequenceChanged,
40 this, &HotTestWidget::setShortcut_2);
41 connect(this->hotkey_2, &QHotkey::activated,
42 this, &HotTestWidget::increase_2);
43
44 //3
45 connect(this->ui->hotkeyCheckbox_3, &QCheckBox::toggled,
46 this->hotkey_3, &QHotkey::setRegistered);
47 connect(this->ui->hotkeySequenceEdit_3, &QKeySequenceEdit::keySequenceChanged,
48 this, &HotTestWidget::setShortcut_3);
49 connect(this->hotkey_3, &QHotkey::activated,
50 this, &HotTestWidget::increase_3);
51
52 //4
53 connect(this->ui->hotkeyCheckbox_4, &QCheckBox::toggled,
54 this->hotkey_4, &QHotkey::setRegistered);
55 connect(this->ui->hotkeySequenceEdit_4, &QKeySequenceEdit::keySequenceChanged,
56 this, &HotTestWidget::setShortcut_4);
57 connect(this->hotkey_4, &QHotkey::activated,
58 this, &HotTestWidget::increase_4);
59
60 //5
61 connect(this->ui->hotkeyCheckbox_5, &QCheckBox::toggled,
62 this->hotkey_5, &QHotkey::setRegistered);
63 connect(this->ui->hotkeySequenceEdit_5, &QKeySequenceEdit::keySequenceChanged,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected