author | leseb <leseb> | 2002-06-08 12:48:01 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-08 12:48:01 (UTC) |
commit | 571908b989a85d256767dc5b27bccdb717554bb5 (patch) (side-by-side diff) | |
tree | 09149eb5ed82683020ebd9372635d4d0233982a3 | |
parent | 9dcd598f9b815511cae884d26b18e3c8913b9fcf (diff) | |
download | opie-571908b989a85d256767dc5b27bccdb717554bb5.zip opie-571908b989a85d256767dc5b27bccdb717554bb5.tar.gz opie-571908b989a85d256767dc5b27bccdb717554bb5.tar.bz2 |
Selection and delete now work in thumbnail view
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 1 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 27 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.h | 2 |
4 files changed, 42 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 252f4d5..0a1e9a5 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -329,2 +329,15 @@ uint DrawPadCanvas::pageCount() +void DrawPadCanvas::selectPage(Page* page) +{ + m_pages.findRef(page); + m_pageBackups.clear(); + m_pageBackups.append(new Page(*(m_pages.current()))); + + resizeContents(m_pages.current()->width(), m_pages.current()->height()); + viewport()->update(); + + emit pagesChanged(); + emit pageBackupsChanged(); +} + void DrawPadCanvas::backupPage() diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index 47763f9..cf2d904 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h @@ -49,2 +49,3 @@ public: + void selectPage(Page* page); void backupPage(); diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 1754ce9..476b7b9 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp @@ -102,2 +102,5 @@ void PageListView::updateView() } + + setSorting(0, false); + select(m_pDrawPadCanvas->currentPage()); } @@ -112,2 +115,17 @@ void PageListView::resizeEvent(QResizeEvent* e) +void PageListView::select(Page* page) +{ + PageListViewItem* item = (PageListViewItem*)firstChild(); + + while (item) { + if (item->page() == page) { + setSelected(item, true); + ensureItemVisible(item); + break; + } + + item = (PageListViewItem*)(item->nextSibling()); + } +} + Page* PageListView::selected() const @@ -127,3 +145,2 @@ Page* PageListView::selected() const - ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) @@ -147,2 +164,3 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons deletePageButton->setAutoRaise(true); + connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); @@ -157,2 +175,3 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons m_pPageListView = new PageListView(m_pDrawPadCanvas, this); + connect(m_pPageListView, SIGNAL(selectionChanged()), this, SLOT(changePage())); @@ -209,3 +228,9 @@ void ThumbnailView::deletePage() m_pDrawPadCanvas->deletePage(); + m_pPageListView->updateView(); } } + +void ThumbnailView::changePage() +{ + m_pDrawPadCanvas->selectPage(m_pPageListView->selected()); +} diff --git a/noncore/graphics/drawpad/thumbnailview.h b/noncore/graphics/drawpad/thumbnailview.h index ae97ff1..9417655 100644 --- a/noncore/graphics/drawpad/thumbnailview.h +++ b/noncore/graphics/drawpad/thumbnailview.h @@ -42,2 +42,3 @@ public: + void select(Page* page); Page* selected() const; @@ -64,2 +65,3 @@ public slots: void deletePage(); + void changePage(); |