本文整理汇总了C++中QQuickItem::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickItem::property方法的具体用法?C++ QQuickItem::property怎么用?C++ QQuickItem::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickItem
的用法示例。
在下文中一共展示了QQuickItem::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: updateCursorPosition
/////////////////////////////////////////////////////////
// Goto source location
void QmlProfilerTraceView::updateCursorPosition()
{
QQuickItem *rootObject = d->m_mainView->rootObject();
emit gotoSourceLocation(rootObject->property("fileName").toString(),
rootObject->property("lineNumber").toInt(),
rootObject->property("columnNumber").toInt());
}
示例3: updateCursorPosition
// Goto source location
void QmlProfilerTraceView::updateCursorPosition()
{
QQuickItem *rootObject = d->m_mainView->rootObject();
QString file = rootObject->property("fileName").toString();
if (!file.isEmpty())
emit gotoSourceLocation(file, rootObject->property("lineNumber").toInt(),
rootObject->property("columnNumber").toInt());
emit typeSelected(rootObject->property("typeId").toInt());
}
示例4: selectionEnd
qint64 QmlProfilerTraceView::selectionEnd() const
{
QQuickItem *rootObject = d->m_mainView->rootObject();
if (rootObject)
return rootObject->property("selectionRangeEnd").toLongLong();
return 0;
}
示例5: 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();
}
示例6: hasValidSelection
bool QmlProfilerTraceView::hasValidSelection() const
{
QQuickItem *rootObject = d->m_mainView->rootObject();
if (rootObject)
return rootObject->property("selectionRangeReady").toBool();
return false;
}
示例7: 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));
}
}
示例8: currentCategory
QString ModuleInterface::currentCategory() const {
QQuickItem* object = findQmlObject("moduleChooser");
if (object == 0)
return "";
int row = object->property("categoryIndex").toInt();
QModelIndex modelIndex = m_categoryModel.index(row,0);
QString category = modelIndex.data(TextRole).toString();
return category;
}
示例9: currentLanguage
QString ModuleInterface::currentLanguage() const {
QQuickItem* object = findQmlObject("moduleChooser");
if (object == 0)
return "";
int row = object->property("languageIndex").toInt();
QModelIndex modelIndex = m_languageModel.index(row,0);
QString language = modelIndex.data(TextRole).toString();
return language;
}
示例10: 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));
}
}
示例11: init
void PlasmoidProtocol::init()
{
//this should never happen
if (m_containment) {
return;
}
Host* h = qobject_cast<Host*>(parent());
QQuickItem* rootItem = h->rootItem();
if (rootItem) {
m_systrayApplet = rootItem->property("_plasma_applet").value<Plasma::Applet*>();
}
if (!m_systrayApplet) {
qWarning() << "Don't have a parent applet, Can't initialize the Plasmoid protocol!!!";
return;
}
int containmentId = 0;
KConfigGroup cg = m_systrayApplet->config();
cg = KConfigGroup(&cg, "Containments");
if (cg.isValid() && cg.groupList().size()) {
containmentId = cg.groupList().first().toInt();
}
m_containment = new Plasma::Containment(m_systrayApplet, QStringLiteral("null"), containmentId);
m_containment->setImmutability(Plasma::Types::Mutable);
m_containment->setFormFactor(Plasma::Types::Horizontal);
m_containment->setLocation(m_systrayApplet->location());
m_containment->setContainmentActions(QStringLiteral("RightButton;NoModifier"), QStringLiteral("org.kde.contextmenu"));
m_containment->init();
emit m_systrayApplet->containment()->corona()->containmentAdded(m_containment);
connect(m_systrayApplet, &Plasma::Applet::locationChanged, this, [=]() {
m_containment->setLocation(m_systrayApplet->location());
});
m_systrayApplet->setProperty("containment", QVariant::fromValue(m_containment));
restorePlasmoids();
}
示例12: drawableProvider
void QuickAndroidTests::drawableProvider()
{
QQmlApplicationEngine engine;
QADrawableProvider* provider = new QADrawableProvider();
provider->setBasePath(QString(SRCDIR) + "/res");
engine.addImageProvider("drawable",provider);
engine.load(QUrl::fromLocalFile(QString(SRCDIR) + "/test_drawableprovider.qml"));
QObject *rootItem = engine.rootObjects().first();
QVERIFY(rootItem);
QStringList images;
images << "image1" << "image2" << "image3";
Q_FOREACH(QString image,images) {
QQuickItem* item = rootItem->findChild<QQuickItem*>(image);
QVERIFY(item);
QCOMPARE(item->property("status").toInt() , 1) ;
}
示例13: resizeGL
void GLWidget::resizeGL(int width, int height)
{
int x, y, w, h;
double this_aspect = (double) width / height;
double video_aspect = m_monitorProfile->dar();
// Special case optimisation to negate odd effect of sample aspect ratio
// not corresponding exactly with image resolution.
if ((int) (this_aspect * 1000) == (int) (video_aspect * 1000))
{
w = width;
h = height;
}
// Use OpenGL to normalise sample aspect ratio
else if (height * video_aspect > width)
{
w = width;
h = width / video_aspect;
}
else
{
w = height * video_aspect;
h = height;
}
x = (width - w) / 2;
y = (height - h) / 2;
m_rect.setRect(x, y, w, h);
double scale = (double) m_rect.width() / m_monitorProfile->width() * m_zoom;
QPoint center = m_rect.center();
QQuickItem* rootQml = rootObject();
if (rootQml) {
rootQml->setProperty("center", center);
rootQml->setProperty("scale", scale);
if (rootQml->objectName() == "rootsplit") {
// Adjust splitter pos
rootQml->setProperty("splitterPos", x + (rootQml->property("realpercent").toDouble() * w));
}
}
emit rectChanged();
}
示例14: paperEntered
void PaperManager::paperEntered( const QVariant & var )
{
p->current--;
emit currentPaperChanged();
emit currentIndexChanged();
QQuickItem *paper = var.value<QQuickItem*>();
Q_UNUSED(paper)
if( p->current == 0 )
return;
QQuickItem *btm = p->buffer.takeLast();
p->buffer.prepend( btm );
reindexBuffer();
btm->setProperty( "anim", false );
btm->setProperty( "x", btm->property("closeX") );
btm->setProperty( "opacity", 1 );
btm->setProperty( "visible", true );
load_buffers();
}
示例15: paperClosed
void PaperManager::paperClosed( const QVariant & var )
{
QQuickItem *paper = var.value<QQuickItem*>();
if( p->buffer.indexOf(paper) == 0 && p->current != 0 )
{
paper->setProperty( "x" ,paper->property("closeX") );
return;
}
if( p->current >= p->papers.count() )
QMetaObject::invokeMethod( paper, "save" );
p->current++;
emit currentPaperChanged();
emit currentIndexChanged();
if( p->current == 1 )
{
p->buffer.last()->setProperty( "visible" ,true );
load_buffers();
return;
}
QQuickItem *top = p->buffer.takeFirst();
p->buffer << top;
reindexBuffer();
top->setProperty( "anim" ,false );
top->setProperty( "x" ,0 );
top->setProperty( "opacity", 0 );
QMetaObject::invokeMethod( top, "startAnimation" );
top->setProperty( "opacity", 1 );
load_buffers();
}