Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
fb905b6e
Commit
fb905b6e
authored
Nov 02, 2012
by
Lorenz Meier
Browse files
Merge pull request #189 from Susurrus/joyStickButtons2
Added an 11th joystick button to the joystick widget
parents
d8bf2254
5e0c5f4c
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
src/ui/JoystickWidget.cc
View file @
fb905b6e
...
...
@@ -7,6 +7,7 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) :
m_ui
(
new
Ui
::
JoystickWidget
)
{
m_ui
->
setupUi
(
this
);
clearKeys
();
this
->
joystick
=
joystick
;
m_ui
->
rollMapSpinBox
->
setValue
(
joystick
->
getMappingXAxis
());
...
...
@@ -87,55 +88,59 @@ void JoystickWidget::clearKeys()
{
QString
colorstyle
;
QColor
buttonStyleColor
=
QColor
(
200
,
20
,
20
);
colorstyle
=
QString
(
"QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}"
).
arg
(
buttonStyleColor
.
name
());
m_ui
->
buttonLabel0
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel1
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel2
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel3
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel4
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel5
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel6
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel7
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel8
->
setStyleSheet
(
colorstyle
);
m_ui
->
buttonLabel9
->
setStyleSheet
(
colorstyle
);
colorstyle
=
QString
(
"QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}"
).
arg
(
buttonStyleColor
.
name
());
m_ui
->
button0
->
setStyleSheet
(
colorstyle
);
m_ui
->
button1
->
setStyleSheet
(
colorstyle
);
m_ui
->
button2
->
setStyleSheet
(
colorstyle
);
m_ui
->
button3
->
setStyleSheet
(
colorstyle
);
m_ui
->
button4
->
setStyleSheet
(
colorstyle
);
m_ui
->
button5
->
setStyleSheet
(
colorstyle
);
m_ui
->
button6
->
setStyleSheet
(
colorstyle
);
m_ui
->
button7
->
setStyleSheet
(
colorstyle
);
m_ui
->
button8
->
setStyleSheet
(
colorstyle
);
m_ui
->
button9
->
setStyleSheet
(
colorstyle
);
m_ui
->
button10
->
setStyleSheet
(
colorstyle
);
}
void
JoystickWidget
::
pressKey
(
int
key
)
{
QString
colorstyle
;
QColor
buttonStyleColor
=
QColor
(
20
,
200
,
20
);
colorstyle
=
QString
(
"Q
GroupBox
{ border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}"
).
arg
(
buttonStyleColor
.
name
());
colorstyle
=
QString
(
"Q
Label
{ border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}"
).
arg
(
buttonStyleColor
.
name
());
switch
(
key
)
{
case
0
:
m_ui
->
button
Label
0
->
setStyleSheet
(
colorstyle
);
m_ui
->
button0
->
setStyleSheet
(
colorstyle
);
break
;
case
1
:
m_ui
->
button
Label
1
->
setStyleSheet
(
colorstyle
);
m_ui
->
button1
->
setStyleSheet
(
colorstyle
);
break
;
case
2
:
m_ui
->
button
Label
2
->
setStyleSheet
(
colorstyle
);
m_ui
->
button2
->
setStyleSheet
(
colorstyle
);
break
;
case
3
:
m_ui
->
button
Label
3
->
setStyleSheet
(
colorstyle
);
m_ui
->
button3
->
setStyleSheet
(
colorstyle
);
break
;
case
4
:
m_ui
->
button
Label
4
->
setStyleSheet
(
colorstyle
);
m_ui
->
button4
->
setStyleSheet
(
colorstyle
);
break
;
case
5
:
m_ui
->
button
Label
5
->
setStyleSheet
(
colorstyle
);
m_ui
->
button5
->
setStyleSheet
(
colorstyle
);
break
;
case
6
:
m_ui
->
button
Label
6
->
setStyleSheet
(
colorstyle
);
m_ui
->
button6
->
setStyleSheet
(
colorstyle
);
break
;
case
7
:
m_ui
->
button
Label
7
->
setStyleSheet
(
colorstyle
);
m_ui
->
button7
->
setStyleSheet
(
colorstyle
);
break
;
case
8
:
m_ui
->
button
Label
8
->
setStyleSheet
(
colorstyle
);
m_ui
->
button8
->
setStyleSheet
(
colorstyle
);
break
;
case
9
:
m_ui
->
buttonLabel9
->
setStyleSheet
(
colorstyle
);
m_ui
->
button9
->
setStyleSheet
(
colorstyle
);
break
;
case
10
:
m_ui
->
button10
->
setStyleSheet
(
colorstyle
);
break
;
}
QTimer
::
singleShot
(
20
,
this
,
SLOT
(
clearKeys
()));
...
...
src/ui/JoystickWidget.ui
View file @
fb905b6e
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment