[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] libs/koreport/common: Allow the document to emit changes
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2011-09-30 22:30:28
Message-ID: 20110930223028.9AA8CA60CD () git ! kde ! org
[Download RAW message or body]
Git commit 078e9f65859993e057e468ff13274827964c1078 by Jaroslaw Staniek, on behalf of Adam Pigg.
Committed on 30/09/2011 at 10:58.
Pushed by staniek into branch 'master'.
Allow the document to emit changes to the view
M +10 -1 libs/koreport/common/renderobjects.cpp
M +10 -2 libs/koreport/common/renderobjects.h
http://commits.kde.org/calligra/078e9f65859993e057e468ff13274827964c1078
diff --git a/libs/koreport/common/renderobjects.cpp b/libs/koreport/common/renderobjects.cpp
index eeec023..a065075 100644
--- a/libs/koreport/common/renderobjects.cpp
+++ b/libs/koreport/common/renderobjects.cpp
@@ -78,6 +78,11 @@ void ORODocument::setPageOptions(const ReportPageOptions & options)
m_pageOptions = options;
}
+void ORODocument::notifyChange(int pageNo)
+{
+ emit(updated(pageNo));
+}
+
//
// OROPage
//
@@ -114,7 +119,7 @@ OROPrimitive* OROPage::primitive(int idx)
return m_primitives.at(idx);
}
-void OROPage::addPrimitive(OROPrimitive* p, bool atBeginning)
+void OROPage::addPrimitive(OROPrimitive* p, bool atBeginning, bool notify)
{
kDebug() << "Adding primitive" << p->type() << "to page" << page();
@@ -129,6 +134,10 @@ void OROPage::addPrimitive(OROPrimitive* p, bool atBeginning)
} else {
m_primitives.append(p);
}
+
+ if (notify) {
+ document()->notifyChange(page());
+ }
}
//
diff --git a/libs/koreport/common/renderobjects.h b/libs/koreport/common/renderobjects.h
index be38342..5655862 100644
--- a/libs/koreport/common/renderobjects.h
+++ b/libs/koreport/common/renderobjects.h
@@ -46,10 +46,13 @@ class OROSection;
// ORODocument
// This object is a single document containing one or more OROPage elements
//
-class KOREPORT_EXPORT ORODocument
+class KOREPORT_EXPORT ORODocument : public QObject
{
+ Q_OBJECT
+
friend class OROPage;
friend class OROSection;
+
public:
ORODocument(const QString & = QString());
~ORODocument();
@@ -75,12 +78,17 @@ public:
ReportPageOptions pageOptions() const {
return m_pageOptions;
};
+
+ void notifyChange(int pageNo);
protected:
QString m_title;
QList<OROPage*> m_pages;
QList<OROSection*> m_sections;
ReportPageOptions m_pageOptions;
+
+signals:
+ void updated(int pageNo);
};
//
@@ -107,7 +115,7 @@ public:
return m_primitives.count();
};
OROPrimitive* primitive(int);
- void addPrimitive(OROPrimitive*, bool = false);
+ void addPrimitive(OROPrimitive*, bool atBeginning = false, bool notify = false);
protected:
ORODocument * m_document;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic