QML PageItem: Handle document path changes

PageItem works quite well if the DocumentItem has the path on
construction, but it does not update if the path is initially blank and
then later changed.

REVIEW: 115751
This commit is contained in:
Vishesh Handa 2014-02-14 17:34:13 +01:00
parent e1f7b5c512
commit a034265e75
2 changed files with 12 additions and 0 deletions

View file

@ -118,6 +118,8 @@ void PageItem::setDocument(DocumentItem *doc)
setPageNumber(0);
emit documentChanged();
m_redrawTimer->start();
connect(doc, SIGNAL(pathChanged()), this, SLOT(documentPathChanged()));
}
int PageItem::pageNumber() const
@ -380,6 +382,15 @@ void PageItem::contentYChanged()
m_viewPort.rePos.normalizedY = m_flickable.data()->property("contentY").toReal() / (height() - m_flickable.data()->height());
}
void PageItem::documentPathChanged()
{
m_page = 0;
setPageNumber(0);
m_redrawTimer->start();
}
void PageItem::setIsThumbnail(bool thumbnail)
{
if (thumbnail == m_isThumbnail) {

View file

@ -153,6 +153,7 @@ protected:
private Q_SLOTS:
void delayedRedraw();
void documentPathChanged();
void pageHasChanged(int page, int flags);
void checkBookmarksChanged();
void contentXChanged();