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

#include <qcepproperty.h>

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

Public Slots

void setValue (int val, int index)
 
void setValue (int val)
 
void incValue (int step)
 
void setDefaultValue (int val)
 
void resetValue ()
 

Signals

void valueChanged (int val, int index)
 
void stringValueChanged (QString val)
 

Public Member Functions

 QcepIntProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, int value, QString toolTip)
 
int value () const
 
int defaultValue () const
 
void linkTo (QSpinBox *spinBox)
 
void linkTo (QComboBox *comboBox)
 
void linkTo (QLabel *label)
 
void linkTo (QProgressBar *progress)
 
void linkTo (QLCDNumber *number)
 
- 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 131 of file qcepproperty.h.

Constructor & Destructor Documentation

QcepIntProperty::QcepIntProperty ( QcepSettingsSaverWPtr  saver,
QObject *  parent,
const char *  name,
int  value,
QString  toolTip 
)

Definition at line 914 of file qcepproperty.cpp.

915  : QcepProperty(saver, parent, name, toolTip),
916  m_Default(value),
917  m_Value(value)
918 {
919 }
QAtomicInt m_Value
Definition: qcepproperty.h:158
int value() const
QString name() const
QcepProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
QAtomicInt m_Default
Definition: qcepproperty.h:157
QString toolTip() const

Member Function Documentation

int QcepIntProperty::defaultValue ( ) const

Definition at line 930 of file qcepproperty.cpp.

References m_Default.

Referenced by resetValue().

931 {
932 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
933  return m_Default.load();
934 #else
935  return m_Default;
936 #endif
937 }
QAtomicInt m_Default
Definition: qcepproperty.h:157

Here is the caller graph for this function:

void QcepIntProperty::incValue ( int  step)
slot

Definition at line 982 of file qcepproperty.cpp.

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

983 {
984  if (qcepDebug(DEBUG_PROPERTIES) || debug()) {
985  printMessage(tr("%1: QcepIntProperty::incValue(int %2)")
986  .arg(name()).arg(step));
987  }
988 
989  if (step) {
990  m_Value.fetchAndAddOrdered(step);
991 
993 
994  if (saver) {
995  saver->changed(this);
996  }
997 
998  emit valueChanged(value(), incIndex(1));
999  emit stringValueChanged(tr("%1").arg(value()));
1000  }
1001 }
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:158
int value() const
QString name() const
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
void stringValueChanged(QString val)
int debug() const
void valueChanged(int val, int index)
QcepSettingsSaverWPtr m_Saver
Definition: qcepproperty.h:70

Here is the call graph for this function:

void QcepIntProperty::linkTo ( QSpinBox *  spinBox)

Definition at line 1017 of file qcepproperty.cpp.

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

1018 {
1019  if (qcepDebug(DEBUG_PROPERTIES) || debug()) {
1020  printMessage(tr("%1: QcepIntProperty::linkTo(QSpinBox *%2)")
1021  .arg(name()).HEXARG(spinBox));
1022  }
1023 
1025  = new QcepIntPropertySpinBoxHelper(spinBox, this);
1026 
1027  helper->moveToThread(spinBox->thread());
1028  helper->connect();
1029 
1030  spinBox -> setValue(value());
1031  spinBox -> setKeyboardTracking(false);
1032 
1033  setWidgetToolTip(spinBox);
1034 
1035  connect(this, SIGNAL(valueChanged(int, int)), helper, SLOT(setValue(int, int)));
1036  connect(helper, SIGNAL(valueChanged(int, int)), this, SLOT(setValue(int, int)));
1037 }
void setValue(int val, int index)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void setWidgetToolTip(QWidget *widget)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
int value() const
QString name() const
#define HEXARG(a)
Definition: qcepdebug.h:50
int debug() const
void valueChanged(int val, int index)

Here is the call graph for this function:

void QcepIntProperty::linkTo ( QComboBox *  comboBox)

Definition at line 1039 of file qcepproperty.cpp.

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

1040 {
1041  if (qcepDebug(DEBUG_PROPERTIES) || debug()) {
1042  printMessage(tr("%1: QcepIntProperty::linkTo(QComboBox *%2)")
1043  .arg(name()).HEXARG(comboBox));
1044  }
1045 
1047  = new QcepIntPropertyComboBoxHelper(comboBox, this);
1048 
1049  helper->moveToThread(comboBox->thread());
1050  helper->connect();
1051 
1052  comboBox -> setCurrentIndex(value());
1053 
1054  setWidgetToolTip(comboBox);
1055 
1056  connect(this, SIGNAL(valueChanged(int, int)), helper, SLOT(setCurrentIndex(int, int)));
1057  connect(helper, SIGNAL(currentIndexChanged(int, int)), this, SLOT(setValue(int, int)));
1058 }
void setValue(int val, int index)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void setWidgetToolTip(QWidget *widget)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
int value() const
QString name() const
#define HEXARG(a)
Definition: qcepdebug.h:50
int debug() const
void valueChanged(int val, int index)

