Открыть боковую панель
МОС
Исходные коды
devel
smartcar
Коммиты
952e755d
Коммит
952e755d
создал
Июн 09, 2025
по автору
Коул Милена Ричардовна
Просмотр файлов
add hot keys
владелец
5d8a2d61
Изменения
3
Скрыть пробелы
Построчно
Рядом
forms/bluetoothmode.cpp
Просмотр файла @
952e755d
...
...
@@ -5,6 +5,7 @@
#include
<QDesktopServices>
#include
<QCoreApplication>
#include
<QUrl>
#include
<QKeyEvent>
BluetoothMode
::
BluetoothMode
(
Vench
*
vench
,
QWidget
*
parent
)
:
QWidget
(
parent
),
...
...
@@ -12,6 +13,7 @@ BluetoothMode::BluetoothMode(Vench *vench, QWidget *parent) :
{
ui
->
setupUi
(
this
);
setFocusPolicy
(
Qt
::
StrongFocus
);
m_vench
=
vench
;
fl_rec
=
false
;
fl_play
=
false
;
...
...
@@ -41,6 +43,55 @@ BluetoothMode::BluetoothMode(Vench *vench, QWidget *parent) :
connect
(
ui
->
BRec
,
&
QPushButton
::
clicked
,
this
,
&
BluetoothMode
::
RecClicked
);
connect
(
ui
->
BPlay
,
&
QPushButton
::
clicked
,
this
,
&
BluetoothMode
::
PlayClicked
);
connect
(
m_vench
,
&
Vench
::
playDone
,
this
,
&
BluetoothMode
::
PlayClicked
);
}
void
BluetoothMode
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
event
->
isAutoRepeat
())
return
;
switch
(
event
->
key
())
{
case
Qt
::
Key_W
:
m_vench
->
on_BUp_B_pressed
();
break
;
case
Qt
::
Key_A
:
m_vench
->
on_BLeft_B_pressed
();
break
;
case
Qt
::
Key_S
:
m_vench
->
on_BDown_B_pressed
();
break
;
case
Qt
::
Key_D
:
m_vench
->
on_BRight_B_pressed
();
break
;
case
Qt
::
Key_B
:
m_vench
->
on_BBip_B_clicked
();
break
;
case
Qt
::
Key_L
:
m_vench
->
on_BLight_B_clicked
();
break
;
case
Qt
::
Key_Space
:
m_vench
->
on_BStop_B_clicked
();
break
;
case
Qt
::
Key_R
:
RecClicked
();
break
;
case
Qt
::
Key_P
:
PlayClicked
();
break
;
default:
QWidget
::
keyPressEvent
(
event
);
}
}
void
BluetoothMode
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
if
(
event
->
isAutoRepeat
())
return
;
int
key
=
event
->
key
();
if
(
key
==
Qt
::
Key_W
||
key
==
Qt
::
Key_A
||
key
==
Qt
::
Key_S
||
key
==
Qt
::
Key_D
)
m_vench
->
on_BStop_B_clicked
();
}
void
BluetoothMode
::
RuchnCommClicked
()
...
...
forms/bluetoothmode.h
Просмотр файла @
952e755d
...
...
@@ -16,6 +16,10 @@ public:
explicit
BluetoothMode
(
Vench
*
vench
,
QWidget
*
parent
=
nullptr
);
~
BluetoothMode
();
protected:
void
keyPressEvent
(
QKeyEvent
*
event
)
override
;
void
keyReleaseEvent
(
QKeyEvent
*
event
)
override
;
protected
slots
:
void
RuchnCommClicked
();
void
RecClicked
();
...
...
vench.cpp
Просмотр файла @
952e755d
...
...
@@ -148,9 +148,9 @@ void Vench::SendProgramCommand()
#ifdef PRINT_DEBUG
qDebug
(
"m3 =%d
\n
"
,
com
);
#endif
DoCommand
(
Stop
);
if
(
fl_play
)
{
DoCommand
(
Stop
);
mSleep
(
500
);
DoCommand
(
CommandsCode
.
key
(
com
,
None
));
QTimer
::
singleShot
(
500
,
this
,
SLOT
(
SendProgramCommand
()));
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать