Commit 5e0c5f4c authored by Bryant's avatar Bryant

Replaced joystick buttons UI with QLabels.

Added an 11th button display.
parent 8d0f9620
...@@ -7,6 +7,7 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) : ...@@ -7,6 +7,7 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) :
m_ui(new Ui::JoystickWidget) m_ui(new Ui::JoystickWidget)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
clearKeys();
this->joystick = joystick; this->joystick = joystick;
m_ui->rollMapSpinBox->setValue(joystick->getMappingXAxis()); m_ui->rollMapSpinBox->setValue(joystick->getMappingXAxis());
...@@ -87,55 +88,59 @@ void JoystickWidget::clearKeys() ...@@ -87,55 +88,59 @@ void JoystickWidget::clearKeys()
{ {
QString colorstyle; QString colorstyle;
QColor buttonStyleColor = QColor(200, 20, 20); 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()); colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name());
m_ui->buttonLabel0->setStyleSheet(colorstyle); m_ui->button0->setStyleSheet(colorstyle);
m_ui->buttonLabel1->setStyleSheet(colorstyle); m_ui->button1->setStyleSheet(colorstyle);
m_ui->buttonLabel2->setStyleSheet(colorstyle); m_ui->button2->setStyleSheet(colorstyle);
m_ui->buttonLabel3->setStyleSheet(colorstyle); m_ui->button3->setStyleSheet(colorstyle);
m_ui->buttonLabel4->setStyleSheet(colorstyle); m_ui->button4->setStyleSheet(colorstyle);
m_ui->buttonLabel5->setStyleSheet(colorstyle); m_ui->button5->setStyleSheet(colorstyle);
m_ui->buttonLabel6->setStyleSheet(colorstyle); m_ui->button6->setStyleSheet(colorstyle);
m_ui->buttonLabel7->setStyleSheet(colorstyle); m_ui->button7->setStyleSheet(colorstyle);
m_ui->buttonLabel8->setStyleSheet(colorstyle); m_ui->button8->setStyleSheet(colorstyle);
m_ui->buttonLabel9->setStyleSheet(colorstyle); m_ui->button9->setStyleSheet(colorstyle);
m_ui->button10->setStyleSheet(colorstyle);
} }
void JoystickWidget::pressKey(int key) void JoystickWidget::pressKey(int key)
{ {
QString colorstyle; QString colorstyle;
QColor buttonStyleColor = QColor(20, 200, 20); QColor buttonStyleColor = QColor(20, 200, 20);
colorstyle = QString("QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name());
switch(key) { switch(key) {
case 0: case 0:
m_ui->buttonLabel0->setStyleSheet(colorstyle); m_ui->button0->setStyleSheet(colorstyle);
break; break;
case 1: case 1:
m_ui->buttonLabel1->setStyleSheet(colorstyle); m_ui->button1->setStyleSheet(colorstyle);
break; break;
case 2: case 2:
m_ui->buttonLabel2->setStyleSheet(colorstyle); m_ui->button2->setStyleSheet(colorstyle);
break; break;
case 3: case 3:
m_ui->buttonLabel3->setStyleSheet(colorstyle); m_ui->button3->setStyleSheet(colorstyle);
break; break;
case 4: case 4:
m_ui->buttonLabel4->setStyleSheet(colorstyle); m_ui->button4->setStyleSheet(colorstyle);
break; break;
case 5: case 5:
m_ui->buttonLabel5->setStyleSheet(colorstyle); m_ui->button5->setStyleSheet(colorstyle);
break; break;
case 6: case 6:
m_ui->buttonLabel6->setStyleSheet(colorstyle); m_ui->button6->setStyleSheet(colorstyle);
break; break;
case 7: case 7:
m_ui->buttonLabel7->setStyleSheet(colorstyle); m_ui->button7->setStyleSheet(colorstyle);
break; break;
case 8: case 8:
m_ui->buttonLabel8->setStyleSheet(colorstyle); m_ui->button8->setStyleSheet(colorstyle);
break; break;
case 9: case 9:
m_ui->buttonLabel9->setStyleSheet(colorstyle); m_ui->button9->setStyleSheet(colorstyle);
break;
case 10:
m_ui->button10->setStyleSheet(colorstyle);
break; break;
} }
QTimer::singleShot(20, this, SLOT(clearKeys())); QTimer::singleShot(20, this, SLOT(clearKeys()));
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment