QuotesItem::QuotesItem(Color color) { name = Label::create(). maxLineCount(2). multiline(TRUE); //name->autoSize()->setMaxLineCount(3); name->textStyle()->setColor(Color::Black); name->textStyle()->setFontSize(FontSize::PointValue); name->textStyle()->setFontSizeValue(10); name->textStyle()->setFontWeight(FontWeight::W100); Container *rootC = Container::create(). //horizontal(HorizontalAlignment::Fill). left(6). top(6). right(6). bottom(6). preferredWidth(1440). background(color). add(name); setRoot(rootC); //setHorizontalAlignment(HorizontalAlignment::Fill); setBottomMargin(6); }
void LandscapeImageGridItem::addItemsToRoot() { Container *BG = Container::create(). background(Color::fromARGB(0xffae734b)). opacity(0.6f). preferredSize(2000, 150); image->setPreferredHeight(150); image->setScalingMethod(ScalingMethod::AspectFit); fileNameLabel->setHorizontalAlignment(HorizontalAlignment::Right); durationLabel->setHorizontalAlignment(HorizontalAlignment::Right); Container *textC = Container::create(). horizontal(HorizontalAlignment::Right). vertical(VerticalAlignment::Center). layoutProperties(StackLayoutProperties::create().spaceQuota(1)). add(fileNameLabel). add(durationLabel); textC->add(fileNameLabel); Container *content = Container::create(). layout(StackLayout::create().orientation(LayoutOrientation::LeftToRight)). add(image). add(textC); Container *rootC = Container::create(). layout(DockLayout::create()). add(BG). add(content); setRoot(rootC); setBottomMargin(6.0f); }
void Text3DOverlay::setProperties(const QVariantMap& properties) { Billboard3DOverlay::setProperties(properties); auto text = properties["text"]; if (text.isValid()) { setText(text.toString()); } auto textAlpha = properties["textAlpha"]; if (textAlpha.isValid()) { float prevTextAlpha = getTextAlpha(); setTextAlpha(textAlpha.toFloat()); // Update our payload key if necessary to handle transparency if ((prevTextAlpha < 1.0f && _textAlpha >= 1.0f) || (prevTextAlpha >= 1.0f && _textAlpha < 1.0f)) { auto itemID = getRenderItemID(); if (render::Item::isValidID(itemID)) { render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene(); render::Transaction transaction; transaction.updateItem(itemID); scene->enqueueTransaction(transaction); } } } bool valid; auto backgroundColor = properties["backgroundColor"]; if (backgroundColor.isValid()) { auto color = u8vec3FromVariant(backgroundColor, valid); if (valid) { _backgroundColor = color; } } if (properties["backgroundAlpha"].isValid()) { setAlpha(properties["backgroundAlpha"].toFloat()); } if (properties["lineHeight"].isValid()) { setLineHeight(properties["lineHeight"].toFloat()); } if (properties["leftMargin"].isValid()) { setLeftMargin(properties["leftMargin"].toFloat()); } if (properties["topMargin"].isValid()) { setTopMargin(properties["topMargin"].toFloat()); } if (properties["rightMargin"].isValid()) { setRightMargin(properties["rightMargin"].toFloat()); } if (properties["bottomMargin"].isValid()) { setBottomMargin(properties["bottomMargin"].toFloat()); } }
void Text3DOverlay::setProperties(const QScriptValue& properties) { Planar3DOverlay::setProperties(properties); QScriptValue text = properties.property("text"); if (text.isValid()) { setText(text.toVariant().toString()); } QScriptValue backgroundColor = properties.property("backgroundColor"); if (backgroundColor.isValid()) { QScriptValue red = backgroundColor.property("red"); QScriptValue green = backgroundColor.property("green"); QScriptValue blue = backgroundColor.property("blue"); if (red.isValid() && green.isValid() && blue.isValid()) { _backgroundColor.red = red.toVariant().toInt(); _backgroundColor.green = green.toVariant().toInt(); _backgroundColor.blue = blue.toVariant().toInt(); } } if (properties.property("backgroundAlpha").isValid()) { _backgroundAlpha = properties.property("backgroundAlpha").toVariant().toFloat(); } if (properties.property("lineHeight").isValid()) { setLineHeight(properties.property("lineHeight").toVariant().toFloat()); } if (properties.property("leftMargin").isValid()) { setLeftMargin(properties.property("leftMargin").toVariant().toFloat()); } if (properties.property("topMargin").isValid()) { setTopMargin(properties.property("topMargin").toVariant().toFloat()); } if (properties.property("rightMargin").isValid()) { setRightMargin(properties.property("rightMargin").toVariant().toFloat()); } if (properties.property("bottomMargin").isValid()) { setBottomMargin(properties.property("bottomMargin").toVariant().toFloat()); } QScriptValue isFacingAvatarValue = properties.property("isFacingAvatar"); if (isFacingAvatarValue.isValid()) { _isFacingAvatar = isFacingAvatarValue.toVariant().toBool(); } }
int LineEditExtension::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = leftMargin(); break; case 1: *reinterpret_cast< int*>(_v) = rightMargin(); break; case 2: *reinterpret_cast< int*>(_v) = topMargin(); break; case 3: *reinterpret_cast< int*>(_v) = bottomMargin(); break; } _id -= 4; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setLeftMargin(*reinterpret_cast< int*>(_v)); break; case 1: setRightMargin(*reinterpret_cast< int*>(_v)); break; case 2: setTopMargin(*reinterpret_cast< int*>(_v)); break; case 3: setBottomMargin(*reinterpret_cast< int*>(_v)); break; } _id -= 4; } else if (_c == QMetaObject::ResetProperty) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 4; } #endif // QT_NO_PROPERTIES return _id; }
void QDeclarativeAnchors::setMargins(qreal offset) { Q_D(QDeclarativeAnchors); if (d->margins == offset) return; //###Is it significantly faster to set them directly so we can call fillChanged only once? if(!d->rightMargin || d->rightMargin == d->margins) setRightMargin(offset); if(!d->leftMargin || d->leftMargin == d->margins) setLeftMargin(offset); if(!d->topMargin || d->topMargin == d->margins) setTopMargin(offset); if(!d->bottomMargin || d->bottomMargin == d->margins) setBottomMargin(offset); d->margins = offset; emit marginsChanged(); }