Commit 95529b41 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Make it possible to browse pages in test-poppler-qt

parent 2d526508
2005-07-22 Albert Astals Cid <aacid@kde.org>
* qt/test-poppler-qt.cpp: Make it possible to change the displayed
page using Up and Down keys
2005-07-22 Albert Astals Cid <aacid@kde.org>
* splash/Splash.cc: Fix bugs #3728 and #3750
2005-07-20 Martin Kretzschmar <martink@gnome.org>
* glib/poppler-document.cc (poppler_fonts_iter_get_name): if the
......@@ -9,10 +18,6 @@
* glib/poppler-document.h (PopplerFontType): new enum.
Update prototypes.
2005-07-15 Albert Astals Cid <aacid@kde.org>
* splash/Splash.cc: Fix bugs #3728 and #3750
2005-07-15 Martin Kretzschmar <martink@gnome.org>
* test/gtk-cairo-test.cc: update for 2005-06-27 change to actually
......
......@@ -16,7 +16,11 @@ public:
~PDFDisplay();
protected:
void paintEvent( QPaintEvent * );
void keyPressEvent( QKeyEvent * );
private:
void display();
int currentPage;
QPixmap *pixmap;
Poppler::Document *doc;
};
......@@ -24,15 +28,8 @@ private:
PDFDisplay::PDFDisplay( Poppler::Document *d )
{
doc = d;
if (doc) {
Poppler::Page *page = doc->getPage(0);
if (page) {
page->renderToPixmap(&pixmap, -1, -1, -1, -1);
delete page;
}
} else {
printf("doc not loaded\n");
}
currentPage = 0;
display();
}
PDFDisplay::~PDFDisplay()
......@@ -48,6 +45,40 @@ void PDFDisplay::paintEvent( QPaintEvent *e )
paint.drawPixmap(0, 0, *pixmap);
}
void PDFDisplay::keyPressEvent( QKeyEvent *e )
{
if (e->key() == Qt::Key_Down)
{
if (currentPage + 1 < doc->getNumPages())
{
currentPage++;
display();
}
}
else if (e->key() == Qt::Key_Up)
{
if (currentPage > 0)
{
currentPage--;
display();
}
}
}
void PDFDisplay::display()
{
if (doc) {
Poppler::Page *page = doc->getPage(currentPage);
if (page) {
page->renderToPixmap(&pixmap, -1, -1, -1, -1);
delete page;
update();
}
} else {
printf("doc not loaded\n");
}
}
int main( int argc, char **argv )
{
QApplication a( argc, argv ); // QApplication required!
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment