don't change our state unless the mouse was release inside of the widget

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=735135
This commit is contained in:
Aaron J. Seigo 2007-11-10 23:58:17 +00:00
parent 2089854d5e
commit a61562ad95
3 changed files with 19 additions and 9 deletions

View File

@ -192,8 +192,12 @@ void CheckBox::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
d->state = Qt::Checked;
}
}
update();
emit clicked();
if (sceneBoundingRect().contains(event->scenePos())) {
emit clicked();
}
}

View File

@ -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();

View File

@ -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<RadioButton*>(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)