diff --git a/widgets/checkbox.cpp b/widgets/checkbox.cpp index 926bb97bd..af606e3d9 100644 --- a/widgets/checkbox.cpp +++ b/widgets/checkbox.cpp @@ -192,8 +192,12 @@ void CheckBox::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) d->state = Qt::Checked; } } + update(); - emit clicked(); + + if (sceneBoundingRect().contains(event->scenePos())) { + emit clicked(); + } } diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index fea9e6332..122279cbb 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -255,11 +255,14 @@ void PushButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) event->accept(); if (d->state == Private::Pressed) { d->state = Private::Released; - emit clicked(); - if (d->checkable) { - d->checked = ! d->checked; - emit toggled(d->checked); + if (sceneBoundingRect().contains(event->scenePos())) { + emit clicked(); + + if (d->checkable) { + d->checked = ! d->checked; + emit toggled(d->checked); + } } } update(); diff --git a/widgets/radiobutton.cpp b/widgets/radiobutton.cpp index 640ab3f33..8063ec727 100644 --- a/widgets/radiobutton.cpp +++ b/widgets/radiobutton.cpp @@ -123,9 +123,9 @@ void RadioButton::setChecked(bool checked) } } } - // If not, we should be on a scene, not flying anywhere else if (checked && !parentItem() && scene()) { + // we should be on a scene, not flying anywhere foreach(QGraphicsItem *sibling, scene()->items()) { siblingRadioButton = dynamic_cast(sibling); @@ -173,10 +173,13 @@ void RadioButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { event->accept(); d->mouseDown = false; - setChecked(true); - update(); - emit clicked(); + if (sceneBoundingRect().contains(event->scenePos())) { + setChecked(true); + emit clicked(); + } + + update(); } void RadioButton::mouseMoveEvent(QGraphicsSceneMouseEvent *event)