File indexing completed on 2024-05-12 04:58:12

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2017  David Rosca <nowrep@gmail.com>
0004 * Copyright (C) 2017  Razi Alavizadeh <s.r.alavizadeh@gmail.com>
0005 *
0006 * This program is free software: you can redistribute it and/or modify
0007 * it under the terms of the GNU General Public License as published by
0008 * the Free Software Foundation, either version 3 of the License, or
0009 * (at your option) any later version.
0010 *
0011 * This program is distributed in the hope that it will be useful,
0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 * GNU General Public License for more details.
0015 *
0016 * You should have received a copy of the GNU General Public License
0017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 * ============================================================ */
0019 #include "checkboxdialog.h"
0020 
0021 #include <QCheckBox>
0022 
0023 CheckBoxDialog::CheckBoxDialog(const QMessageBox::StandardButtons &buttons, QWidget* parent)
0024     : QMessageBox(parent)
0025     , m_checkBox(new QCheckBox)
0026 {
0027     setCheckBox(m_checkBox);
0028     setStandardButtons(buttons);
0029     setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
0030 }
0031 
0032 void CheckBoxDialog::setCheckBoxText(const QString &text)
0033 {
0034     m_checkBox->setText(text);
0035 }
0036 
0037 bool CheckBoxDialog::isChecked() const
0038 {
0039     return m_checkBox->isChecked();
0040 }
0041 
0042 void CheckBoxDialog::setDefaultCheckState(Qt::CheckState state)
0043 {
0044     m_checkBox->setChecked(state == Qt::Checked);
0045 }