[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at yahoo.com
Fri Apr 23 20:29:30 CEST 2010
SVN commit 1118046 by kuemmel:
QSettings could not store the enums as non-ints
M +1 -1 asciiplugin.cpp
M +2 -2 asciisourceconfig.h
M +5 -2 namedparameter.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciiplugin.cpp #1118045:1118046
@@ -77,7 +77,7 @@
_readFields->setChecked(config._readFields);
_useDot->setChecked(config._useDot);
_fieldsLine->setValue(config._fieldsLine);
- AsciiSourceConfig::ColumnType ct = config._columnType;
+ AsciiSourceConfig::ColumnType ct = (AsciiSourceConfig::ColumnType) config._columnType.value();
if (ct == AsciiSourceConfig::Fixed) {
_fixed->setChecked(true);
} else if (ct == AsciiSourceConfig::Custom) {
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisourceconfig.h #1118045:1118046
@@ -63,8 +63,8 @@
NamedParameter<QString, Key_delimiters, Tag_delimiters> _delimiters;
NamedParameter<QString, Key_indexVector, Tag_indexVector> _indexVector;
NamedParameter<QString, Key_fileNamePattern, Tag_fileNamePattern> _fileNamePattern;
- NamedParameter<Interpretation, Key_indexInterpretation, Tag_indexInterpretation> _indexInterpretation;
- NamedParameter<ColumnType, Key_columnType, Tag_columnType> _columnType;
+ NamedParameter<int, Key_indexInterpretation, Tag_indexInterpretation> _indexInterpretation;
+ NamedParameter<int, Key_columnType, Tag_columnType> _columnType;
NamedParameter<QString, Key_columnDelimiter, Tag_columnDelimiter> _columnDelimiter;
NamedParameter<int, Key_columnWidth, Tag_columnWidth> _columnWidth;
NamedParameter<int, Key_dataLine, Tag_dataLine> _dataLine;
--- branches/work/kst/portto4/kst/src/datasources/ascii/namedparameter.h #1118045:1118046
@@ -35,13 +35,16 @@
}
void operator>>(QSettings& settings) {
- settings.setValue(Key, value());
+ const QVariant var = QVariant::fromValue<T>(value());
+ settings.setValue(Key, var);
}
void operator<<(QSettings& settings) {
const QVariant var = settings.value(Key);
- if (!var.isNull())
+ if (!var.isNull()) {
+ Q_ASSERT(var.canConvert<T>());
setValue(var.value<T>());
+ }
}
void operator>>(QXmlStreamWriter& xml) {
More information about the Kst
mailing list