Beter whitespace
parent
c87339ed6a
commit
4dba74acbd
|
@ -815,10 +815,10 @@ QVariant TimeSeries::cos(int row) const
|
||||||
|
|
||||||
bool TimeSeries::setCos(int row, const QVariant& value)
|
bool TimeSeries::setCos(int row, const QVariant& value)
|
||||||
{
|
{
|
||||||
bool set = false;
|
|
||||||
if (!value.canConvert(qMetaTypeId<float>())) {
|
if (!value.canConvert(qMetaTypeId<float>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool set = false;
|
||||||
set = time_series_set_data_cos(m_d, row, value.value<float>());
|
set = time_series_set_data_cos(m_d, row, value.value<float>());
|
||||||
if (set) {
|
if (set) {
|
||||||
QModelIndex index = createIndex(row, 0, row);
|
QModelIndex index = createIndex(row, 0, row);
|
||||||
|
@ -836,10 +836,10 @@ QVariant TimeSeries::sin(int row) const
|
||||||
|
|
||||||
bool TimeSeries::setSin(int row, const QVariant& value)
|
bool TimeSeries::setSin(int row, const QVariant& value)
|
||||||
{
|
{
|
||||||
bool set = false;
|
|
||||||
if (!value.canConvert(qMetaTypeId<float>())) {
|
if (!value.canConvert(qMetaTypeId<float>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool set = false;
|
||||||
set = time_series_set_data_sin(m_d, row, value.value<float>());
|
set = time_series_set_data_sin(m_d, row, value.value<float>());
|
||||||
if (set) {
|
if (set) {
|
||||||
QModelIndex index = createIndex(row, 0, row);
|
QModelIndex index = createIndex(row, 0, row);
|
||||||
|
@ -857,10 +857,10 @@ QVariant TimeSeries::time(int row) const
|
||||||
|
|
||||||
bool TimeSeries::setTime(int row, const QVariant& value)
|
bool TimeSeries::setTime(int row, const QVariant& value)
|
||||||
{
|
{
|
||||||
bool set = false;
|
|
||||||
if (!value.canConvert(qMetaTypeId<float>())) {
|
if (!value.canConvert(qMetaTypeId<float>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool set = false;
|
||||||
set = time_series_set_data_time(m_d, row, value.value<float>());
|
set = time_series_set_data_time(m_d, row, value.value<float>());
|
||||||
if (set) {
|
if (set) {
|
||||||
QModelIndex index = createIndex(row, 0, row);
|
QModelIndex index = createIndex(row, 0, row);
|
||||||
|
|
|
@ -162,6 +162,7 @@ void writeModelGetterSetter(QTextStream& cpp, const QString& index,
|
||||||
cpp << QString("bool %1::set%2(const QModelIndex& index, const QVariant& value)\n{\n")
|
cpp << QString("bool %1::set%2(const QModelIndex& index, const QVariant& value)\n{\n")
|
||||||
.arg(o.name, upperInitial(ip.name));
|
.arg(o.name, upperInitial(ip.name));
|
||||||
}
|
}
|
||||||
|
cpp << QString(" if (!value.canConvert(qMetaTypeId<%1>())) {\n return false;\n }\n").arg(ip.type.name);
|
||||||
cpp << " bool set = false;\n";
|
cpp << " bool set = false;\n";
|
||||||
if (ip.optional) {
|
if (ip.optional) {
|
||||||
QString test = "!value.isValid()";
|
QString test = "!value.isValid()";
|
||||||
|
@ -173,10 +174,9 @@ void writeModelGetterSetter(QTextStream& cpp, const QString& index,
|
||||||
.arg(lcname, snakeCase(ip.name), idx) << endl;
|
.arg(lcname, snakeCase(ip.name), idx) << endl;
|
||||||
cpp << " } else\n";
|
cpp << " } else\n";
|
||||||
}
|
}
|
||||||
cpp << QString(" if (!value.canConvert(qMetaTypeId<%1>())) {\n return false;\n }\n").arg(ip.type.name);
|
|
||||||
QString val = QString("value.value<%1>()").arg(ip.type.name);
|
QString val = QString("value.value<%1>()").arg(ip.type.name);
|
||||||
if (ip.type.isComplex()) {
|
if (ip.type.isComplex()) {
|
||||||
cpp << QString(" const %1 s = %2;").arg(ip.type.name, val);
|
cpp << QString(" const %1 s = %2;\n").arg(ip.type.name, val);
|
||||||
if (ip.type.name == "QString") {
|
if (ip.type.name == "QString") {
|
||||||
val = "s.utf16(), s.length()";
|
val = "s.utf16(), s.length()";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -110,11 +110,12 @@ QVariant Persons::userName(int row) const
|
||||||
|
|
||||||
bool Persons::setUserName(int row, const QVariant& value)
|
bool Persons::setUserName(int row, const QVariant& value)
|
||||||
{
|
{
|
||||||
bool set = false;
|
|
||||||
if (!value.canConvert(qMetaTypeId<QString>())) {
|
if (!value.canConvert(qMetaTypeId<QString>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const QString s = value.value<QString>(); set = persons_set_data_user_name(m_d, row, s.utf16(), s.length());
|
bool set = false;
|
||||||
|
const QString s = value.value<QString>();
|
||||||
|
set = persons_set_data_user_name(m_d, row, s.utf16(), s.length());
|
||||||
if (set) {
|
if (set) {
|
||||||
QModelIndex index = createIndex(row, 0, row);
|
QModelIndex index = createIndex(row, 0, row);
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
|
|
@ -126,11 +126,12 @@ QVariant Persons::userName(const QModelIndex& index) const
|
||||||
|
|
||||||
bool Persons::setUserName(const QModelIndex& index, const QVariant& value)
|
bool Persons::setUserName(const QModelIndex& index, const QVariant& value)
|
||||||
{
|
{
|
||||||
bool set = false;
|
|
||||||
if (!value.canConvert(qMetaTypeId<QString>())) {
|
if (!value.canConvert(qMetaTypeId<QString>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const QString s = value.value<QString>(); set = persons_set_data_user_name(m_d, index.internalId(), s.utf16(), s.length());
|
bool set = false;
|
||||||
|
const QString s = value.value<QString>();
|
||||||
|
set = persons_set_data_user_name(m_d, index.internalId(), s.utf16(), s.length());
|
||||||
if (set) {
|
if (set) {
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue