Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 025bebb..dec498b 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -177,29 +177,35 @@ void DrawPadCanvas::load(QIODevice* ioDevice) DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); xmlSimpleReader.parse(xmlInputSource); m_pages = drawPadCanvasXmlHandler.pages(); if (m_pages.isEmpty()) { - m_pages.append(new Page("", contentsRect().size())); + m_pages.append(new Page("", + clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), + clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); m_pages.current()->pixmap()->fill(Qt::white); } resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); viewport()->update(); emit pagesChanged(); } void DrawPadCanvas::initialPage() { - m_pages.append(new Page("", 236, 232)); + m_pages.append(new Page("", + clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), + clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); + //236, 232)); no more fixed sizes + m_pages.current()->pixmap()->fill(Qt::white); resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); viewport()->update(); emit pagesChanged(); } @@ -344,17 +350,20 @@ void DrawPadCanvas::selectPage(uint pagePosition) emit pagesChanged(); } void DrawPadCanvas::deleteAll() { m_pages.clear(); - m_pages.append(new Page("", contentsRect().size())); + m_pages.append(new Page("", + clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), + clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); + m_pages.current()->pixmap()->fill(Qt::white); resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); viewport()->update(); emit pagesChanged(); } @@ -377,17 +386,20 @@ void DrawPadCanvas::clearPage() viewport()->update(); } void DrawPadCanvas::deletePage() { m_pages.remove(m_pages.current()); if (m_pages.isEmpty()) { - m_pages.append(new Page("", contentsRect().size())); + m_pages.append(new Page("", + clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), + clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); + m_pages.current()->pixmap()->fill(Qt::white); } resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); viewport()->update(); emit pagesChanged(); } |