-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 58192d3..db6288f 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -292,48 +292,53 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c for (uint i = fromPage; i <= toPage; i++) { DocLnk docLnk; MimeType mimeType(format); docLnk.setName(name + QString::number(i)); docLnk.setType(mimeType.id()); FileManager fileManager; QIODevice* ioDevice = fileManager.saveFile(docLnk); QImageIO imageIO(ioDevice, format); QImage image = m_pages.at(i - 1)->convertToImage(); imageIO.setImage(image); imageIO.write(); delete ioDevice; } } } QPixmap* DrawPadCanvas::currentPage() { return m_pages.current(); } +QList<QPixmap> DrawPadCanvas::pages() +{ + return m_pages; +} + uint DrawPadCanvas::pagePosition() { return (m_pages.at() + 1); } uint DrawPadCanvas::pageCount() { return m_pages.count(); } void DrawPadCanvas::deleteAll() { QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), QMessageBox::Information, QMessageBox::Yes, QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, QMessageBox::NoButton, this); if (messageBox.exec() == QMessageBox::Yes) { m_pages.clear(); m_pages.append(new QPixmap(contentsRect().size())); m_pages.current()->fill(Qt::white); m_pageBackups.clear(); diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index 90dd951..a1a9466 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h @@ -23,48 +23,49 @@ class DrawPad; class QPixmap; class DrawPadCanvas : public QScrollView { Q_OBJECT public: DrawPadCanvas(DrawPad* drawPad, QWidget* parent = 0, const char* name = 0); ~DrawPadCanvas(); void load(QIODevice* ioDevice); void initialPage(); void save(QIODevice* ioDevice); void importPage(const QString& fileName); void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); bool undoEnabled(); bool redoEnabled(); bool goPreviousPageEnabled(); bool goNextPageEnabled(); QPixmap* currentPage(); + QList<QPixmap> pages(); uint pagePosition(); uint pageCount(); public slots: void deleteAll(); void newPage(); void clearPage(); void deletePage(); void undo(); void redo(); void goFirstPage(); void goPreviousPage(); void goNextPage(); void goLastPage(); signals: void pagesChanged(); void pageBackupsChanged(); protected: void contentsMousePressEvent(QMouseEvent* e); void contentsMouseReleaseEvent(QMouseEvent* e); |