[poppler] 2 commits - qt4/demos

Pino Toscano pino at kemper.freedesktop.org
Wed Feb 27 03:16:34 PST 2008


 qt4/demos/documentobserver.cpp |    5 +++++
 qt4/demos/documentobserver.h   |    1 +
 qt4/demos/optcontent.cpp       |    8 ++++++++
 qt4/demos/optcontent.h         |    3 +++
 4 files changed, 17 insertions(+)

New commits:
commit 0a19486cb4de57c0c987cc4ce2434a96bbd18338
Author: Pino Toscano <pino at kde.org>
Date:   Wed Feb 27 12:15:44 2008 +0100

    refresh the current page when the data of the content model change

diff --git a/qt4/demos/optcontent.cpp b/qt4/demos/optcontent.cpp
index 2f8bebe..e2bc3ae 100644
--- a/qt4/demos/optcontent.cpp
+++ b/qt4/demos/optcontent.cpp
@@ -44,12 +44,20 @@ void OptContentDock::fillInfo()
     }
 
     m_view->setModel(document()->optionalContentModel());
+    connect(m_view->model(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(reloadImage()));
+    m_view->expandToDepth(1);
 }
 
 void OptContentDock::documentClosed()
 {
+    disconnect(m_view->model(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(reloadImage()));
     m_view->setModel(0);
     AbstractInfoDock::documentClosed();
 }
 
+void OptContentDock::reloadImage()
+{
+    reloadPage();
+}
+
 #include "optcontent.moc"
diff --git a/qt4/demos/optcontent.h b/qt4/demos/optcontent.h
index 6189601..3260f29 100644
--- a/qt4/demos/optcontent.h
+++ b/qt4/demos/optcontent.h
@@ -36,6 +36,9 @@ public:
 protected:
     /*virtual*/ void fillInfo();
 
+private Q_SLOTS:
+    void reloadImage();
+
 private:
     QTreeView *m_view;
 };
commit 09b7cc2efb7d21fa4dabd23d2d2de877cc7d86ee
Author: Pino Toscano <pino at kde.org>
Date:   Wed Feb 27 12:15:18 2008 +0100

    optional method to reload the current page

diff --git a/qt4/demos/documentobserver.cpp b/qt4/demos/documentobserver.cpp
index 611ba79..e5c283d 100644
--- a/qt4/demos/documentobserver.cpp
+++ b/qt4/demos/documentobserver.cpp
@@ -43,3 +43,8 @@ int DocumentObserver::page() const
 {
     return m_viewer->page();
 }
+
+void DocumentObserver::reloadPage()
+{
+    m_viewer->setPage(m_viewer->page());
+}
diff --git a/qt4/demos/documentobserver.h b/qt4/demos/documentobserver.h
index c6e287b..38fe204 100644
--- a/qt4/demos/documentobserver.h
+++ b/qt4/demos/documentobserver.h
@@ -41,6 +41,7 @@ protected:
     Poppler::Document* document() const;
     void setPage(int page);
     int page() const;
+    void reloadPage();
 
 private:
     PdfViewer *m_viewer;


More information about the poppler mailing list