当前位置: 首页>>代码示例>>C++>>正文


C++ AMDataSource::typeDescription方法代码示例

本文整理汇总了C++中AMDataSource::typeDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ AMDataSource::typeDescription方法的具体用法?C++ AMDataSource::typeDescription怎么用?C++ AMDataSource::typeDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AMDataSource的用法示例。


在下文中一共展示了AMDataSource::typeDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: data

QVariant AMScanSetModel::data(const QModelIndex & index, int role) const {
	if(!index.isValid())
		return QVariant();

	// scan-level index:
	///////////////////////////
	if(index.internalId() == -1 && index.row() < scans_.count() && index.column() == 0) {
		AMScan* scan = scans_.at(index.row());

		switch(role) {
		case Qt::DisplayRole: {
				QString rv = scan->fullName();
				if(scan->modified())
					rv.append( " (modified)");
				return rv;
			}
			break;
		case Qt::DecorationRole:
			/// \bug this is temporary and meaningless. It's just the color of the first data source in the scan.
			if(scan->dataSourceCount() > 0)
				return sourcePlotSettings_.at(index.row()).at(0).linePen.color();
			else
				return QVariant();
			break;
		case Qt::ToolTipRole:
			return QString("%1, #%2 (sample: %3): %4").arg(scan->name()).arg(scan->number()).arg(scan->sampleName()).arg(AMDateTimeUtils::prettyDateTime(scan->dateTime(), "h:mm:ssap"));
			break;
		case AM::DescriptionRole:
			return QString("%1, on %2").arg(AMDateTimeUtils::prettyDateTime(scan->dateTime())).arg(scan->sampleName());
		case AM::DateTimeRole:
			return scan->dateTime();
		case Qt::CheckStateRole:
			return QVariant();	/// \todo For now... No checking/unchecking scans.
			break;
		case AM::PointerRole:
			return qVariantFromValue(scan);
			break;
		case AM::ModifiedRole:
			return scan->modified();
		case AM::CanCloseRole:	// allows views to show the 'close' button beside each scan, to delete it. Do we want this on?
			return true;
		case AM::NameRole: {
				return scan->fullName();
			}
			break;
		default:
			return QVariant();
			break;
		}
	}


	// data source-level index:
	////////////////////////////
	if(index.internalId() >= 0 && index.internalId() < scans_.count() ) {
		AMScan* scan = scans_.at(index.internalId());

		if(index.row() < scan->dataSourceCount() && index.column() == 0) {
			AMDataSource* dataSource = scan->dataSourceAt(index.row());

			switch(role) {
			case Qt::DisplayRole:
				return QString("%1 (%2)").arg(dataSource->description(), dataSource->name());
				break;
			case Qt::DecorationRole:
				return sourcePlotSettings_.at(index.internalId()).at(index.row()).linePen.color();
				break;
			case Qt::ToolTipRole:
			case AM::NameRole:
				return dataSource->name();
			case AM::DescriptionRole:
				return dataSource->description();
			case AM::DetailedDescriptionRole:
				return QString("%1 (%2) From scan: %3\n%4").arg(dataSource->description(),
																dataSource->name(),
																scan->name(),
																//scan->evaluatedName(),
																dataSource->typeDescription());
				break;
			case Qt::CheckStateRole:	// this controls visibility on plots.
				if(isVisible(index.internalId(), index.row()))
					return Qt::Checked;
				else
					return Qt::Unchecked;
				break;
			case AM::PointerRole:
				return qVariantFromValue(dataSource);
				break;
			case AM::PriorityRole:
				return sourcePlotSettings_.at(index.internalId()).at(index.row()).priority;
				break;
			case AM::CanCloseRole:	// allows views to show the 'close' button beside each scan, to delete it.
				return true;
			case AM::LinePenRole:
				return sourcePlotSettings_.at(index.internalId()).at(index.row()).linePen;
			case AM::RankRole:
				return dataSource->rank();
			case AMScanSetModel::ColorMapRole:
				return qVariantFromValue(sourcePlotSettings_.at(index.internalId()).at(index.row()).colorMap);
			case AMScanSetModel::MarkerColorRole:
//.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,代码来源:AMScanSetModel.cpp


注:本文中的AMDataSource::typeDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。