Commit 33fa0c96 authored by Aaron J. Seigo's avatar Aaron J. Seigo
Browse files

prevent crash when hiding the year boxes more than once

BUG:272077

QSpinBox emits the finished signal when enter is pressed and when
it loses focus. so if you hide it on enter, it then loses focus
and the signal is emitted again. even if the value hasn't changed
and no editing was done (not even returned from the previous signal
emission). moderately lame.
parent 03337bf8
......@@ -450,6 +450,10 @@ void Calendar::goToWeek(int newWeek)
void Calendar::showYearSpinBox()
{
QGraphicsLinearLayout *hLayout = (QGraphicsLinearLayout*)d->year->parentLayoutItem();
if (!hLayout) {
// already hidden!
return;
}
d->year->hide();
hLayout->removeItem(d->year);
......@@ -464,6 +468,11 @@ void Calendar::showYearSpinBox()
void Calendar::hideYearSpinBox()
{
QGraphicsLinearLayout *hLayout = (QGraphicsLinearLayout*)d->yearSpinBox->parentLayoutItem();
if (!hLayout) {
// already hidden!
return;
}
hLayout->removeItem(d->yearSpinBox);
hLayout->insertItem(s_yearWidgetIndex, d->year);
d->yearSpinBox->hide();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment