本文整理汇总了C++中TextWidget::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ TextWidget::setText方法的具体用法?C++ TextWidget::setText怎么用?C++ TextWidget::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextWidget
的用法示例。
在下文中一共展示了TextWidget::setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imgParams
Vector<Widget*> MainPage::createWidgets() {
RelativeController* plc = NULL;;
TextWidget* txt = NULL;
Button* btn = NULL;
ImageWidget* img = NULL;
RelativeControllerParams imgParams(ControllerParams::MATCH_PARENT, ControllerParams::MATCH_PARENT);
RelativeControllerParams button(ControllerParams::WRAP_CONTENT, ControllerParams::WRAP_CONTENT);
button.setRelation(RelativeControllerParams::ALIGN_PARENT_BOTTOM);
button.setRelation(RelativeControllerParams::ALIGN_PARENT_LEFT);
RelativeControllerParams text(ControllerParams::WRAP_CONTENT, ControllerParams::WRAP_CONTENT);
text.setRelation(RelativeControllerParams::CENTER_IN_PARENT);
Vector<Widget*> widgets;
for (size_t i = 0; i < 10; i++) {
plc = new RelativeController(this);
mWidgetPool.append(plc);
img = new ImageWidget(this);
mWidgetPool.append(img);
img->setImageResource(gPictures[i]);
img->setScaleType(ImageWidget::FIT_XY);
plc->addWidget(img);
img->setControllerParams(&imgParams);
txt = new TextWidget(this);
txt->setControllerParams(&text);
mWidgetPool.append(txt);
txt->setText(String::format("this is %d picture.", i + 1));
txt->setTextColor(0xffff0000);
plc->addWidget(txt);
btn = new Button(this);
btn->setControllerParams(&button);
mWidgetPool.append(btn);
btn->setText(String::format("button %d", i+1));
plc->addWidget(btn);
widgets.append(plc);
}
GLOG(LOG_TAG, LOGINFO, "widgets size %d", widgets.size());
return widgets;
}
示例2: getChildItemWidget
Widget* ExpandableProvider::getChildItemWidget(int32_t groupPosition, int32_t childPosition, bool isLastChild, Widget* convertWidget, Widget* parent) {
TextWidget* pItem = dynamic_cast<TextWidget*> (convertWidget);
pItem->setText(String::format("Child %d", childPosition));
return convertWidget;
}