~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/invisiblebuttongroup.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
 
1
// vim: set tabstop=4 shiftwidth=4 expandtab:
2
2
/*
3
3
Gwenview: an image viewer
4
4
Copyright 2008 Aurélien Gâteau <agateau@kde.org>
30
30
 
31
31
// Local
32
32
 
33
 
namespace Gwenview {
34
 
 
 
33
namespace Gwenview
 
34
{
35
35
 
36
36
struct InvisibleButtonGroupPrivate {
37
 
        QButtonGroup* mGroup;
 
37
    QButtonGroup* mGroup;
38
38
};
39
39
 
40
 
 
41
40
InvisibleButtonGroup::InvisibleButtonGroup(QWidget* parent)
42
41
: QWidget(parent)
43
 
, d(new InvisibleButtonGroupPrivate) {
44
 
        hide();
45
 
        d->mGroup = new QButtonGroup(this);
46
 
        d->mGroup->setExclusive(true);
47
 
        connect(d->mGroup, SIGNAL(buttonClicked(int)), SIGNAL(selectionChanged(int)) );
48
 
        const QString name = metaObject()->className();
49
 
        if (!KConfigDialogManager::propertyMap()->contains(name)) {
50
 
                KConfigDialogManager::propertyMap()->insert(name, "current");
51
 
                KConfigDialogManager::changedMap()->insert(name, SIGNAL(selectionChanged(int)));
52
 
        }
53
 
}
54
 
 
55
 
 
56
 
InvisibleButtonGroup::~InvisibleButtonGroup() {
57
 
        delete d;
58
 
}
59
 
 
60
 
 
61
 
int InvisibleButtonGroup::selected() const {
62
 
        return d->mGroup->checkedId();
63
 
}
64
 
 
65
 
 
66
 
void InvisibleButtonGroup::addButton(QAbstractButton* button, int id) {
67
 
        d->mGroup->addButton(button, id);
68
 
}
69
 
 
70
 
 
71
 
void InvisibleButtonGroup::setSelected(int id) {
72
 
        QAbstractButton* button = d->mGroup->button(id);
73
 
        if (button) {
74
 
                button->setChecked(true);
75
 
        }
76
 
}
77
 
 
 
42
, d(new InvisibleButtonGroupPrivate)
 
43
{
 
44
    hide();
 
45
    d->mGroup = new QButtonGroup(this);
 
46
    d->mGroup->setExclusive(true);
 
47
    connect(d->mGroup, SIGNAL(buttonClicked(int)), SIGNAL(selectionChanged(int)));
 
48
    const QString name = metaObject()->className();
 
49
    if (!KConfigDialogManager::propertyMap()->contains(name)) {
 
50
        KConfigDialogManager::propertyMap()->insert(name, "current");
 
51
        KConfigDialogManager::changedMap()->insert(name, SIGNAL(selectionChanged(int)));
 
52
    }
 
53
}
 
54
 
 
55
InvisibleButtonGroup::~InvisibleButtonGroup()
 
56
{
 
57
    delete d;
 
58
}
 
59
 
 
60
int InvisibleButtonGroup::selected() const
 
61
{
 
62
    return d->mGroup->checkedId();
 
63
}
 
64
 
 
65
void InvisibleButtonGroup::addButton(QAbstractButton* button, int id)
 
66
{
 
67
    d->mGroup->addButton(button, id);
 
68
}
 
69
 
 
70
void InvisibleButtonGroup::setSelected(int id)
 
71
{
 
72
    QAbstractButton* button = d->mGroup->button(id);
 
73
    if (button) {
 
74
        button->setChecked(true);
 
75
    }
 
76
}
78
77
 
79
78
} // namespace