本文整理汇总了C++中IdList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ IdList::isEmpty方法的具体用法?C++ IdList::isEmpty怎么用?C++ IdList::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdList
的用法示例。
在下文中一共展示了IdList::isEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void SubprogramBlock::run()
{
const Id logicalId = mGraphicalModelApi->logicalId(id());
const QString name = mLogicalModelApi->name(logicalId);
const QString validName = utils::NameNormalizer::normalizeStrongly(name, false);
if (validName.isEmpty()) {
error(tr("Please enter valid c-style name for subprogram \"") + name + "\"");
return;
}
const QList<DynamicParameter> parameters = dynamicParameters();
for (const DynamicParameter ¶m : parameters) {
if (param.type == "bool") {
setVariableValue<bool>(param.name, evalCode<bool>(param.code));
} else if (param.type == "int") {
setVariableValue<int>(param.name, evalCode<int>(param.code));
} else if (param.type == "float") {
setVariableValue<qreal>(param.name, evalCode<qreal>(param.code));
} else {
setVariableValue<QString>(param.name, evalCode<QString>(param.code));
}
}
const Id logicalDiagram = mLogicalModelApi->logicalRepoApi().outgoingExplosion(logicalId);
const IdList diagrams = mGraphicalModelApi->graphicalIdsByLogicalId(logicalDiagram);
if (!diagrams.isEmpty()) {
emit stepInto(diagrams[0]);
}
}
示例2: setItemsToDelete
void MultipleRemoveCommand::setItemsToDelete(IdList &itemsToDelete)
{
IdList itemsToUpdate;
addEdgesToBeDeleted(itemsToDelete);
// QGraphicsScene::selectedItems() returns items in no particular order,
// so we should handle parent-child relationships manually
while (!itemsToDelete.isEmpty()) {
const Id currentItem = itemsToDelete.at(0);
const IdList children = mGraphicalApi.children(currentItem);
foreach (const Id &child, children) {
itemsToDelete.removeAll(child);
// Child remove commands will be added in currentItem delete command
}
const bool isEdge = !mLogicalApi.editorManagerInterface().isGraphicalElementNode(currentItem);
if (isEdge) {
const Id src = mGraphicalApi.from(currentItem);
if (src != Id() && !itemsToUpdate.contains(src)) {
itemsToUpdate.append(src);
}
const Id dst = mGraphicalApi.to(currentItem);
if (dst != Id() && !itemsToUpdate.contains(dst)) {
itemsToUpdate.append(dst);
}
insertPreAction(graphicalDeleteCommand(currentItem), 0);
} else {
addPreAction(graphicalDeleteCommand(currentItem));
}
itemsToDelete.removeAll(currentItem);
}
示例3: generateToJava
QString JavaHandler::generateToJava(QString const &pathToDir)
{
mErrorText = "";
this->pathToDir = pathToDir;
Id repoId = ROOT_ID;
if (checkTheModel()) {
IdList allDiagrams = mApi.children(repoId);
IdList classDiagrams;
//separate just class diagrams, because they are the main diagrams, others are connected
foreach (Id const aDiagram, allDiagrams) {
if (objectType(aDiagram) == "ClassDiagram_ClassDiagramNode") {
classDiagrams.append(aDiagram);
}
if (objectType(aDiagram) == "ActivityDiagram_ActivityDiagramNode") {
//If there is no connected Class Methods it won't be serialized
IdList incomingConnections = mApi.incomingConnections(aDiagram);
if (incomingConnections.isEmpty()) {
addError("Unable to serialize object " + objectType(aDiagram) + " with type: " + aDiagram.toString() + ". It is not connected to some class method.");
}
}
}
foreach (Id const classDiagram, classDiagrams) {
serializeChildren(classDiagram);
}
}
示例4: join
QString join(IdList ids)
{
QString result;
if (ids.isEmpty())
return result;
result = QString::number(ids.takeFirst());
foreach (auto id, ids)
result += QLatin1Literal(",") % QString::number(id);
return result;
}
示例5: checkFinalNodeRule
void RulesChecker::checkFinalNodeRule(qReal::Id const &node)
{
bool isLastNode = isEndNode(node);
if (!isLastNode && !isStartNode(node)) {
return;
}
IdList incorrectLinks = (isLastNode) ? outgoingSequenceFlow(node) : incomingSequenceFlow(node);
if (!incorrectLinks.isEmpty()) {
postError((isLastNode) ? linkFromFinalNode : linkToStartNode, node);
foreach (Id const &key, incorrectLinks) {
mDiagramElements.removeOne(key);
}
示例6: constructConverter
qReal::ProjectConverter SaveConvertionManager::constructConverter(const QString &oldVersion
, const QString &newVersion
, const QList<LogicalFilter> &logicalFilters
, const QList<GraphicalFilter> &graphicalFilters
, const std::function<bool(const qReal::Id &)> &condition
)
{
return ProjectConverter(editor(), Version::fromString(oldVersion), Version::fromString(newVersion)
, [=](GraphicalModelAssistInterface &graphicalApi, LogicalModelAssistInterface &logicalApi)
{
bool modificationsMade = false;
for (const Id &block : elementsOfRobotsDiagrams(logicalApi)) {
const Id logicalBlock = graphicalApi.isGraphicalId(block)
? graphicalApi.logicalId(block)
: block;
if (!condition(logicalBlock)) {
continue;
}
for (const auto &filter : logicalFilters) {
modificationsMade |= filter(logicalBlock, logicalApi);
}
if (graphicalFilters.isEmpty()) {
// A small optimization not to count graphical id.
continue;
}
Id graphicalBlock;
if (graphicalApi.isGraphicalId(block)) {
graphicalBlock = block;
} else {
const IdList graphicalIds = graphicalApi.graphicalIdsByLogicalId(logicalBlock);
if (graphicalIds.isEmpty()) {
continue;
}
graphicalBlock = graphicalIds.first();
}
for (const auto &filter : graphicalFilters) {
modificationsMade |= filter(graphicalBlock, graphicalApi);
}
}
return modificationsMade ? ProjectConverter::Success : ProjectConverter::NoModificationsMade;
});
}
示例7: run
void SubprogramBlock::run()
{
Id const logicalId = mGraphicalModelApi->logicalId(id());
QString const name = mLogicalModelApi->name(logicalId);
Tracer::debug(tracer::enums::blocks, "SubprogramBlock::run", "stepping into " + name);
QString const validName = utils::NameNormalizer::normalizeStrongly(name, false);
if (validName.isEmpty()) {
error(tr("Please enter valid c-style name for subprogram \"") + name + "\"");
return;
}
Id const logicalDiagram = mLogicalModelApi->logicalRepoApi().outgoingExplosion(logicalId);
IdList const diagrams = mGraphicalModelApi->graphicalIdsByLogicalId(logicalDiagram);
if (!diagrams.isEmpty()) {
emit stepInto(diagrams[0]);
}
}
示例8: makeDetour
bool RulesChecker::makeDetour(Id const ¤tNode, IdList &usedNodes)
{
if (usedNodes.contains(currentNode)) {
return false; // cannot learn some more here
}
if (!mDiagramElements.contains(currentNode)) {
return true; // we already have made detour of forward nodes
}
mDiagramElements.removeOne(currentNode);
usedNodes.append(currentNode);
if (currentNode.element() != "MessageFlow" && isLink(currentNode)) {
Id const destinationNode = mGRepoApi->to(currentNode);
if (destinationNode == Id::rootId()) {
postError(noEndNode, currentNode); // we've already put info that link is incorrect
return true; // done end-job for link(50%)
}
return makeDetour(destinationNode, usedNodes);
}
if (isEndNode(currentNode)) {
return true; // we found real end-node
}
IdList frontNodes = outgoingSequenceFlow(currentNode);
if (frontNodes.isEmpty()) {
postError(noEndNode, currentNode);
return true; // done end-job for nodes (now 100%)
}
bool foundFinalNode = false; // to catch that we have found end-node anywhere in path
foreach (Id const &node, frontNodes) {
if (makeDetour(node, usedNodes)) {
foundFinalNode = true;
}
}
return foundFinalNode;
}
示例9: acceptPropertyModifications
void EditPropertiesDialog::acceptPropertyModifications()
{
if (mPropertyName.isEmpty()) {
const IdList sameNameProperties = mInterpreterEditorManager.propertiesWithTheSameName(mId, ""
, mUi->displayedNameEdit->text());
if (sameNameProperties.isEmpty()) {
mPropertyName = mUi->displayedNameEdit->text();
} else {
mPropertyName = mUi->displayedNameEdit->text() + "_" + sameNameProperties.count();
}
mInterpreterEditorManager.addProperty(mId, mPropertyName);
// set property default value for elements on diagram
for (const auto &elementOnDiagram: mElementsOnDiagram) {
mApi.setProperty(elementOnDiagram, mPropertyName, mUi->defaultValueEdit->text());
}
mElementsOnDiagram.clear();
}
if (mMode == editExisting
&& mInterpreterEditorManager.typeName(mId, mPropertyName) != mUi->attributeTypeEdit->text()
)
{
// TODO: Remove connects.
QMessageBox messageBox(tr("Warning:")
, tr("You changed the type of property. In case of incorrect conversion it may"
" result in resetting of the existing property value.")
, QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton);
messageBox.button(QMessageBox::Ok)->setText(tr("Proceed anyway"));
messageBox.button(QMessageBox::Cancel)->setText(tr("Cancel the type conversion"));
connect(messageBox.button(QMessageBox::Cancel), &QAbstractButton::clicked
, this, &EditPropertiesDialog::messageBoxCancel);
connect(messageBox.button(QMessageBox::Ok), &QAbstractButton::clicked
, this, &EditPropertiesDialog::updateProperties);
messageBox.exec();
} else {
updateProperties();
}
}
示例10: okButtonClicked
void EdgePropertiesDialog::okButtonClicked()
{
if (mUi->nameEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("All required properties should be filled!"));
} else {
mEdgeName = mUi->nameEdit->text();
IdList const edgesWithTheSameNameList = mEditorManagerProxy.elementsWithTheSameName(mDiagram
, mUi->nameEdit->text(), "MetaEntityEdge");
if (!edgesWithTheSameNameList.isEmpty()) {
mEdgeName = mUi->nameEdit->text() + "_" + edgesWithTheSameNameList.count();
mRestoreElementDialog = new RestoreElementDialog(this, mMainWindow, mEditorManagerProxy, edgesWithTheSameNameList);
mRestoreElementDialog->setModal(true);
mRestoreElementDialog->show();
connect(mRestoreElementDialog, &qReal::RestoreElementDialog::createNewChosen
, this, &EdgePropertiesDialog::addEdgeElement);
connect(mRestoreElementDialog, &qReal::RestoreElementDialog::restoreChosen
, this, &EdgePropertiesDialog::done);
} else {
addEdgeElement();
}
}
}
示例11: okButtonClicked
void EditPropertiesDialog::okButtonClicked()
{
if (mUi->attributeTypeEdit->text().isEmpty() || mUi->displayedNameEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("All required properties should be filled!"));
} else {
const IdList propertiesWithTheSameNameList = mInterpreterEditorManager.propertiesWithTheSameName(mId
, mPropertyName, mUi->displayedNameEdit->text());
if (!propertiesWithTheSameNameList.isEmpty()) {
hide();
mRestorePropertiesDialog = new RestorePropertiesDialog(this, mInterpreterEditorManager);
mRestorePropertiesDialog->fillSameNamePropertiesTW(propertiesWithTheSameNameList
, mUi->displayedNameEdit->text());
mRestorePropertiesDialog->setWindowTitle(tr("Restore properties"));
mRestorePropertiesDialog->setModal(true);
mRestorePropertiesDialog->show();
connect(mRestorePropertiesDialog, &qReal::RestorePropertiesDialog::createNewChosen
, this, &EditPropertiesDialog::acceptPropertyModifications);
connect(mRestorePropertiesDialog, &qReal::RestorePropertiesDialog::finished
, this, &EditPropertiesDialog::done);
} else {
acceptPropertyModifications();
}
}
}
示例12: settings
//.........这里部分代码省略.........
mUi->actionSwitch_on_alignment->setChecked(settings.value("ActivateAlignment", true).toBool());
connect(mUi->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
connect(mUi->actionShowSplash, SIGNAL(toggled(bool)), this, SLOT (toggleShowSplash(bool)));
connect(mUi->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
connect(mUi->actionSave, SIGNAL(triggered()), this, SLOT(saveAll()));
connect(mUi->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
connect(mUi->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(mUi->actionMakeSvg, SIGNAL(triggered()), this, SLOT(makeSvg()));
connect(mUi->actionDeleteFromDiagram, SIGNAL(triggered()), this, SLOT(deleteFromDiagram()));
connect(mUi->tabs, SIGNAL(currentChanged(int)), this, SLOT(changeMiniMapSource(int)));
connect(mUi->tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(mUi->actionGenerate_Editor, SIGNAL(triggered()), this, SLOT(generateEditor()));
connect(mUi->actionParse_Editor_xml, SIGNAL(triggered()), this, SLOT(parseEditorXml()));
connect(mUi->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));
connect(mUi->actionPlugins, SIGNAL(triggered()), this, SLOT(settingsPlugins()));
connect(mUi->actionShow_grid, SIGNAL(toggled(bool)), this, SLOT(showGrid(bool)));
connect(mUi->actionShow_alignment, SIGNAL(toggled(bool)), this, SLOT(showAlignment(bool)));
connect(mUi->actionSwitch_on_grid, SIGNAL(toggled(bool)), this, SLOT(switchGrid(bool)));
connect(mUi->actionSwitch_on_alignment, SIGNAL(toggled(bool)), this, SLOT(switchAlignment(bool)));
connect(mUi->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(mUi->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(mUi->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(mUi->actionShow, SIGNAL(triggered()), this, SLOT(showGestures()));
connect(mUi->minimapZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(adjustMinimapZoom(int)));
connect(mUi->actionClear, SIGNAL(triggered()), this, SLOT(exterminate()));
connect(mUi->actionRun, SIGNAL(triggered()), this, SLOT(run()));
connect(mUi->actionStop_Running, SIGNAL(triggered()), this, SLOT(stop()));
connect(mUi->actionStop_Robot, SIGNAL(triggered()), this, SLOT(stopRobot()));
connect(mUi->actionRobot_Settings, SIGNAL(triggered()), this, SLOT(showRobotSettingsDialog()));
adjustMinimapZoom(mUi->minimapZoomSlider->value());
initGridProperties();
// Step 3: Ui connects are done.
progress->setValue(40);
mUi->paletteDock->setWidget(mUi->paletteToolbox);
mUi->errorDock->setWidget(mUi->errorListWidget);
mUi->errorListWidget->init(this);
mUi->errorDock->setVisible(false);
mUi->propertyEditor->setModel(&mPropertyModel);
mUi->propertyEditor->verticalHeader()->hide();
mUi->propertyEditor->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
mUi->propertyEditor->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
mUi->propertyEditor->setItemDelegate(&mDelegate);
connect(mUi->graphicalModelExplorer, SIGNAL(clicked(QModelIndex const &)), this, SLOT(graphicalModelExplorerClicked(QModelIndex)));
connect(mUi->logicalModelExplorer, SIGNAL(clicked(QModelIndex const &)), this, SLOT(logicalModelExplorerClicked(QModelIndex)));
mUi->graphicalModelExplorer->addAction(mUi->actionDeleteFromDiagram);
mUi->logicalModelExplorer->addAction(mUi->actionDeleteFromDiagram);
// Step 4: Property editor and model explorers are initialized.
progress->setValue(60);
loadPlugins();
showMaximized();
// Step 5: Plugins are loaded.
progress->setValue(70);
settings.beginGroup("MainWindow");
if (!settings.value("maximized", true).toBool()) {
showNormal();
resize(settings.value("size", QSize(1024, 800)).toSize());
move(settings.value("pos", QPoint(0, 0)).toPoint());
}
settings.endGroup();
QString workingDir = settings.value("workingDir", ".").toString();
mRootIndex = QModelIndex();
mModels = new models::Models(workingDir, mEditorManager);
// Step 6: Save loaded, models initialized.
progress->setValue(80);
mListenerManager = new ListenerManager(mEditorManager.listeners()
, mModels->logicalModelAssistApi(), mModels->graphicalModelAssistApi());
IdList missingPlugins = mEditorManager.checkNeededPlugins(mModels->logicalRepoApi(), mModels->graphicalRepoApi());
if (!missingPlugins.isEmpty()) {
QString text = tr("These plugins are not present, but needed to load the save:\n");
foreach (Id const id, missingPlugins)
text += id.editor() + "\n";
QMessageBox::warning(this, tr("Some plugins are missing"), text);
close();
return;
}