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


C++ Terms::set方法代码示例

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


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

示例1: assign

void TableModelVariablesAssigned::assign(const Terms &variables)
{
	if (_boundTo == NULL)
		return;

	Terms v;

	if (_boundTo->onlyOneTerm())
	{
		if (variables.size() > 0)
			v.add(variables.at(0));

		if (_variables.size() > 0)
		{
			_toSendBack.set(_variables);
			_variables.clear();
			QTimer::singleShot(0, this, SLOT(sendBack()));
		}
	}
	else
	{
		v.set(_variables);
		v.add(variables);
	}

	setAssigned(v);

	emit assignedTo(variables);
}
开发者ID:MaxG87,项目名称:jasp-desktop,代码行数:29,代码来源:tablemodelvariablesassigned.cpp

示例2: dropMimeData

bool TableModelVariables::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
	if (_dragActions == Qt::CopyAction && _dropActions == Qt::MoveAction && action == Qt::MoveAction) // if delete
		return true;

	if ( ! canDropMimeData(data, action, row, column, parent))
		return false;

	if (action == Qt::IgnoreAction)
		return true;

	if (data->hasFormat(_mimeType))
	{
		QByteArray encodedData = data->data(_mimeType);

		Terms variables;
		variables.set(encodedData);

		beginResetModel();
		_variables.add(variables);
		endResetModel();

		return true;
	}

	return false;
}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:27,代码来源:tablemodelvariables.cpp

示例3: unassign

void TableModelVariablesAssigned::unassign(const Terms &variables)
{
	Terms variablesToKeep;
	variablesToKeep.set(_variables);
	variablesToKeep.remove(variables);
	setAssigned(variablesToKeep);

	emit unassigned(variables);
}
开发者ID:MaxG87,项目名称:jasp-desktop,代码行数:9,代码来源:tablemodelvariablesassigned.cpp

示例4: canDropMimeData

bool TableModelAnovaWithinSubjectCells::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
{
	Q_UNUSED(row);

	int colNo = (column == -1 ? parent.column() : column);
	int rowNo = (row    == -1 ? parent.row()    : row);

	if (_boundTo == NULL)
		return false;

	if (action == Qt::IgnoreAction)
		return true;

	if ( ! data->hasFormat("application/vnd.list.variable"))
		return false;

	if (action != Qt::MoveAction)
		return false;

	if (colNo != 0)
		return false;

	QByteArray encodedData = data->data("application/vnd.list.variable");

	Terms dropped;
	dropped.set(encodedData);

	foreach (const Term &term, dropped)
	{
		if ( ! isAllowed(term))
			return false;
	}

	if (rowNo == -1)
	{
		int available = 0;

		for (int i = 0; i < _variables.size(); i++)
		{
			if (_variables.at(i) == "")
				available++;
		}

		return dropped.size() <= available;
	}
	else
	{
		return dropped.size() <= _variables.size() - rowNo;
	}

	return true;
}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:52,代码来源:tablemodelanovawithinsubjectcells.cpp

示例5: sourceVariablesChanged

void TableModelVariablesAssigned::sourceVariablesChanged()
{
	emit assignmentsChanging();

	const Terms &variables = _source->allVariables();
	Terms variablesToKeep;
	bool variableRemoved = false;

	variablesToKeep.set(_variables);
	variableRemoved = variablesToKeep.discardWhatDoesntContainTheseComponents(variables);

	if (variableRemoved)
		setAssigned(variablesToKeep);

	emit assignmentsChanged();
}
开发者ID:MaxG87,项目名称:jasp-desktop,代码行数:16,代码来源:tablemodelvariablesassigned.cpp

示例6: canDropMimeData

bool TableModelVariables::canDropMimeData(const QMimeData *data, Qt::DropAction action, int, int, const QModelIndex &) const
{
	if (_dragActions == Qt::CopyAction && _dropActions == Qt::MoveAction && action == Qt::MoveAction) // if delete
		return true;

	if (data->hasFormat(_mimeType))
	{
		QByteArray encodedData = data->data(_mimeType);

		Terms variables;
		variables.set(encodedData);

		foreach (const Term &variable, variables)
		{
			if ( ! isAllowed(variable))
				return false;
		}

		return true;
	}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:20,代码来源:tablemodelvariables.cpp

示例7: canDropMimeData

bool TableModelVariablesAssigned::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
{
	if (_boundTo == NULL)
		return false;

	if (isDroppingToSelf(data))
		return false;

	if ( ! TableModelVariables::canDropMimeData(data, action, row, column, parent))
		return false;

	if (_boundTo->onlyOneTerm())
	{
		QByteArray encodedData = data->data(_mimeType);

		Terms variables;
		variables.set(encodedData);

		if (variables.size() != 1)
			return false;
	}

	return true;
}
开发者ID:MaxG87,项目名称:jasp-desktop,代码行数:24,代码来源:tablemodelvariablesassigned.cpp

示例8: dropMimeData

bool TableModelAnovaWithinSubjectCells::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
	Q_UNUSED(column);

	if (action == Qt::IgnoreAction)
		return true;

	if ( ! canDropMimeData(data, action, row, column, parent))
		return false;

	//int colNo = (column == -1 ? parent.column() : column);
	int rowNo = (row    == -1 ? parent.row()    : row);

	QByteArray encodedData = data->data("application/vnd.list.variable");

	Terms dropped;
	dropped.set(encodedData);

	vector<string> droppedItems = dropped.asVector();

	beginResetModel();

	if (rowNo == -1)
	{
		int pos = 0;

		for (int i = 0; i < _variables.size(); i++)
		{
			if (_variables.at(i) == "")
				_variables[i] = droppedItems.at(pos++);

			if (pos >= droppedItems.size())
				break;
		}
	}
	else
	{
		int pos = 0;

		for (int i = rowNo; i < _variables.size(); i++)
		{
			string existingVariable = _variables.at(i);
			if (existingVariable != "")
				_toSendBack.add(existingVariable);

			_variables[i] = droppedItems[pos++];

			if (pos >= droppedItems.size())
				break;
		}

		if (_toSendBack.size() > 0)
			QTimer::singleShot(0, this, SLOT(sendBack()));
	}

	_boundTo->setValue(_variables);

	endResetModel();

	return true;
}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:61,代码来源:tablemodelanovawithinsubjectcells.cpp


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