don't do adjustScrollbars more than every 200 msecs
resolves some cyclical relayout crashes and surprisingly enough also some layout estetic problems BUG:202890 svn path=/trunk/KDE/kdelibs/; revision=1062764
This commit is contained in:
parent
2165a85a9f
commit
4b8b780829
@ -162,6 +162,8 @@ public:
|
|||||||
widgetSize.setHeight(scrollingWidget->size().height()-borderSize);
|
widgetSize.setHeight(scrollingWidget->size().height()-borderSize);
|
||||||
}
|
}
|
||||||
widget.data()->resize(widgetSize);
|
widget.data()->resize(widgetSize);
|
||||||
|
|
||||||
|
adjustClipping();
|
||||||
}
|
}
|
||||||
|
|
||||||
void verticalScroll(int value)
|
void verticalScroll(int value)
|
||||||
@ -270,6 +272,7 @@ public:
|
|||||||
QSet<QGraphicsWidget *>dragHandles;
|
QSet<QGraphicsWidget *>dragHandles;
|
||||||
bool dragging;
|
bool dragging;
|
||||||
int animId;
|
int animId;
|
||||||
|
QTimer *adjustScrollbarsTimer;
|
||||||
static const int borderSize = 4;
|
static const int borderSize = 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -287,6 +290,10 @@ ScrollWidget::ScrollWidget(QGraphicsWidget *parent)
|
|||||||
d->borderSvg = new Plasma::Svg(this);
|
d->borderSvg = new Plasma::Svg(this);
|
||||||
d->borderSvg->setImagePath("widgets/scrollwidget");
|
d->borderSvg->setImagePath("widgets/scrollwidget");
|
||||||
|
|
||||||
|
d->adjustScrollbarsTimer = new QTimer(this);
|
||||||
|
d->adjustScrollbarsTimer->setSingleShot(true);
|
||||||
|
connect(d->adjustScrollbarsTimer, SIGNAL(timeout()), this, SLOT(adjustScrollbars()));
|
||||||
|
|
||||||
d->verticalScrollBarPolicy = Qt::ScrollBarAsNeeded;
|
d->verticalScrollBarPolicy = Qt::ScrollBarAsNeeded;
|
||||||
d->verticalScrollBar = new Plasma::ScrollBar(this);
|
d->verticalScrollBar = new Plasma::ScrollBar(this);
|
||||||
d->verticalScrollBar->setFocusPolicy(Qt::NoFocus);
|
d->verticalScrollBar->setFocusPolicy(Qt::NoFocus);
|
||||||
@ -326,7 +333,7 @@ void ScrollWidget::setWidget(QGraphicsWidget *widget)
|
|||||||
widget->setParentItem(d->scrollingWidget);
|
widget->setParentItem(d->scrollingWidget);
|
||||||
widget->setPos(QPoint(0,0));
|
widget->setPos(QPoint(0,0));
|
||||||
widget->installEventFilter(this);
|
widget->installEventFilter(this);
|
||||||
d->adjustScrollbars();
|
d->adjustScrollbarsTimer->start(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,9 +485,7 @@ void ScrollWidget::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->adjustScrollbars();
|
d->adjustScrollbarsTimer->start(200);
|
||||||
|
|
||||||
d->adjustClipping();
|
|
||||||
|
|
||||||
//if topBorder exists bottomBorder too
|
//if topBorder exists bottomBorder too
|
||||||
if (d->topBorder) {
|
if (d->topBorder) {
|
||||||
@ -541,10 +546,7 @@ bool ScrollWidget::eventFilter(QObject *watched, QEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (watched == d->widget.data() && event->type() == QEvent::GraphicsSceneResize) {
|
if (watched == d->widget.data() && event->type() == QEvent::GraphicsSceneResize) {
|
||||||
d->adjustScrollbars();
|
d->adjustScrollbarsTimer->start(200);
|
||||||
d->adjustClipping();
|
|
||||||
//force to refresh the size hint
|
|
||||||
layout()->invalidate();
|
|
||||||
} else if (watched == d->widget.data() && event->type() == QEvent::GraphicsSceneMove) {
|
} else if (watched == d->widget.data() && event->type() == QEvent::GraphicsSceneMove) {
|
||||||
d->horizontalScrollBar->blockSignals(true);
|
d->horizontalScrollBar->blockSignals(true);
|
||||||
d->verticalScrollBar->blockSignals(true);
|
d->verticalScrollBar->blockSignals(true);
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
* @arg parent the parent of this widget
|
* @arg parent the parent of this widget
|
||||||
*/
|
*/
|
||||||
explicit ScrollWidget(QGraphicsWidget *parent = 0);
|
explicit ScrollWidget(QGraphicsWidget *parent = 0);
|
||||||
|
explicit ScrollWidget(QGraphicsItem *parent = 0);
|
||||||
~ScrollWidget();
|
~ScrollWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +201,7 @@ private:
|
|||||||
Q_PRIVATE_SLOT(d, void makeRectVisible())
|
Q_PRIVATE_SLOT(d, void makeRectVisible())
|
||||||
Q_PRIVATE_SLOT(d, void makeItemVisible())
|
Q_PRIVATE_SLOT(d, void makeItemVisible())
|
||||||
Q_PRIVATE_SLOT(d, void cleanupDragHandles(QObject *destroyed))
|
Q_PRIVATE_SLOT(d, void cleanupDragHandles(QObject *destroyed))
|
||||||
|
Q_PRIVATE_SLOT(d, void adjustScrollbars())
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
Loading…
x
Reference in New Issue
Block a user