delay only in the case the item to be visible is a qgraphicswidget, so we can guard the temp pointer with a weak one
BUG:219475 svn path=/trunk/KDE/kdelibs/; revision=1064800
This commit is contained in:
parent
3a27e22612
commit
923d772a85
@ -268,7 +268,7 @@ public:
|
||||
(widget.data()->pos() + delta).toPoint());
|
||||
}
|
||||
|
||||
void makeItemVisible()
|
||||
void makeItemVisible(QGraphicsItem *itemToBeVisible)
|
||||
{
|
||||
if (!widget) {
|
||||
return;
|
||||
@ -280,6 +280,13 @@ public:
|
||||
makeRectVisible();
|
||||
}
|
||||
|
||||
void makeItemVisible()
|
||||
{
|
||||
if (widgetToBeVisible) {
|
||||
makeItemVisible(widgetToBeVisible.data());
|
||||
}
|
||||
}
|
||||
|
||||
void cleanupDragHandles(QObject *destroyed)
|
||||
{
|
||||
dragHandles.remove(static_cast<QGraphicsWidget *>(destroyed));
|
||||
@ -307,7 +314,7 @@ public:
|
||||
ScrollBar *horizontalScrollBar;
|
||||
Qt::ScrollBarPolicy horizontalScrollBarPolicy;
|
||||
QString styleSheet;
|
||||
QGraphicsItem *itemToBeVisible;
|
||||
QWeakPointer<QGraphicsWidget> widgetToBeVisible;
|
||||
QRectF rectToBeVisible;
|
||||
QPointF dragHandleClicked;
|
||||
QSet<QGraphicsWidget *>dragHandles;
|
||||
@ -415,10 +422,16 @@ void ScrollWidget::ensureItemVisible(QGraphicsItem *item)
|
||||
parentOfItem = parentOfItem->parentItem();
|
||||
}
|
||||
|
||||
d->itemToBeVisible = item;
|
||||
//since we can't ensure it'll stay alive we can delay only if it's a qgraphicswidget
|
||||
QGraphicsWidget *widget = qgraphicsitem_cast<QGraphicsWidget *>(item);
|
||||
if (widget) {
|
||||
d->widgetToBeVisible = widget;
|
||||
|
||||
// We need to wait for the parent item to resize...
|
||||
QTimer::singleShot(0, this, SLOT(makeItemVisible()));
|
||||
} else {
|
||||
d->makeItemVisible(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollWidget::registerAsDragHandle(QGraphicsWidget *item)
|
||||
|
Loading…
Reference in New Issue
Block a user