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.
8
#include "smcolorcombo.h"
12
SMColorCombo::SMColorCombo(QWidget *parent)
15
useParentValue_(false),
21
SMColorCombo::SMColorCombo(bool rw, QWidget* parent)
22
: ColorCombo(rw, parent),
24
useParentValue_(false),
31
void SMColorCombo::setCurrentItem(int i)
33
disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
37
pText_ = QString::null;
38
ColorCombo::setCurrentIndex(i);
41
void SMColorCombo::setCurrentItem(int i, bool isParentValue)
43
disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
46
pText_ = QString::null;
47
ColorCombo::setCurrentIndex(i);
48
setFont(!isParentValue);
49
connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
52
void SMColorCombo::setCurrentText(const QString &s)
54
disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
59
setCurrentComboItem(this, s);
60
connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
63
void SMColorCombo::setCurrentText(const QString &s, bool isParentValue)
65
disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
69
setCurrentComboItem(this, s);
70
setFont(!isParentValue);
71
connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
74
void SMColorCombo::setParentItem(int i)
78
pText_ = QString::null;
81
void SMColorCombo::setParentText(const QString &s)
87
bool SMColorCombo::useParentValue()
91
if (useParentValue_ && hasParent_)
93
ret = currentIndex() == (count() - 1);
96
removeItem(count() - 1);
99
setCurrentText(pText_, true);
101
setCurrentItem(pItem_, true);
102
useParentValue_ = false;
109
void SMColorCombo::setFont(bool wantBold)
113
ColorCombo::setFont(f);
116
void SMColorCombo::currentChanged()
118
if (hasParent_ && !useParentValue_)
121
addItem( tr("Use Parent Value"));
122
useParentValue_ = true;