diff --git a/core/src/toolmenumanager.cpp b/core/src/toolmenumanager.cpp index bcf3d6f6db..e2d554bcc1 100644 --- a/core/src/toolmenumanager.cpp +++ b/core/src/toolmenumanager.cpp @@ -301,6 +301,7 @@ MenuSectionCollapseWidget *ToolMenuManager::createMenuSectionItem(const DeviceIn if(collapseHeader) { initHeaderWidget(type, collapseHeader, dInfo); Style::setStyle(collapseHeader, style::properties::widget::bottomBorder); + Style::setStyle(collapseHeader, style::properties::widget::deviceHeaderWidget, "idle"); } section->setCollapsed(false); section->hide(); @@ -326,6 +327,7 @@ void ToolMenuManager::initToolMenuHeaderWidget(MenuCollapseHeader *header, const { bool isConnected = m_connectedDev.contains(dInfo.id); ToolMenuHeaderWidget *thw = dynamic_cast(header->headerWidget()); + QButtonGroup *menuBtnGroup = m_toolMenu->btnGroup(); if(!thw) { return; } @@ -335,7 +337,15 @@ void ToolMenuManager::initToolMenuHeaderWidget(MenuCollapseHeader *header, const thw->layout()->setContentsMargins(Style::getDimension(json::global::unit_1), 0, 0, 0); Style::setStyle(header, style::properties::widget::ledBorder, isConnected); - connect(thw->deviceBtn(), &QPushButton::pressed, this, [this, dInfo]() { Q_EMIT requestDevicePage(dInfo.id); }); + menuBtnGroup->addButton(thw->deviceBtn()); + connect(thw->deviceBtn(), &QPushButton::toggled, this, [=](bool en) { + if(en) { + Style::setStyle(header, style::properties::widget::deviceHeaderWidget, "selected"); + Q_EMIT requestDevicePage(dInfo.id); + } else { + Style::setStyle(header, style::properties::widget::deviceHeaderWidget, "idle"); + } + }); connect(this, &ToolMenuManager::connState, thw, &ToolMenuHeaderWidget::connState); } diff --git a/gui/src/widgets/toolmenuheaderwidget.cpp b/gui/src/widgets/toolmenuheaderwidget.cpp index 37c8b8b7e3..bde8fb3818 100644 --- a/gui/src/widgets/toolmenuheaderwidget.cpp +++ b/gui/src/widgets/toolmenuheaderwidget.cpp @@ -33,6 +33,7 @@ ToolMenuHeaderWidget::ToolMenuHeaderWidget(QString title, QWidget *parent) hLay->setSpacing(10); m_deviceBtn = new QPushButton(this); + m_deviceBtn->setCheckable(true); QWidget *titleWidget = new QWidget(this); QVBoxLayout *titleLay = new QVBoxLayout(titleWidget);