diff --git a/plugins/network/item/applet/accesspointwidget.cpp b/plugins/network/item/applet/accesspointwidget.cpp index a8d50cf7b..09bcfb2eb 100644 --- a/plugins/network/item/applet/accesspointwidget.cpp +++ b/plugins/network/item/applet/accesspointwidget.cpp @@ -35,7 +35,7 @@ AccessPointWidget::AccessPointWidget() : QFrame(nullptr), m_activeState(NetworkDevice::Unknow), - m_ssidBtn(new QPushButton(this)), + m_ssidBtn(new SsidButton(this)), m_disconnectBtn(new DImageButton(this)), m_securityLabel(new QLabel), m_strengthLabel(new QLabel) @@ -89,8 +89,8 @@ AccessPointWidget::AccessPointWidget() // "color:#2ca7f8;" "}"); - connect(m_ssidBtn, &QPushButton::clicked, this, &AccessPointWidget::clicked); - connect(m_ssidBtn, &QPushButton::clicked, this, &AccessPointWidget::ssidClicked); + connect(m_ssidBtn, &SsidButton::clicked, this, &AccessPointWidget::clicked); + connect(m_ssidBtn, &SsidButton::clicked, this, &AccessPointWidget::ssidClicked); connect(m_disconnectBtn, &DImageButton::clicked, this, &AccessPointWidget::disconnectBtnClicked); } diff --git a/plugins/network/item/applet/accesspointwidget.h b/plugins/network/item/applet/accesspointwidget.h index 36fdc9a41..8e4ba17e7 100644 --- a/plugins/network/item/applet/accesspointwidget.h +++ b/plugins/network/item/applet/accesspointwidget.h @@ -32,6 +32,24 @@ #include #include +class SsidButton : public QLabel +{ + Q_OBJECT +public: + SsidButton(QWidget *parent = nullptr) : QLabel(parent){} + virtual ~SsidButton() {} + +signals: + void clicked(); + +protected: + void mouseReleaseEvent(QMouseEvent *event) override { + QLabel::mouseReleaseEvent(event); + + Q_EMIT clicked(); + } +}; + class AccessPointWidget : public QFrame { Q_OBJECT @@ -64,7 +82,7 @@ private slots: dde::network::NetworkDevice::DeviceStatus m_activeState; AccessPoint m_ap; - QPushButton *m_ssidBtn; + SsidButton *m_ssidBtn; Dtk::Widget::DImageButton *m_disconnectBtn; QLabel *m_securityLabel; QLabel *m_strengthLabel;