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


C++ QQuickItem::setProperty方法代码示例

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


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

示例1: update_dest_pos

void Packet::update_dest_pos(Node *node)
{
    std::pair<int,int> dest_loc = location(node);
    QQuickItem *item = qobject_cast<QQuickItem*>(pac_obj);
    item->setProperty("dest_x", dest_loc.first+offset);
    item->setProperty("dest_y", dest_loc.second+offset);
}
开发者ID:higginsrty,项目名称:RoutingApp,代码行数:7,代码来源:packet.cpp

示例2: deletePaper

void PaperManager::deletePaper(const QVariant & var)
{
    QQuickItem *paper = var.value<QQuickItem*>();
    if( !paper )
        return;

    const int paperId = paper->property("paperItem").toInt();
    if( paperId == -1 )
        return;

    const int bufferIdx  = p->buffer.indexOf(paper);
    const int currentIdx = (p->current==0)? p->current + bufferIdx : p->current + bufferIdx -1;

    if( currentIdx != p->current )
        return;

    p->papers.removeAll(paperId);
    int nextId = (p->current<p->papers.count())? p->papers.at(p->current) : -1;

    paper->setProperty("paperItem", -1 );
    paper->setProperty("paperItem", nextId );

    Papyrus::database()->deletePaper(paperId);
    reindexBuffer();
    load_buffers();
    emit papersChanged();
}
开发者ID:Aseman-Land,项目名称:Papyrus,代码行数:27,代码来源:papermanager.cpp

示例3: QDialog

