本文整理汇总了C++中ModelNode::metaInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::metaInfo方法的具体用法?C++ ModelNode::metaInfo怎么用?C++ ModelNode::metaInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::metaInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isFileComponent
static bool isFileComponent(const ModelNode &node)
{
if (node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isFileComponent())
return true;
return false;
}
示例2: hasSourceWithFileComponent
static bool hasSourceWithFileComponent(const ModelNode &modelNode)
{
if (modelNode.isValid()
&& modelNode.metaInfo().isValid()
&& modelNode.metaInfo().isSubclassOf("QtQuick.Loader")
&& modelNode.hasVariantProperty("source"))
return true;
return false;
}
示例3: hasDelegateWithFileComponent
static bool hasDelegateWithFileComponent(const ModelNode &node)
{
if (node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isView()
&& node.hasNodeProperty("delegate")
&& node.nodeProperty("delegate").modelNode().metaInfo().isFileComponent())
return true;
return false;
}
示例4: getMajorVersionFromNode
static int getMajorVersionFromNode(const ModelNode &modelNode)
{
if (modelNode.metaInfo().isValid()) {
if (modelNode.type() == "QtQuick.QtObject" || modelNode.type() == "QtQuick.Item")
return modelNode.majorVersion();
foreach (const NodeMetaInfo &superClass, modelNode.metaInfo().superClasses()) {
if (modelNode.type() == "QtQuick.QtObject" || modelNode.type() == "QtQuick.Item")
return superClass.majorVersion();
}
}
return 1; //default
}
示例5: isLoaderWithSourceComponent
static bool isLoaderWithSourceComponent(const ModelNode &modelNode)
{
if (modelNode.isValid()
&& modelNode.metaInfo().isValid()
&& modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
if (modelNode.hasNodeProperty("sourceComponent"))
return true;
if (modelNode.hasNodeListProperty("component"))
return true;
}
return false;
}
示例6: wantHandleItem
int ColorTool::wantHandleItem(const ModelNode &modelNode) const
{
if (modelNode.metaInfo().hasProperty("color"))
return 10;
return 0;
}
示例7: handleDelegate
static void handleDelegate(const ModelNode &modelNode)
{
if (modelNode.metaInfo().isView()
&& modelNode.hasNodeProperty("delegate")
&& modelNode.nodeProperty("delegate").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource)
designDocument()->changeToSubComponent(modelNode.nodeProperty("delegate").modelNode());
}
示例8: wantHandleItem
int TextTool::wantHandleItem(const ModelNode &modelNode) const
{
if (modelNode.metaInfo().hasProperty("text"))
return 20;
return 0;
}
示例9: findTabViewModelNode
static ModelNode findTabViewModelNode(const ModelNode ¤tModelNode)
{
if (currentModelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView", -1, -1))
return currentModelNode;
else
return findTabViewModelNode(currentModelNode.parentProperty().parentModelNode());
}
示例10: openComponentSourcePropertyOfLoader
static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode)
{
QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally();
QHash<PropertyName, QVariant> propertyHash;
getProperties(modelNode, propertyHash);
ModelNode componentModelNode;
if (modelNode.hasNodeProperty("sourceComponent")) {
componentModelNode = modelNode.nodeProperty("sourceComponent").modelNode();
} else if (modelNode.hasNodeListProperty("component")) {
/*
* The component property should be a NodeProperty, but currently is a NodeListProperty, because
* the default property is always implcitly a NodeListProperty. This is something that has to be fixed.
*/
componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().first();
}
Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Core::Id(), Core::EditorManager::DoNotMakeVisible);
ModelNode rootModelNode = currentDesignDocument()->rewriterView()->rootModelNode();
applyProperties(rootModelNode, propertyHash);
}
示例11: property
static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
{
QList<ModelNode> children;
PropertyNameList properties;
if (parentNode.metaInfo().hasDefaultProperty())
properties.append(parentNode.metaInfo().defaultPropertyName());
#ifndef DISABLE_VISIBLE_PROPERTIES
properties.append(visibleProperties(parentNode));
#endif
foreach (const PropertyName &propertyName, properties) {
AbstractProperty property(parentNode.property(propertyName));
if (property.isNodeAbstractProperty())
children.append(property.toNodeAbstractProperty().directSubNodes());
}
示例12: createItemRow
NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
{
Q_ASSERT(node.isValid());
uint hash = node.internalId();
const bool dropEnabled = node.metaInfo().isValid();
QStandardItem *idItem = new QStandardItem;
idItem->setDragEnabled(true);
idItem->setDropEnabled(dropEnabled);
idItem->setEditable(true);
idItem->setData(hash, NavigatorRole);
if (node.metaInfo().isValid())
idItem->setToolTip(node.type());
else
idItem->setToolTip(msgUnknownItem(node.type()));
# ifdef _LOCK_ITEMS_
QStandardItem *lockItem = new QStandardItem;
lockItem->setDragEnabled(true);
lockItem->setDropEnabled(dropEnabled);
lockItem->setEditable(false);
lockItem->setCheckable(true);
lockItem->setData(hash, NavigatorRole);
# endif
QStandardItem *visibilityItem = new QStandardItem;
visibilityItem->setDropEnabled(dropEnabled);
visibilityItem->setCheckable(true);
visibilityItem->setEditable(false);
visibilityItem->setData(hash, NavigatorRole);
if (node.isRootNode())
visibilityItem->setCheckable(false);
QMap<QString, QStandardItem *> propertyItems;
foreach (const QString &propertyName, visibleProperties(node)) {
QStandardItem *propertyItem = new QStandardItem;
propertyItem->setSelectable(false);
propertyItem->setDragEnabled(false);
propertyItem->setDropEnabled(dropEnabled);
propertyItem->setEditable(false);
propertyItem->setData(propertyName, Qt::DisplayRole);
propertyItems.insert(propertyName, propertyItem);
idItem->appendRow(propertyItem);
}
示例13: openInlineComponent
static inline void openInlineComponent(const ModelNode &modelNode)
{
if (!modelNode.metaInfo().isValid())
return;
handleComponent(modelNode);
handleDelegate(modelNode);
handleTabComponent(modelNode);
}
示例14: currentStateChanged
void NodeInstanceView::currentStateChanged(const ModelNode &node)
{
NodeInstance newStateInstance = instanceForModelNode(node);
if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
nodeInstanceView()->activateState(newStateInstance);
else
nodeInstanceView()->activateBaseState();
}
示例15: paint
void NameItemDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (option.state & QStyle::State_Selected)
drawSelectionBackground(painter, option);
QString displayString;
QPoint displayStringOffset;
painter->save();
QFontMetrics fm(option.font);
int width = 0;
if (index.data(Qt::UserRole).isValid()) {
int pixmapSide = 16;
if (m_TreeModel->isNodeInvisible( index ))
painter->setOpacity(0.5);
ModelNode node = m_TreeModel->nodeForIndex(index);
QIcon icon;
if (node.isValid()) {
// if node has no own icon, search for it in the itemlibrary
const ItemLibraryInfo *libraryInfo = node.model()->metaInfo().itemLibraryInfo();
QList <ItemLibraryEntry> infoList = libraryInfo->entriesForType(node.type(),
node.majorVersion(),
node.minorVersion());
foreach (const ItemLibraryEntry &entry, infoList) {
if (icon.isNull()) {
icon = entry.icon();
break;
}
}
}
// if the library was also empty, use the default icon
if (icon.isNull())
icon = QIcon(QLatin1String(":/ItemLibrary/images/item-default-icon.png"));
if (!node.metaInfo().isValid())
icon = QIcon(QLatin1String(":/ItemLibrary/images/item-invalid-icon.png"));
// If no icon is present, leave an empty space of 24 pixels anyway
QPixmap pixmap = icon.pixmap(pixmapSide, pixmapSide);
painter->drawPixmap(option.rect.x()+1,option.rect.y()+2,pixmap);
displayString = node.id();
if (displayString.isEmpty())
displayString = node.simplifiedTypeName();
// Check text length does not exceed available space
int extraSpace=12+pixmapSide;
displayString = fm.elidedText(displayString,Qt::ElideMiddle,option.rect.width()-extraSpace);
displayStringOffset = QPoint(5+pixmapSide,-5);
width = fm.width(displayString);
}