Here is the call graph for this function:

void QcepIntProperty::linkTo ( QLabel *  label)

Definition at line 1060 of file qcepproperty.cpp.

References QcepProperty::setWidgetToolTip(), stringValueChanged(), and value().

1061 {
1062  {
1063  label -> setText(tr("%1").arg(value()));
1064 
1065  setWidgetToolTip(label);
1066 
1067  connect(this, SIGNAL(stringValueChanged(QString)), label, SLOT(setText(QString)));
1068  }
1069 }
void setWidgetToolTip(QWidget *widget)
int value() const
void stringValueChanged(QString val)

Here is the call graph for this function:

void QcepIntProperty::linkTo ( QProgressBar *  progress)

Definition at line 1071 of file qcepproperty.cpp.

References setValue(), QcepProperty::setWidgetToolTip(), and valueChanged().

1072 {
1073  setWidgetToolTip(progress);
1074 
1075  connect(this, SIGNAL(valueChanged(int,int)), progress, SLOT(setValue(int)));
1076 }
void setValue(int val, int index)
void setWidgetToolTip(QWidget *widget)
void valueChanged(int val, int index)

Here is the call graph for this function:

void QcepIntProperty::linkTo ( QLCDNumber *  number)

Definition at line 1078 of file qcepproperty.cpp.

References QcepProperty::setWidgetToolTip(), value(), and valueChanged().

1079 {
1080  number -> display(value());
1081 
1082  setWidgetToolTip(number);
1083 
1084  connect(this, SIGNAL(valueChanged(int,int)), number, SLOT(display(int)));
1085 }
void setWidgetToolTip(QWidget *widget)
int value() const
void valueChanged(int val, int index)

Here is the call graph for this function:

void QcepIntProperty::resetValue ( )
slot

Definition at line 1008 of file qcepproperty.cpp.

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

1009 {
1010  if (qcepDebug(DEBUG_PROPERTIES) || debug()) {
1011  printMessage(tr("%1: QcepIntProperty::resetValue").arg(name()));
1012  }
1013 
1015 }
void setValue(int val, int index)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
int defaultValue() const
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QString name() const
int debug() const

Here is the call graph for this function:

void QcepIntProperty::setDefaultValue ( int  val)
slot

Definition at line 1003 of file qcepproperty.cpp.

References m_Default.

1004 {
1005  m_Default.fetchAndStoreOrdered(val);
1006 }
QAtomicInt m_Default
Definition: qcepproperty.h:157
void QcepIntProperty::setValue ( int  val,
int  index 
)
slot

Definition at line 939 of file qcepproperty.cpp.

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

Referenced by linkTo(), and resetValue().

940 {
941  if (debug()) {
942  printMessage(tr("%1 QcepIntProperty::setValue(int %2, int %3) [%4]")
943  .arg(name()).arg(val).arg(index).arg(this->index()));
944  }
945 
946  if (index == this->index()) {
947  setValue(val);
948  }
949 }
void setValue(int val, int index)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QString name() const
int debug() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepIntProperty::setValue ( int  val)
slot

Definition at line 951 of file qcepproperty.cpp.

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

952 {
954  printMessage(tr("%1: QcepIntProperty::setValue(int %2)")
955  .arg(name()).arg(val));
956  }
957 
958 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
959  int curVal = m_Value.load();
960 #else
961  int curVal = m_Value;
962 #endif
963  if (val != curVal) {
964  if (debug()) {
965  printMessage(tr("%1: QcepIntProperty::setValue(int %2) [%3]")
966  .arg(name()).arg(val).arg(index()));
967  }
968 
969  m_Value.fetchAndStoreOrdered(val);
970 
972 
973  if (saver) {
974  saver->changed(this);
975  }
976 
977  emit valueChanged(val, incIndex(1));
978  emit stringValueChanged(tr("%1").arg(val));
979  }
980 }
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:158
QString name() const
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
void stringValueChanged(QString val)
int debug() const
void valueChanged(int val, int index)
QcepSettingsSaverWPtr m_Saver
Definition: qcepproperty.h:70

Here is the call graph for this function:

void QcepIntProperty::stringValueChanged ( QString  val)
signal

Referenced by incValue(), linkTo(), and setValue().

Here is the caller graph for this function:

int QcepIntProperty::value ( ) const

Definition at line 921 of file qcepproperty.cpp.

References m_Value.

Referenced by incValue(), and linkTo().

922 {
923 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
924  return m_Value.load();
925 #else
926  return m_Value;
927 #endif
928 }
QAtomicInt m_Value
Definition: qcepproperty.h:158

Here is the caller graph for this function:

void QcepIntProperty::valueChanged ( int  val,
int  index 
)
signal

Member Data Documentation

QAtomicInt QcepIntProperty::m_Default
private

Definition at line 157 of file qcepproperty.h.

Referenced by defaultValue(), and setDefaultValue().

QAtomicInt QcepIntProperty::m_Value
private

Definition at line 158 of file qcepproperty.h.

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


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