File indexing completed on 2024-05-12 04:33:32

0001 /*
0002     SPDX-FileCopyrightText: 2019 João Netto <joaonetto901@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "js_ocg_p.h"
0008 
0009 #include <QAbstractItemModel>
0010 #include <QDebug>
0011 #include <QString>
0012 
0013 using namespace Okular;
0014 
0015 // OCG.state (getter)
0016 bool JSOCG::state() const
0017 {
0018     const QModelIndex index = m_model->index(m_i, m_j);
0019 
0020     return m_model->data(index, Qt::CheckStateRole).toBool();
0021 }
0022 
0023 // OCG.state (setter)
0024 void JSOCG::setState(bool state)
0025 {
0026     const QModelIndex index = m_model->index(m_i, m_j);
0027 
0028     m_model->setData(index, QVariant(state ? Qt::Checked : Qt::Unchecked), Qt::CheckStateRole);
0029 }
0030 
0031 JSOCG::JSOCG(QAbstractItemModel *model, int i, int j, QObject *parent)
0032     : QObject(parent)
0033     , m_model(model)
0034     , m_i(i)
0035     , m_j(j)
0036 {
0037 }
0038 
0039 JSOCG::~JSOCG() = default;