解决滑动问题

This commit is contained in:
jzxc95 2023-04-07 16:34:09 +08:00
parent 7e19f3e51d
commit b500b1679b
2 changed files with 11 additions and 3 deletions

View File

@ -179,14 +179,21 @@ void ListItem::showDesktopNotify(const QString &message, QString soundName)
void ListItem::mousePressEvent(QMouseEvent *event) void ListItem::mousePressEvent(QMouseEvent *event)
{ {
qDebug()<<"[ListItem]"<<"mousePressEvent"; qDebug()<<"[ListItem]"<<"mousePressEvent";
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::RightButton) {
onNetButtonClicked();
} else if (event->button() == Qt::RightButton) {
onRightButtonClicked(); onRightButtonClicked();
} }
return QFrame::mousePressEvent(event); return QFrame::mousePressEvent(event);
} }
void ListItem::mouseReleaseEvent(QMouseEvent *event)
{
qDebug()<<"[ListItem]"<<"mouseReleaseEvent";
if (event->button() == Qt::LeftButton) {
onNetButtonClicked();
}
return QFrame::mouseReleaseEvent(event);
}
void ListItem::enterEvent(QEvent *event) void ListItem::enterEvent(QEvent *event)
{ {
// QPalette pal = qApp->palette(); // QPalette pal = qApp->palette();

View File

@ -98,6 +98,7 @@ public:
protected: protected:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void enterEvent(QEvent *event); void enterEvent(QEvent *event);
void leaveEvent(QEvent *event); void leaveEvent(QEvent *event);
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);