mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Threadsafety
Now completly working on all platforms
This commit is contained in:
@@ -200,4 +200,10 @@ void HotTestWidget::on_threadEnableCheckBox_clicked()
|
||||
|
||||
this->hotkey_4->moveToThread(this->thread4);
|
||||
this->hotkey_5->moveToThread(this->thread5);
|
||||
|
||||
QApplication::processEvents();
|
||||
Q_ASSERT(this->hotkey_4->thread() == this->thread4);
|
||||
Q_ASSERT(this->hotkey_5->thread() == this->thread5);
|
||||
|
||||
this->ui->tabWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
@@ -927,7 +927,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Use this test to determine whether shortcuts on multiple threads are supported or not. Internally, the backend of the QHotkey class is <span style=" font-weight:600;">threadsafe</span>, and thus QHotkey is reentrant and can be used on any thread. However, some operating systems might not support creating hotkeys from different threads. </p><p>To enable threading, check the box below and return to the playground. <span style=" font-style:italic;">Hotkey 4 and 5</span> will now each run on their own thread. </p></body></html></string>
|
||||
<string><html><head/><body><p>This test was designed to try out multi-threaded shortcuts. The QHotkey class is completly <span style=" font-weight:600;">threadsafe</span>, but this test can help to see if it acutally works (It does).</p><p>If activated, <span style=" font-style:italic;">Hotkey 4 and Hotkey 5 </span>of the Playground will each run on their own thread. This means:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Mainthread:</span> Hotkey 1, 2, 3</li><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Second thread:</span> Hotkey 4</li><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Third thread:</span> Hotkey 5</li></ul><p><span style=" font-weight:600;">Note:</span> The two hotkeys will be moved to the threads. For simplicity-reasons, you can't move them back in this test (But its possible, just not done here). Restart the test to get them back.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
@@ -950,26 +950,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>
|
||||
<b>Results so far:</b></br>
|
||||
<ul>
|
||||
<li><u>Windows:</u> Registering on multiple threads is possible, but: The thread that registered must unregister too and events will be send to the thread registered from, not the main thread.</li>
|
||||
<li><u>Mac:</u> Works fine.</li>
|
||||
<li><u>Linux:</u> Works fine.</li>
|
||||
</ul><br/>
|
||||
</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user