Пример #1
0
/**
 * \brief Read XML row element
 */
bool Column::XmlReadRow(XmlStreamReader * reader)
{
	Q_ASSERT(reader->isStartElement() && reader->name() == "row");

	QString str;

	QXmlStreamAttributes attribs = reader->attributes();

	bool ok;
	int index = reader->readAttributeInt("index", &ok);
	if(!ok) {
		reader->raiseError(i18n("invalid or missing row index"));
		return false;
	}

	str = reader->readElementText();
	switch(columnMode()) {
		case AbstractColumn::Numeric:
			{
				double value = str.toDouble(&ok);
				if(!ok) {
					reader->raiseError(i18n("invalid row value"));
					return false;
				}
				setValueAt(index, value);
				break;
			}
		case AbstractColumn::Text:
			setTextAt(index, str);
			break;

		case AbstractColumn::DateTime:
		case AbstractColumn::Month:
		case AbstractColumn::Day:
			QDateTime date_time = QDateTime::fromString(str,"yyyy-dd-MM hh:mm:ss:zzz");
			setDateTimeAt(index, date_time);
			break;
	}

	return true;
}
Пример #2
0
void Column::Private::setTimeAt(int row, const QTime& new_value)
{
    if (d_data_type != SciDAVis::TypeQDateTime) return;

    setDateTimeAt(row, QDateTime(dateAt(row), new_value));
}
Пример #3
0
/**
 * \brief Set the content of row 'row'
 *
 * Use this only when columnMode() is DateTime, Month or Day
 */
void Column::setTimeAt(int row,const QTime& new_value)
{
    setStatisticsAvailable(false);
	setDateTimeAt(row, QDateTime(dateAt(row), new_value));
}