QXRD  0.11.16
Public Slots | Signals | Public Member Functions | Private Attributes | List of all members
QcepBoolProperty Class Reference

#include <qcepproperty.h>

Inheritance diagram for QcepBoolProperty:
Inheritance graph
[legend]
Collaboration diagram for QcepBoolProperty:
Collaboration graph
[legend]

Public Slots

void setValue (bool val, int index)
 
void setValue (bool val)
 
void setDefaultValue (bool val)
 
void resetValue ()
 
void toggle ()
 

Signals

void valueChanged (bool val, int index)
 

Public Member Functions

 QcepBoolProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, bool value, QString toolTip)
 
bool value () const
 
bool defaultValue () const
 
void linkTo (QAbstractButton *button)
 
- Public Member Functions inherited from QcepProperty
 QcepProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime())
 
QString name () const
 
void setName (QString name)
 
QString parentName () const
 
QString toolTip () const
 
void setToolTip (QString tip)
 
QString expandedToolTip () const
 
void setWidgetToolTip (QWidget *widget)
 
int index ()
 
int incIndex (int step)
 
int debug () const
 
void setDebug (int dbg)
 
void setSaver (QcepSettingsSaverWPtr saver)
 

Private Attributes

QAtomicInt m_Default
 
QAtomicInt m_Value
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepProperty
static void registerMetaTypes ()
 
static void setSettingsValue (QSettings *settings, QString name, QVariant value)
 
static void writeSettings (QObject *object, QSettings *settings, QString section)
 
static void readSettings (QObject *object, QSettings *settings, QString section)
 
