Changeset View
Changeset View
Standalone View
Standalone View
examples/window.cpp
Show All 26 Lines | |||||
27 | #include <QApplication> | 27 | #include <QApplication> | ||
28 | #include <QDebug> | 28 | #include <QDebug> | ||
29 | #include <QFile> | 29 | #include <QFile> | ||
30 | #include <QMenu> | 30 | #include <QMenu> | ||
31 | #include <QMenuBar> | 31 | #include <QMenuBar> | ||
32 | #include <QSettings> | 32 | #include <QSettings> | ||
33 | #include <QSplitter> | 33 | #include <QSplitter> | ||
34 | 34 | | |||
35 | QDebug operator<<(QDebug dbg, const QDomNode& node) | ||||
staniek: Can we move this to KReportUtils_p.h? | |||||
piggz: Just deleted it as it was a temp debugging aid | |||||
36 | { | ||||
37 | QString s; | ||||
38 | QTextStream str(&s, QIODevice::WriteOnly); | ||||
39 | node.save(str, 2); | ||||
40 | dbg << qPrintable(s); | ||||
41 | return dbg; | ||||
42 | } | ||||
43 | | ||||
35 | Window::Window(QWidget *parent, Qt::WindowFlags flags) | 44 | Window::Window(QWidget *parent, Qt::WindowFlags flags) | ||
36 | : QMainWindow(parent, flags) | 45 | : QMainWindow(parent, flags) | ||
37 | { | 46 | { | ||
38 | QSplitter *centralWidget = new QSplitter(Qt::Vertical, this); | 47 | QSplitter *centralWidget = new QSplitter(Qt::Vertical, this); | ||
39 | m_designerWidget = new ReportDesignerWidget(centralWidget); | 48 | m_designerWidget = new ReportDesignerWidget(centralWidget); | ||
40 | m_designerWidget->createMainToolBar(this); | 49 | m_designerWidget->createMainToolBar(this); | ||
41 | m_designerWidget->createItemsToolBar(this); | 50 | m_designerWidget->createItemsToolBar(this); | ||
42 | m_designerWidget->createPropertyEditorDockWidget(this, Qt::RightDockWidgetArea); | 51 | m_designerWidget->createPropertyEditorDockWidget(this, Qt::RightDockWidgetArea); | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 118 | { | |||
111 | m_exitAction = new QAction(tr("E&xit"), this); | 120 | m_exitAction = new QAction(tr("E&xit"), this); | ||
112 | m_exitAction->setShortcuts(QKeySequence::Quit); | 121 | m_exitAction->setShortcuts(QKeySequence::Quit); | ||
113 | connect(m_exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); | 122 | connect(m_exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); | ||
114 | m_fileMenu->addAction(m_exitAction); | 123 | m_fileMenu->addAction(m_exitAction); | ||
115 | } | 124 | } | ||
116 | 125 | | |||
117 | void Window::showDesign(const QDomElement &design) | 126 | void Window::showDesign(const QDomElement &design) | ||
118 | { | 127 | { | ||
128 | qDebug() << "Report XML:"; | ||||
staniek: OK but later maybe add #ifdef or something? | |||||
staniek: at least let's use kreportDebug() everywhere | |||||
piggz: deleted | |||||
129 | qDebug() << design; | ||||
119 | KReportPreRenderer preRenderer(design); | 130 | KReportPreRenderer preRenderer(design); | ||
120 | if (!preRenderer.isValid()) { | 131 | if (!preRenderer.isValid()) { | ||
121 | return; | 132 | return; | ||
122 | } | 133 | } | ||
123 | 134 | | |||
124 | preRenderer.setSourceData(new KReportExampleData()); | 135 | preRenderer.setSourceData(new KReportExampleData()); | ||
125 | preRenderer.setName("example_report"); | 136 | preRenderer.setName("example_report"); | ||
126 | 137 | | |||
127 | if (preRenderer.generateDocument()) { | 138 | if (preRenderer.generateDocument()) { | ||
128 | m_reportView->setDocument(preRenderer.document()); | 139 | m_reportView->setDocument(preRenderer.document()); | ||
129 | m_reportView->moveToFirstPage(); | 140 | m_reportView->moveToFirstPage(); | ||
130 | } | 141 | } | ||
131 | } | 142 | } |
Can we move this to KReportUtils_p.h?