Subversion Repositories Scribus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13025 cbradney 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
 
10
SMCheckBox::SMCheckBox(QWidget *parent)
11
: QCheckBox(parent),
12
  hasParent_(false),
13
  useParentValue_(false),
14
  pValue_(false)
15
{
16
 
17
}
18
 
19
void SMCheckBox::setChecked(bool val)
20
{
21
        disconnect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
22
        hasParent_ = false;
23
        pValue_ = false;
24
        setFont(false);
25
 
26
        QCheckBox::setChecked(val);
27
}
28
 
29
void SMCheckBox::setChecked(bool val, bool isParentVal)
30
{
31
        disconnect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
32
        hasParent_ = true;
33
        pValue_ = val;
34
        setFont(!isParentVal);
35
 
36
        QCheckBox::setChecked(val);
37
        connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
38
}
39
 
40
void SMCheckBox::setParentValue(bool val)
41
{
42
        hasParent_ = true;
43
        pValue_ = val;
44
}
45
 
46
bool SMCheckBox::useParentValue()
47
{
48
        bool ret = useParentValue_;
49
        useParentValue_ = false;
50
        return ret;
51
}
52
 
53
void SMCheckBox::setFont(bool wantBold)
54
{
55
        QFont f(font());
56
        f.setBold(wantBold);
57
        QCheckBox::setFont(f);
58
}
59
 
60
void SMCheckBox::slotStateChanged(int)
61
{
62
        if(hasParent_)
63
                setFont(true);
64
}