mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
PDFViewer: Inform about selections on Outline view
Selecting an Outline Item from the Outline view informs via callback the corresponding Destination that has been selected. This will be used to move the application to the corresponding page/section/etc.
This commit is contained in:
parent
aaa210e6db
commit
d739877807
4 changed files with 21 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibGUI/ModelRole.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
#include <LibPDF/Document.h>
|
||||
|
||||
enum Columns {
|
||||
Page,
|
||||
|
@ -60,6 +61,12 @@ int OutlineModel::column_count(const GUI::ModelIndex&) const
|
|||
return Columns::_Count;
|
||||
}
|
||||
|
||||
PDF::Destination const& OutlineModel::get_destination(GUI::ModelIndex const& index)
|
||||
{
|
||||
auto* outline_item = static_cast<PDF::OutlineItem*>(index.internal_data());
|
||||
return outline_item->dest;
|
||||
}
|
||||
|
||||
GUI::Variant OutlineModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue