better wait for the parentItem to resize before calculating the rect of the item to be visible
svn path=/trunk/KDE/kdelibs/; revision=1057266
This commit is contained in:
parent
c95a699031
commit
7e3bdb55e5
@ -214,6 +214,14 @@ public:
|
||||
(widget->pos() + delta).toPoint());
|
||||
}
|
||||
|
||||
void makeItemVisible()
|
||||
{
|
||||
QRectF rect(widget->mapFromScene(itemToBeVisible->scenePos()), itemToBeVisible->boundingRect().size());
|
||||
rectToBeVisible = rect;
|
||||
|
||||
makeRectVisible();
|
||||
}
|
||||
|
||||
void cleanupDragHandles(QObject *destroyed)
|
||||
{
|
||||
dragHandles.remove(static_cast<QGraphicsWidget *>(destroyed));
|
||||
@ -233,6 +241,7 @@ public:
|
||||
ScrollBar *horizontalScrollBar;
|
||||
Qt::ScrollBarPolicy horizontalScrollBarPolicy;
|
||||
QString styleSheet;
|
||||
QGraphicsItem *itemToBeVisible;
|
||||
QRectF rectToBeVisible;
|
||||
QPointF dragHandleClicked;
|
||||
QSet<QGraphicsWidget *>dragHandles;
|
||||
@ -351,11 +360,10 @@ void ScrollWidget::ensureItemVisible(QGraphicsItem *item)
|
||||
parentOfItem = parentOfItem->parentItem();
|
||||
}
|
||||
|
||||
QRectF rect(d->widget->mapFromScene(item->scenePos()), item->boundingRect().size());
|
||||
d->rectToBeVisible = rect;
|
||||
d->itemToBeVisible = item;
|
||||
|
||||
// We need to wait for the parent item to resize...
|
||||
QTimer::singleShot(0, this, SLOT(makeRectVisible()));
|
||||
QTimer::singleShot(0, this, SLOT(makeItemVisible()));
|
||||
}
|
||||
|
||||
void ScrollWidget::registerAsDragHandle(QGraphicsWidget *item)
|
||||
|
@ -198,6 +198,7 @@ private:
|
||||
Q_PRIVATE_SLOT(d, void verticalScroll(int value))
|
||||
Q_PRIVATE_SLOT(d, void horizontalScroll(int value))
|
||||
Q_PRIVATE_SLOT(d, void makeRectVisible())
|
||||
Q_PRIVATE_SLOT(d, void makeItemVisible())
|
||||
Q_PRIVATE_SLOT(d, void cleanupDragHandles(QObject *destroyed))
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user