void Fix8Log::aboutSlot()
{

    QDialog *aboutDialog = new QDialog();
    QVBoxLayout *aboutLayout = new QVBoxLayout(0);

    QDialogButtonBox *dialogButtonBox = new QDialogButtonBox();

    dialogButtonBox->addButton(QDialogButtonBox::Ok);
    connect(dialogButtonBox,SIGNAL(clicked(QAbstractButton*)),
            aboutDialog,SLOT(close()));

    QQuickView *aboutView = new QQuickView(QUrl("qrc:qml/helpAbout.qml"));
    QQuickItem *qmlObject = aboutView->rootObject();
    qmlObject->setProperty("color",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("bgColor",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("version",QString::number(Globals::version));

    aboutView->setResizeMode(QQuickView::SizeRootObjectToView);

    QWidget *aboutWidget = QWidget::createWindowContainer(aboutView,0);
    aboutWidget->setPalette(aboutDialog->palette());
    aboutWidget->setAutoFillBackground(false);
    aboutDialog->setLayout(aboutLayout);

    aboutLayout->addWidget(aboutWidget,1);
    aboutLayout->addWidget(dialogButtonBox,0);
    aboutDialog->resize(500,400);
    aboutDialog->setWindowTitle(GUI::Globals::appName);
    aboutDialog->exec();
    aboutDialog->deleteLater();

}
开发者ID:DBoo,项目名称:fix8logviewer,代码行数:33,代码来源:fix8logSlots.cpp

示例4: toggleLockMode

void QmlProfilerTraceView::toggleLockMode(bool active)
{
    QQuickItem *rootObject = d->m_mainView->rootObject();
    bool lockMode = !rootObject->property("selectionLocked").toBool();
    if (active != lockMode) {
        rootObject->setProperty("selectionLocked", QVariant(!active));
        rootObject->setProperty("selectedItem", QVariant(-1));
    }
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:9,代码来源:qmlprofilertraceview.cpp

示例5: QQmlComponent

QQuickItem * DataSetView::createColumnHeader(int col)
{
	//std::cout << "createColumnHeader("<<col<<") called!\n" << std::flush;


	if(_columnHeaderDelegate == NULL)
	{
		_columnHeaderDelegate = new QQmlComponent(qmlEngine(this));
		_columnHeaderDelegate->setData("import QtQuick 2.10\nItem {\n"
			"property alias text: tekst.text\n"
		   "Rectangle	{ color: \"lightGrey\";	anchors.fill: parent }\n"
		   "Text		{ id: tekst; anchors.centerIn: parent }\n"
		"}", QUrl());
	}

	QQuickItem * columnHeader = NULL;

	if(_columnHeaderItems.count(col) == 0  || _columnHeaderItems[col] == NULL)
	{

		if(_columnHeaderStorage.size() > 0)
		{
#ifdef DEBUG_VIEWPORT
			std::cout << "createColumnHeader("<<col<<") from storage!\n" << std::flush;
#endif
			columnHeader = _columnHeaderStorage.top();
			_columnHeaderStorage.pop();
		}
		else
		{
#ifdef DEBUG_VIEWPORT
			std::cout << "createColumnHeader("<<col<<") ex nihilo!\n" << std::flush;
#endif
			columnHeader = qobject_cast<QQuickItem*>(_columnHeaderDelegate->create());
			columnHeader->setParent(this);
			columnHeader->setParentItem(this);
		}

		columnHeader->setProperty("z", 10);
		columnHeader->setProperty("text", _model->headerData(col, Qt::Orientation::Horizontal).toString());

		columnHeader->setZ(-3);
		columnHeader->setHeight(_dataRowsMaxHeight);
		columnHeader->setWidth(_dataColsMaxWidth[col]);

		columnHeader->setVisible(true);

		_columnHeaderItems[col] = columnHeader;
	}
	else
		columnHeader = _columnHeaderItems[col];

	columnHeader->setX(_colXPositions[col]);
	columnHeader->setY(_viewportY);

	return columnHeader;
}
开发者ID:akashrajkn,项目名称:jasp-desktop,代码行数:57,代码来源:datasetview.cpp

示例6: set_source_node

void Packet::set_source_node(Node* node)
{   //assign the source node
    source_node = node;
    std::pair<int,int> loc = location(node);
    QQuickItem *item = qobject_cast<QQuickItem*>(pac_obj);
    item->setProperty("x", loc.first+offset);
    item->setProperty("y", loc.second+offset);
    QObject::connect(this->pac_obj, SIGNAL(dest_reached(QString)), this->source_node,SLOT(send_pack(QString)),Qt::UniqueConnection);

}
开发者ID:higginsrty,项目名称:RoutingApp,代码行数:10,代码来源:packet.cpp

示例7: resizeEvent

void QmlProfilerTraceView::resizeEvent(QResizeEvent *event)
{
    QWidget::resizeEvent(event);
    QQuickItem *rootObject = d->m_mainView->rootObject();
    if (rootObject) {
        rootObject->setProperty("width", QVariant(event->size().width()));
        int newHeight = event->size().height() - d->m_timebar->height() - d->m_overview->height();
        rootObject->setProperty("candidateHeight", QVariant(newHeight));
    }
    emit resized();
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:11,代码来源:qmlprofilertraceview.cpp

示例8: itemRect

QList<quint32> MainView2D::selectFixturesRect(QRectF rect)
{   
    QList<quint32>fxList;

    if (rect.width() == 0 || rect.height() == 0)
        return fxList;

    QMap<quint32, QQuickItem *>::const_iterator i = m_itemsMap.constBegin();
    while (i != m_itemsMap.constEnd())
    {
        QQuickItem *fxItem = i.value();
        qreal itemXPos = fxItem->property("x").toReal();
        qreal itemYPos = fxItem->property("y").toReal();
        qreal itemWidth = fxItem->property("width").toReal();
        qreal itemHeight = fxItem->property("height").toReal();

        QRectF itemRect(itemXPos, itemYPos, itemWidth, itemHeight);

        qDebug() << "Rect:" << rect << "itemRect:" << itemRect;

        if (rect.contains(itemRect))
        {
            if (fxItem->property("isSelected").toBool() == false)
            {
                fxItem->setProperty("isSelected", true);
                fxList.append(i.key());
            }
        }
        ++i;
    }
    return fxList;
}
开发者ID:jeromelebleu,项目名称:qlcplus,代码行数:32,代码来源:mainview2d.cpp

示例9: playerWindowVisible

void KonvergoWindow::playerWindowVisible(bool visible)
{
  // adjust webengineview transparecy depending on player visibility
  QQuickItem *web = findChild<QQuickItem *>("web");
  if (web)
    web->setProperty("backgroundColor", visible ? "transparent" : "#111111");
}
开发者ID:SHsamir,项目名称:Repository,代码行数:7,代码来源:KonvergoWindow.cpp

示例10: changeEvent

void QmlProfilerTraceView::changeEvent(QEvent *e)
{
    if (e->type() == QEvent::EnabledChange) {
        QQuickItem *rootObject = d->m_mainView->rootObject();
        rootObject->setProperty("enabled", isEnabled());
    }
}
开发者ID:MarianMMX,项目名称:qt-creator,代码行数:7,代码来源:qmlprofilertraceview.cpp

示例11: ind

QQuickItem * DataSetView::createTextItem(int row, int col)
{
	//std::cout << "createTextItem("<<row<<", "<<col<<") called!\n" << std::flush;

	if((_cellTextItems.count(col) == 0 && _cellTextItems[col].count(row) == 0) || _cellTextItems[col][row] == NULL)
	{

		if(_itemDelegate == NULL)
		{
			_itemDelegate = new QQmlComponent(qmlEngine(this));
			_itemDelegate->setData("import QtQuick 2.10\nText { property bool active: true; text: \"???\"; color: active ? 'black' : 'grey' }", QUrl());
		}

		QQuickItem * textItem = NULL;

		if(_textItemStorage.size() > 0)
		{
#ifdef DEBUG_VIEWPORT
			std::cout << "createTextItem("<<row<<", "<<col<<") from storage!\n" << std::flush;
#endif
			textItem = _textItemStorage.top();
			_textItemStorage.pop();
		}
		else
		{
#ifdef DEBUG_VIEWPORT
			std::cout << "createTextItem("<<row<<", "<<col<<") ex nihilo!\n" << std::flush;
#endif
			textItem = qobject_cast<QQuickItem*>(_itemDelegate->create());
			textItem->setParent(this);
			textItem->setParentItem(this);
		}

		QModelIndex ind(_model->index(row, col));
		bool active = _model->data(ind, _roleNameToRole["active"]).toBool();
		textItem->setProperty("color", active ? "black" : "grey");
		textItem->setProperty("text", _model->data(ind));
		textItem->setX(_colXPositions[col] + _itemHorizontalPadding);
		textItem->setY(-2 + _dataRowsMaxHeight + _itemVerticalPadding + row * _dataRowsMaxHeight);
		textItem->setZ(-4);
		textItem->setVisible(true);

		_cellTextItems[col][row] = textItem;
	}

	return _cellTextItems[col][row];
}
开发者ID:akashrajkn,项目名称:jasp-desktop,代码行数:47,代码来源:datasetview.cpp

示例12:

void MainView2D::updateFixtureRotation(quint32 itemID, QVector3D degrees)
{
    if (isEnabled() == false || m_itemsMap.contains(itemID) == false)
        return;

    QQuickItem *fxItem = m_itemsMap[itemID];
    fxItem->setProperty("rotation", degrees.y());
}
开发者ID:jeromelebleu,项目名称:qlcplus,代码行数:8,代码来源:mainview2d.cpp

示例13: it

void MainView2D::setUniverseFilter(quint32 universeFilter)
{
    PreviewContext::setUniverseFilter(universeFilter);
    QMapIterator<quint32, QQuickItem*> it(m_itemsMap);
    while(it.hasNext())
    {
        it.next();
        quint32 fxID = it.key();
        QQuickItem *fxItem = it.value();
        Fixture *fixture = m_doc->fixture(fxID);
        if (fixture == NULL)
            continue;

        if (universeFilter == Universe::invalid() || fixture->universe() == universeFilter)
            fxItem->setProperty("visible", "true");
        else
            fxItem->setProperty("visible", "false");
    }
}
开发者ID:jeromelebleu,项目名称:qlcplus,代码行数:19,代码来源:mainview2d.cpp

示例14: create_packet

void Packet::create_packet(QString name, QObject *main_panel, QQmlApplicationEngine *engine) {
    // Load Node QML file
    QQmlComponent component(engine, QUrl("qrc:/qml_files/packet.qml"));
    // Create QObject
    pac_obj = component.create();
    // Cast it as a QQuickItem
    QQuickItem *item = qobject_cast<QQuickItem*>(pac_obj);
    // Set the parent as the main_panel (this changes when added to a link)
    item->setParentItem(qobject_cast<QQuickItem*>(main_panel));
    item->setProperty("pack_name", name);
#ifdef Q_OS_ANDROID
    item->setProperty("packet_size", 50);
    offset = 25;
#else
    item->setProperty("packet_size", 20);
    offset = 13;
#endif
    this->name = name;
}
开发者ID:higginsrty,项目名称:RoutingApp,代码行数:19,代码来源:packet.cpp

示例15: toggleRangeMode

/////////////////////////////////////////////////////////
// Toolbar buttons
void QmlProfilerTraceView::toggleRangeMode(bool active)
{
    QQuickItem *rootObject = d->m_mainView->rootObject();
    bool rangeMode = rootObject->property("selectionRangeMode").toBool();
    if (active != rangeMode) {
        if (active)
            d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselected.png")));
        else
            d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
        rootObject->setProperty("selectionRangeMode", QVariant(active));
    }
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:14,代码来源:qmlprofilertraceview.cpp


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