fix: some buttons triggering when releasing mouse outside (#5052)
Examples of buttons fixed with this: Usercard profile picture & split header mod mode button
This commit is contained in:
@@ -261,17 +261,26 @@ void Button::mousePressEvent(QMouseEvent *event)
|
||||
void Button::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!this->enabled_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isInside = this->rect().contains(event->pos());
|
||||
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
this->mouseDown_ = false;
|
||||
|
||||
if (this->rect().contains(event->pos()))
|
||||
if (isInside)
|
||||
{
|
||||
emit leftClicked();
|
||||
}
|
||||
}
|
||||
|
||||
emit clicked(event->button());
|
||||
if (isInside)
|
||||
{
|
||||
emit clicked(event->button());
|
||||
}
|
||||
}
|
||||
|
||||
void Button::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
Reference in New Issue
Block a user