-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptcontent.cpp
49 lines (39 loc) · 1013 Bytes
/
optcontent.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "optcontent.h"
#include "poppler-qt5.h"
#include <QtWidgets/QTreeView>
OptContentDock::OptContentDock(QWidget *parent)
: AbstractInfoDock(parent)
{
m_view = new QTreeView(this);
setWidget(m_view);
setWindowTitle(tr("Optional content"));
m_view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
OptContentDock::~OptContentDock()
{
}
void OptContentDock::documentLoaded()
{
AbstractInfoDock::documentLoaded();
if ( document()->pageMode() == Poppler::Document::UseOC ) {
show();
}
}
void OptContentDock::fillInfo()
{
if (!document()->hasOptionalContent()) {
return;
}
m_view->setModel(document()->optionalContentModel());
connect(m_view->model(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(reloadImage()));
m_view->expandToDepth(1);
}
void OptContentDock::documentClosed()
{
m_view->setModel(0);
AbstractInfoDock::documentClosed();
}
void OptContentDock::reloadImage()
{
reloadPage();
}