Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
poppler
poppler
Commits
95529b41
Commit
95529b41
authored
Jul 22, 2005
by
Albert Astals Cid
Browse files
Make it possible to browse pages in test-poppler-qt
parent
2d526508
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
95529b41
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
...
...
qt/test-poppler-qt.cpp
View file @
95529b41
...
...
@@ -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!
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment