implement joystick item switching

This commit is contained in:
2022-02-02 13:36:30 +01:00
parent 00bfa72455
commit 7a61dc9368
8 changed files with 61 additions and 41 deletions

View File

@ -38,16 +38,6 @@ void ItemScrollBox::addItem(std::weak_ptr<Item> item)
widgets_.back()->setShortcuts(QKeySequence(Qt::Key_R), QKeySequence(Qt::Key_F), QKeySequence(Qt::Key_V));
else if(train->getTrainId() == 4)
widgets_.back()->setShortcuts(QKeySequence(Qt::Key_T), QKeySequence(Qt::Key_G), QKeySequence(Qt::Key_B));
std::vector<std::shared_ptr<TrainJs>> joysticks = TrainJs::getJsDevices();
for(auto joystick: joysticks)
{
if(!joystick->itemIsSet())
{
joystick->setItem(item);
break;
}
}
}
else if(turnout)
{

View File

@ -23,7 +23,6 @@ private:
signals:
void deleteRequest(const ItemData& item);
public:
explicit ItemScrollBox(QWidget *parent = nullptr);
~ItemScrollBox();

View File

@ -73,7 +73,6 @@ void ItemWidget::deleteItem()
void ItemWidget::setValue(int8_t value)
{
moveToValue(value);
if(auto workingItem = item_.lock())
workingItem->setValue(value);
else