本文整理汇总了C++中ModelNode::defaultNodeAbstractProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::defaultNodeAbstractProperty方法的具体用法?C++ ModelNode::defaultNodeAbstractProperty怎么用?C++ ModelNode::defaultNodeAbstractProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::defaultNodeAbstractProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNewTab
void AddTabDesignerAction::addNewTab()
{
QString tabName = AddTabToTabViewDialog::create(QStringLiteral("Tab"), Core::ICore::mainWindow());
if (!tabName.isEmpty()) {
QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath();
QString newFilePath = directoryPath +QStringLiteral("/") + tabName + QStringLiteral(".qml");
if (QFileInfo::exists(newFilePath)) {
Core::AsynchronousMessageBox::warning(tr("Naming Error"), tr("Component already exists."));
} else {
const QString sourceString = QStringLiteral("import QtQuick 2.1\nimport QtQuick.Controls 1.0\n\nItem {\n anchors.fill: parent\n}");
bool fileCreated = DocumentManager::createFile(newFilePath, sourceString);
if (fileCreated) {
DocumentManager::addFileToVersionControl(directoryPath, newFilePath);
ModelNode tabViewModelNode = findTabViewModelNode(selectionContext().currentSingleSelectedNode());
PropertyListType propertyList;
propertyList.append(QPair<PropertyName, QVariant>("source", QString(tabName + QStringLiteral(".qml"))));
propertyList.append(QPair<PropertyName, QVariant>("title", tabName));
ModelNode newTabModelNode = selectionContext().view()->createModelNode("QtQuick.Controls.Tab",
tabViewModelNode.majorVersion(),
tabViewModelNode.minorVersion(),
propertyList);
newTabModelNode.setIdWithRefactoring(newTabModelNode.view()->generateNewId(tabName));
tabViewModelNode.defaultNodeAbstractProperty().reparentHere(newTabModelNode);
}
}
}
}
示例2: addNewTab
void TabViewDesignerAction::addNewTab()
{
QString tabName = AddTabToTabViewDialog::create(QLatin1String("Tab"), Core::ICore::mainWindow());
if (!tabName.isEmpty()) {
QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath();
QString newFilePath = directoryPath +QLatin1String("/") + tabName + QLatin1String(".qml");
if (QFileInfo(newFilePath).exists()) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Naming Error"), tr("Component already exists."));
} else {
bool fileCreated = createFile(newFilePath);
if (fileCreated) {
addNewFileToVersionControl(directoryPath, newFilePath);
ModelNode tabViewModelNode = findTabViewModelNode(selectionContext().currentSingleSelectedNode());
PropertyListType propertyList;
propertyList.append(QPair<PropertyName, QVariant>("source", QString(tabName + QLatin1String(".qml"))));
propertyList.append(QPair<PropertyName, QVariant>("title", tabName));
ModelNode newTabModelNode = selectionContext().view()->createModelNode("QtQuick.Controls.Tab",
tabViewModelNode.majorVersion(),
tabViewModelNode.minorVersion(),
propertyList);
newTabModelNode.setId(newTabModelNode.view()->generateNewId(tabName));
tabViewModelNode.defaultNodeAbstractProperty().reparentHere(newTabModelNode);
}
}
}
}