Okular

js_ocg.cpp
1/*
2 SPDX-FileCopyrightText: 2019 João Netto <joaonetto901@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "js_ocg_p.h"
8
9#include <QAbstractItemModel>
10#include <QDebug>
11#include <QString>
12
13using namespace Okular;
14
15// OCG.state (getter)
16bool JSOCG::state() const
17{
18 const QModelIndex index = m_model->index(m_i, m_j);
19
20 return m_model->data(index, Qt::CheckStateRole).toBool();
21}
22
23// OCG.state (setter)
24void JSOCG::setState(bool state)
25{
26 const QModelIndex index = m_model->index(m_i, m_j);
27
28 m_model->setData(index, QVariant(state ? Qt::Checked : Qt::Unchecked), Qt::CheckStateRole);
29}
30
31JSOCG::JSOCG(QAbstractItemModel *model, int i, int j, QObject *parent)
32 : QObject(parent)
33 , m_model(model)
34 , m_i(i)
35 , m_j(j)
36{
37}
38
39JSOCG::~JSOCG() = default;
global.h
Definition action.h:17
QVariant data(int role) const const
CheckStateRole
bool toBool() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:47:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.