QPDFFormFieldObjectHelper::setCheckBoxValue(bool value)
{
    // Set /AS to /Yes or /Off in addition to setting /V.
    QPDFObjectHandle name =
        QPDFObjectHandle::newName(value ? "/Yes" : "/Off");
    setFieldAttribute("/V", name);
    QPDFObjectHandle AP = this->oh.getKey("/AP");
    QPDFObjectHandle annot;
    if (AP.isNull())
    {
        // The widget may be below. If there is more than one, just
        // find the first one.
        QPDFObjectHandle kids = this->oh.getKey("/Kids");
        if (kids.isArray())
        {
            int nkids = kids.getArrayNItems();
            for (int i = 0; i < nkids; ++i)
            {
                QPDFObjectHandle kid = kids.getArrayItem(i);
                AP = kid.getKey("/AP");
                if (! AP.isNull())
                {
                    QTC::TC("qpdf", "QPDFFormFieldObjectHelper checkbox kid widget");
                    annot = kid;
                    break;
                }
            }
        }
    }
    else
    {
        annot = this->oh;
    }
    if (! annot.isInitialized())
    {
        QTC::TC("qpdf", "QPDFObjectHandle broken checkbox");
        this->oh.warnIfPossible(
            "unable to set the value of this checkbox");
        return;
    }
    QTC::TC("qpdf", "QPDFFormFieldObjectHelper set checkbox AS");
    annot.replaceKey("/AS", name);
}
QPDFFormFieldObjectHelper::setCheckBoxValue(bool value)
{
     
    QPDFObjectHandle name =
        QPDFObjectHandle::newName(value ? "/Yes" : "/Off");
    setFieldAttribute("/V", name);
    QPDFObjectHandle AP = this->oh.getKey("/AP");
    QPDFObjectHandle annot;
    if (AP.isNull())
    {
         
         
        QPDFObjectHandle kids = this->oh.getKey("/Kids");
        if (kids.isArray())
        {
            int nkids = kids.getArrayNItems();
            for (int i = 0; i < nkids; ++i)
            {
                QPDFObjectHandle kid = kids.getArrayItem(i);
                AP = kid.getKey("/AP");
                if (! AP.isNull())
                {
                    QTC::TC("qpdf", "QPDFFormFieldObjectHelper checkbox kid widget");
                    annot = kid;
                    break;
                }
            }
        }
    }
    else
    {
        annot = this->oh;
    }
    if (! annot.isInitialized())
    {
        QTC::TC("qpdf", "QPDFObjectHandle broken checkbox");
        this->oh.warnIfPossible(
            "unable to set the value of this checkbox");
        return;
    }
    QTC::TC("qpdf", "QPDFFormFieldObjectHelper set checkbox AS");
    annot.replaceKey("/AS", name);
}