static void writeSettings (QObject *object, const QMetaObject *meta, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void readSettings (QObject *object, const QMetaObject *meta, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void writeSettings (QObject *object, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void readSettings (QObject *object, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void registerCustomSaver (QString typeName, CustomSettingsSaver *saver)
 
- Protected Attributes inherited from QcepProperty
QMutex m_Mutex
 
QcepSettingsSaverWPtr m_Saver
 

Detailed Description

Definition at line 199 of file qcepproperty.h.

Constructor & Destructor Documentation

QcepBoolProperty::QcepBoolProperty ( QcepSettingsSaverWPtr  saver,
QObject *  parent,
const char *  name,
bool  value,
QString  toolTip 
)

Definition at line 1174 of file qcepproperty.cpp.

1175  : QcepProperty(saver, parent, name, toolTip),
1176  m_Default(value),
1177  m_Value(value)
1178 {
1179 }
QAtomicInt m_Default
Definition: qcepproperty.h:220
QAtomicInt m_Value
Definition: qcepproperty.h:221
QString name() const
QcepProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
QString toolTip() const
bool value() const

Member Function Documentation

bool QcepBoolProperty::defaultValue ( ) const

Definition at line 1190 of file qcepproperty.cpp.

References m_Default.

Referenced by resetValue().

1191 {
1192 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
1193  return m_Default.load();
1194 #else
1195  return m_Default;
1196 #endif
1197 }
QAtomicInt m_Default
Definition: qcepproperty.h:220

Here is the caller graph for this function:

void QcepBoolProperty::linkTo ( QAbstractButton *  button)

Definition at line 1265 of file qcepproperty.cpp.

References QcepBoolPropertyButtonHelper::connect(), QcepProperty::debug(), DEBUG_PROPERTIES, HEXARG, QcepProperty::name(), QcepProperty::printMessage(), qcepDebug(), setValue(), QcepProperty::setWidgetToolTip(), value(), and valueChanged().

1266 {
1267  if (qcepDebug(DEBUG_PROPERTIES || debug())) {
1268  printMessage(tr("%1: QcepBoolProperty::linkTo(QAbstractButton *%2)")
1269  .arg(name()).HEXARG(button));
1270  }
1271 
1273  = new QcepBoolPropertyButtonHelper(button, this);
1274 
1275  helper->moveToThread(button->thread());
1276  helper->connect();
1277 
1278  button -> setChecked(value());
1279 
1280  setWidgetToolTip(button);
1281 
1282  connect(this, SIGNAL(valueChanged(bool, int)), helper, SLOT(setChecked(bool, int)));
1283  connect(helper, SIGNAL(toggled(bool, int)), this, SLOT(setValue(bool, int)));
1284 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void setWidgetToolTip(QWidget *widget)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
void setValue(bool val, int index)
QString name() const
#define HEXARG(a)
Definition: qcepdebug.h:50
int debug() const
bool value() const
void valueChanged(bool val, int index)

Here is the call graph for this function:

void QcepBoolProperty::resetValue ( )
slot

Definition at line 1247 of file qcepproperty.cpp.

References QcepProperty::debug(), DEBUG_PROPERTIES, defaultValue(), QcepProperty::name(), QcepProperty::printMessage(), qcepDebug(), and setValue().

1248 {
1249  if (qcepDebug(DEBUG_PROPERTIES || debug())) {
1250  printMessage(tr("%1: QcepBoolProperty::resetValue").arg(name()));
1251  }
1252 
1254 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
void setValue(bool val, int index)
QString name() const
int debug() const
bool defaultValue() const

Here is the call graph for this function:

void QcepBoolProperty::setDefaultValue ( bool  val)
slot

Definition at line 1242 of file qcepproperty.cpp.

References m_Default.

1243 {
1244  m_Default.fetchAndStoreOrdered(val);
1245 }
QAtomicInt m_Default
Definition: qcepproperty.h:220
void QcepBoolProperty::setValue ( bool  val,
int  index 
)
slot

Definition at line 1199 of file qcepproperty.cpp.

References QcepProperty::debug(), QcepProperty::index(), QcepProperty::name(), and QcepProperty::printMessage().

Referenced by linkTo(), resetValue(), and toggle().

1200 {
1201  if (debug()) {
1202  printMessage(tr("%1 QcepBoolProperty::setValue(bool %2, int %3) [%4]")
1203  .arg(name()).arg(val).arg(index).arg(this->index()));
1204  }
1205 
1206  if (index == this->index()) {
1207  setValue(val);
1208  }
1209 }
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
void setValue(bool val, int index)
QString name() const
int debug() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepBoolProperty::setValue ( bool  val)
slot

Definition at line 1211 of file qcepproperty.cpp.

References QcepProperty::debug(), DEBUG_PROPERTIES, QcepProperty::incIndex(), QcepProperty::index(), QcepProperty::m_Saver, m_Value, QcepProperty::name(), QcepProperty::printMessage(), qcepDebug(), and valueChanged().

1212 {
1213  if (qcepDebug(DEBUG_PROPERTIES)) {
1214  printMessage(tr("%1: QcepBoolProperty::setValue(bool %2)")
1215  .arg(name()).arg(val));
1216  }
1217 
1218 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
1219  int curVal = m_Value.load();
1220 #else
1221  int curVal = m_Value;
1222 #endif
1223 
1224  if ((int) val != curVal) {
1225  if (debug()) {
1226  printMessage(tr("%1: QcepBoolProperty::setValue(bool %2) [%3]")
1227  .arg(name()).arg(val).arg(index()));
1228  }
1229 
1230  m_Value.fetchAndStoreOrdered(val);
1231 
1233 
1234  if (saver) {
1235  saver->changed(this);
1236  }
1237 
1238  emit valueChanged(val, incIndex(1));
1239  }
1240 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
int incIndex(int step)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QAtomicInt m_Value
Definition: qcepproperty.h:221
QString name() const
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
int debug() const
void valueChanged(bool val, int index)
QcepSettingsSaverWPtr m_Saver
Definition: qcepproperty.h:70

Here is the call graph for this function:

void QcepBoolProperty::toggle ( )
slot

Definition at line 1256 of file qcepproperty.cpp.

References m_Value, and setValue().

1257 {
1258 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
1259  setValue(!m_Value.load());
1260 #else
1261  setValue(!m_Value);
1262 #endif
1263 }
void setValue(bool val, int index)
QAtomicInt m_Value
Definition: qcepproperty.h:221

Here is the call graph for this function:

bool QcepBoolProperty::value ( ) const

Definition at line 1181 of file qcepproperty.cpp.

References m_Value.

Referenced by linkTo().

1182 {
1183 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
1184  return m_Value.load();
1185 #else
1186  return m_Value;
1187 #endif
1188 }
QAtomicInt m_Value
Definition: qcepproperty.h:221

Here is the caller graph for this function:

void QcepBoolProperty::valueChanged ( bool  val,
int  index 
)
signal

Member Data Documentation

QAtomicInt QcepBoolProperty::m_Default
private

Definition at line 220 of file qcepproperty.h.

Referenced by defaultValue(), and setDefaultValue().

QAtomicInt QcepBoolProperty::m_Value
private

Definition at line 221 of file qcepproperty.h.

Referenced by setValue(), toggle(), and value().


The documentation for this class was generated from the following files: