1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7
8 #include "smcheckbox.h"
9
SMCheckBox(QWidget * parent)10 SMCheckBox::SMCheckBox(QWidget *parent)
11 : QCheckBox(parent)
12 {
13
14 }
15
setChecked(bool val)16 void SMCheckBox::setChecked(bool val)
17 {
18 disconnect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
19 m_hasParent = false;
20 m_pValue = false;
21 setFont(false);
22
23 QCheckBox::setChecked(val);
24 }
25
setChecked(bool val,bool isParentVal)26 void SMCheckBox::setChecked(bool val, bool isParentVal)
27 {
28 disconnect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
29 m_hasParent = true;
30 m_pValue = val;
31 setFont(!isParentVal);
32
33 QCheckBox::setChecked(val);
34 connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
35 }
36
setParentValue(bool val)37 void SMCheckBox::setParentValue(bool val)
38 {
39 m_hasParent = true;
40 m_pValue = val;
41 }
42
useParentValue()43 bool SMCheckBox::useParentValue()
44 {
45 bool ret = m_useParentValue;
46 m_useParentValue = false;
47 return ret;
48 }
49
setFont(bool wantBold)50 void SMCheckBox::setFont(bool wantBold)
51 {
52 QFont f(font());
53 f.setBold(wantBold);
54 QCheckBox::setFont(f);
55 }
56
slotStateChanged(int)57 void SMCheckBox::slotStateChanged(int)
58 {
59 if(m_hasParent)
60 setFont(true);
61 }
62