本文整理汇总了C++中TextWidget类的典型用法代码示例。如果您正苦于以下问题:C++ TextWidget类的具体用法?C++ TextWidget怎么用?C++ TextWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextWidget类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TextWidget
Widget* ExpandableProvider::createChildItemWidget(int32_t groupPosition, int32_t childPosition) {
TextWidget* pItem = new TextWidget(mpPage);
mWidgetPool.append(pItem);
pItem->setTextSize(30);
pItem->setBackgroundColor(0xffd3d3d3);
return pItem;
}
开发者ID:RexSi,项目名称:COS-QQListWidget,代码行数:7,代码来源:ExpandableProvider.cpp
示例2: TextWidget
void PLFO::initialize(PVirtualPort* out, PDimmer* k, PDimmer* range,
PDimmer* offset, PSelector* selector)
{
TextWidget* title = new TextWidget(tr("LFO"), this);
title->setFont(QFont("Courier", 18, QFont::Bold));
k->setSize(80, 80);
range->setSize(80, 80);
offset->setSize(80, 80);
selector->setMaximumSize(120, 155);
// Layout
bottomArea()->addCornerAnchors(k, Qt::BottomLeftCorner, bottomArea(), Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(k, Qt::BottomRightCorner, offset, Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(k, Qt::TopRightCorner, range, Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(range, Qt::BottomRightCorner, offset, Qt::TopRightCorner);
bottomArea()->addCornerAnchors(offset, Qt::BottomRightCorner, selector, Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(selector, Qt::BottomRightCorner, bottomArea(), Qt::BottomRightCorner);
bottomArea()->addCornerAnchors(selector, Qt::TopRightCorner, bottomArea(), Qt::TopRightCorner);
rightArea()->addAnchors(out, rightArea());
centerArea()->addAnchors(title, centerArea());
bottomArea()->activate();
layout()->activate();
}
开发者ID:iMax-pp,项目名称:SynthPro,代码行数:27,代码来源:plfo.cpp
示例3: loadData
bool BarkGump::loadData(IDataSource* ids, uint32 version)
{
if (!ItemRelativeGump::loadData(ids, version)) return false;
counter = static_cast<sint32>(ids->read4());
textwidget = ids->read2();
speechshapenum = ids->read4();
speechlength = ids->read4();
totaltextheight = ids->read4();
uint32 slen = ids->read4();
if (slen > 0) {
char* buf = new char[slen+1];
ids->read(buf, slen);
buf[slen] = 0;
barked = buf;
delete[] buf;
} else {
barked = "";
}
TextWidget *widget = p_dynamic_cast<TextWidget*>(getGump(textwidget));
SettingManager::get_instance()->get("textdelay", textdelay);
// This is just a hack
Pentagram::Rect d;
widget->GetDims(d);
counter = d.h * textdelay;
dims.h = d.h;
dims.w = d.w;
return true;
}
开发者ID:amichaelt,项目名称:pentagram,代码行数:35,代码来源:BarkGump.cpp
示例4: init
void init() {
{
std::string szMenuText = getLocalised("system_menus_main_editquest_load");
TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0));
me->clicked = boost::bind(&ChooseLoadOrSaveMenuPage::onClickLoad, this);
me->m_targetMenu = EDIT_QUEST_LOAD;
me->m_savegame = SavegameHandle::Invalid;
addCenter(me, true);
}
{
std::string szMenuText = getLocalised( "system_menus_main_editquest_save");
TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0));
me->m_targetMenu = EDIT_QUEST_SAVE;
if(!ARXMenu_CanResumeGame()) {
me->SetCheckOff();
me->lColor = Color(127, 127, 127);
}
addCenter(me, true);
}
{
ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 380)), "graph/interface/menus/back");
cb->m_targetMenu = MAIN;
cb->SetShortCut(Keyboard::Key_Escape);
add(cb);
}
}
开发者ID:dreamer-dead,项目名称:ArxLibertatis,代码行数:30,代码来源:MainMenu.cpp
示例5: TextWidget
void PSampler::initialize(PVirtualPort* in, PVirtualPort* out, PVirtualPort* gate, PDimmer* bpm,
PPushButton* record, PPushButton* stop, PPushButton* play)
{
TextWidget* title = new TextWidget(tr("Sampler"), this);
title->setFont(QFont("Courier", 18, QFont::Bold));
bpm->setSize(80, 80);
record->setIcon(QIcon(":/src/resources/images/record-icon.png"));
stop->setIcon(QIcon(":/src/resources/images/stop-icon.png"));
play->setIcon(QIcon(":/src/resources/images/play-icon.png"));
ProgressBarWidget* progressBar = new ProgressBarWidget(this);
connect(this, SIGNAL(valueChanged(int)), progressBar, SLOT(setValue(int)));
connect(this, SIGNAL(lengthChanged(int)), progressBar, SLOT(setMaximum(int)));
// Layout
bottomArea()->addCornerAnchors(record, Qt::TopLeftCorner, bottomArea(), Qt::TopLeftCorner);
bottomArea()->addCornerAnchors(record, Qt::TopRightCorner, stop, Qt::TopLeftCorner);
bottomArea()->addCornerAnchors(stop, Qt::TopRightCorner, play, Qt::TopLeftCorner);
bottomArea()->addCornerAnchors(progressBar, Qt::BottomLeftCorner, bottomArea(), Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(progressBar, Qt::BottomRightCorner, gate, Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(gate, Qt::BottomRightCorner, bpm, Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(bpm, Qt::TopRightCorner, bottomArea(), Qt::TopRightCorner);
bottomArea()->addCornerAnchors(bpm, Qt::BottomRightCorner, bottomArea(), Qt::BottomRightCorner);
leftArea()->addAnchors(in, leftArea());
centerArea()->addAnchors(title, centerArea());
rightArea()->addAnchors(out, rightArea());
bottomArea()->activate();
layout()->activate();
}
开发者ID:iMax-pp,项目名称:SynthPro,代码行数:34,代码来源:psampler.cpp
示例6: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
TextWidget w;
//w.setWindowFlags(Qt::ToolTip | Qt::CustomizeWindowHint);
w.show();
return app.exec();
}
开发者ID:Caleydo,项目名称:visuallinks,代码行数:10,代码来源:main.cpp
示例7: 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;
}
开发者ID:RexSi,项目名称:COS_AutoScrollWidgetPager,代码行数:45,代码来源:MainPage.cpp
示例8: NextText
bool BarkGump::NextText()
{
TextWidget *widget = p_dynamic_cast<TextWidget*>(getGump(textwidget));
assert(widget);
if (widget->setupNextText()) {
// This is just a hack
Pentagram::Rect d;
widget->GetDims(d);
if (speechlength && totaltextheight) {
counter = (d.h * speechlength) / totaltextheight;
} else {
counter = d.h * textdelay;
}
dims.h = d.h;
dims.w = d.w;
return true;
}
return false;
}
开发者ID:amichaelt,项目名称:pentagram,代码行数:20,代码来源:BarkGump.cpp
示例9: initWidget
void GUI::initWidget(WidgetContext &ctx, TextWidget &widget) {
if (!ctx.strct->hasField("Obj_Caption"))
return;
const Aurora::GFF3Struct &caption = ctx.strct->getStruct("Obj_Caption");
float r = caption.getDouble("AurString_ColorR", 1.0);
float g = caption.getDouble("AurString_ColorG", 1.0);
float b = caption.getDouble("AurString_ColorB", 1.0);
float a = caption.getDouble("AurString_ColorA", 1.0);
widget.setColor(r, g, b, a);
}
开发者ID:Glyth,项目名称:xoreos,代码行数:13,代码来源:gui.cpp
示例10: TextWidget
void PDelay::initialize(PVirtualPort* in, PVirtualPort* out, PDimmer* duration, PDimmer* decay)
{
TextWidget* title = new TextWidget(tr("Delay"), this);
title->setFont(QFont("Courier", 18, QFont::Bold));
duration->setSize(80, 80);
decay->setSize(80, 80);
// Layout
bottomArea()->addCornerAnchors(duration, Qt::TopLeftCorner, bottomArea(), Qt::TopLeftCorner);
bottomArea()->addCornerAnchors(decay, Qt::TopRightCorner, bottomArea(), Qt::TopRightCorner);
bottomArea()->addCornerAnchors(duration, Qt::BottomLeftCorner, bottomArea(), Qt::BottomLeftCorner);
bottomArea()->addCornerAnchors(decay, Qt::BottomRightCorner, bottomArea(), Qt::BottomRightCorner);
bottomArea()->addAnchor(duration, Qt::AnchorRight, decay, Qt::AnchorLeft);
leftArea()->addAnchors(in, leftArea());
rightArea()->addAnchors(out, rightArea());
centerArea()->addAnchors(title, centerArea());
bottomArea()->activate();
layout()->activate();
}
开发者ID:iMax-pp,项目名称:SynthPro,代码行数:22,代码来源:pdelay.cpp
示例11: QCOMPARE
/*
\req QTOPIA-78
\groups
Test case where an interface is implemented by a class which inherits a
class which implements one other interface.
*/
void tst_QtUiTestWidgets::cast_inherit_single()
{
QCOMPARE(WidgetObject::constructed, 0);
QCOMPARE(WidgetObject::destructed, 0);
QCOMPARE(TextWidgetObject::constructed, 0);
QCOMPARE(TextWidgetObject::destructed, 0);
QtUiTestWidgets::instance()->refreshPlugins();
Widget *w;
TextWidget *tw;
{
QWidget widget;
QLabel label;
w = qtuitest_cast<Widget*>(&widget);
tw = qtuitest_cast<TextWidget*>(&label);
QVERIFY(w);
QVERIFY(tw);
QCOMPARE(TextWidgetObject::constructed, 1);
QCOMPARE(TextWidgetObject::destructed, 0);
/* One or more widget objects may have been constructed while finding
* the interfaces for QLabel. However there should be exactly 2
* still existing. */
QCOMPARE(WidgetObject::constructed - WidgetObject::destructed, 2);
QCOMPARE(tw->text(), QString());
label.setText("Hi there");
QCOMPARE(tw->text(), QString("Hi there"));
}
QCOMPARE(TextWidgetObject::constructed, 1);
QCOMPARE(TextWidgetObject::destructed, 1);
QCOMPARE(WidgetObject::constructed - WidgetObject::destructed, 0);
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:45,代码来源:tst_qtuitestwidgets.cpp
示例12: 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;
}
开发者ID:RexSi,项目名称:COS-QQListWidget,代码行数:5,代码来源:ExpandableProvider.cpp
示例13: if
void BarkGump::InitGump(Gump* newparent, bool take_focus)
{
// OK, this is a bit of a hack, but it's how it has to be
int fontnum;
if (owner == 1) fontnum = 6;
else if (owner > 256) fontnum = 8;
else switch (owner%3) {
case 1:
fontnum = 5;
break;
case 2:
fontnum = 7;
break;
default:
fontnum = 0;
break;
}
// This is a hack. We init the gump twice...
ItemRelativeGump::InitGump(newparent, take_focus);
// Create the TextWidget
TextWidget *widget = new TextWidget(0,0,barked,true,fontnum,194,55);
widget->InitGump(this);
textwidget = widget->getObjId();
// see if we need to play speech
AudioProcess *ap = AudioProcess::get_instance();
speechlength = 0;
if (speechshapenum && ap) {
if (ap->playSpeech(barked, speechshapenum, owner)) {
speechlength = ap->getSpeechLength(barked, speechshapenum) / 33;
if (speechlength == 0) speechlength = 1;
// We're playing speech, so need to sync the text with the speech.
// First we count the total height of all text blocks.
Pentagram::Rect d;
widget->GetDims(d);
totaltextheight = d.h;
while (widget->setupNextText()) {
widget->GetDims(d);
totaltextheight += d.h;
}
widget->rewind();
}
}
// This is just a hack
Pentagram::Rect d;
widget->GetDims(d);
if (speechlength && totaltextheight) {
counter = (d.h * speechlength) / totaltextheight;
} else {
counter = d.h * textdelay;
}
dims.h = d.h;
dims.w = d.w;
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
}
开发者ID:amichaelt,项目名称:pentagram,代码行数:64,代码来源:BarkGump.cpp
示例14: CreateTextWidget
Resource* CreateTextWidget( XMLIterator i, XMLCreatorEnv *env )
{
XMLCreatorEnv ch_env;
XMLAttributes attributes;
XMLStyle branch_style;
CascadeStyles( i, env, attributes, branch_style, ch_env );
std::string font = get_attribute( attributes, "font" );
int bodyAsLink = 0;
try_attribute_i( attributes, "body_as_link", &bodyAsLink );
Text text;
if ( bodyAsLink )
text = QueryText( make_string( (*i)._value ));
else
text = MakeText(to_chars( (*i)._value ));
Widget *ptr;
XMLIterator ch_i = i;
int line_spacing = 0;
std::string alignment;
bool adv_text = try_attribute_i( attributes, "spacing", &line_spacing );
adv_text |= try_attribute( attributes, "align", &alignment );
// create DualText
if ( !!ch_i.StepInto() )
{
int shift = 2;
try_attribute_i( attributes, "shift", &shift );
std::wstring left, right;
for ( ; !!ch_i; ++ch_i )
{
if ( (*ch_i)._name == "left" )
left = to_chars( (*ch_i)._value );
else
if ( (*ch_i)._name == "right" )
right = to_chars( (*ch_i)._value );
}
int bodyAsLink = 0;
try_attribute_i( attributes, "body_as_link", &bodyAsLink );
Text leftT, rightT;
if ( bodyAsLink )
{
leftT = QueryText( make_string( left ));
rightT = QueryText( make_string( right ));
}
else
{
leftT = MakeText(left);
rightT = MakeText(right);
}
DualTextWidget *p_dual;
ptr = p_dual = new DualTextWidget( 100, QueryFont(font), leftT, rightT, shift );
std::string dotcode;
if ( try_attribute( attributes, "dot", &dotcode ) )
p_dual->SetDotCode( ( dotcode.size()>0 ? dotcode[0] : ' ' ) );
}
else
if ( adv_text )
{
int align = 0;
if ( alignment == "left" ) { align = 0; } else
if ( alignment == "right" ) { align = 1; } else
if ( alignment == "center" ) { align = 2; }
if ( (*i)._name == "activetext" )
{
ptr = new ActiveText( QueryFont(font), text, line_spacing, align );
}
else
{
ptr = new AdvTextWidget( QueryFont(font), text, line_spacing, align );
}
}
else
{
TextWidget *ptrTW = new TextWidget( QueryFont(font), text );
ptr = ptrTW;
ptrTW->SetText( text );
}
InsertChildWidget( ptr, attributes, env);
return new AnyResource<Widget*>( ptr );
}
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:90,代码来源:CreateTextWidget.cpp
示例15: main
int main( int argc, char **argv )
{
int i;
QString m1,n1,o1;
struct args pargs;
QApplication *a;
InitWidget *b;
ScreenWidget *c;
TextWidget *textOut;
QProgressDialog *qProg;
QPixmap *qpxMeshIcon=NULL;
struct model_error model1,model2;
int rcode;
struct outbuf *log;
struct prog_reporter pr;
/* Initialize application */
a = NULL;
b = NULL;
c = NULL;
qProg = NULL;
memset(&model1,0,sizeof(model1));
memset(&model2,0,sizeof(model2));
memset(&pr,0,sizeof(pr));
log = NULL;
i = 0;
while (i<argc) {
if (strcmp(argv[i],"-t") == 0) /* text version requested */
break;
if (strcmp(argv[i],"-h") == 0) /* just asked for command line help */
break;
i++;
}
if (i == argc) { /* no text version requested, initialize QT */
a = new QApplication( argc, argv );
/* Load pixmap for icon */
qpxMeshIcon = new QPixmap((const char**)meshIcon);
if (a != NULL) a->connect( a, SIGNAL(lastWindowClosed()),
a, SLOT(quit()) );
} else {
a = NULL; /* No QT app needed */
}
/* Parse arguments */
parse_args(argc,argv,&pargs);
/* Display starting dialog if insufficient arguments */
if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) {
if (pargs.m1_fname == NULL || pargs.m2_fname == NULL) {
fprintf(stderr,"ERROR: missing file name(s) in command line\n");
exit(1);
}
if (!pargs.do_wlog) {
log = outbuf_new(stdio_puts,stdout);
}
else {
textOut = new TextWidget();
textOut->setIcon(*qpxMeshIcon);
log = outbuf_new(TextWidget_puts,textOut);
textOut->show();
}
if (pargs.no_gui) {
pr.prog = stdio_prog;
pr.cb_out = stdout;
} else {
qProg = new QProgressDialog("Calculating distance",0,100);
qProg->setIcon(*qpxMeshIcon);
qProg->setMinimumDuration(1500);
pr.prog = QT_prog;
pr.cb_out = qProg;
}
mesh_run(&pargs, &model1, &model2, log, &pr);
} else {
b = new InitWidget(pargs, &model1, &model2);
b->setIcon(*qpxMeshIcon);
b->show();
}
if (a != NULL) {
if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) {
c = new ScreenWidget(&model1, &model2, &pargs);
c->setIcon(*qpxMeshIcon);
a->setMainWidget(c);
c->show();
}
rcode = a->exec();
} else {
rcode = 0;
}
/* Free widgets */
outbuf_delete(log);
delete qProg;
delete qpxMeshIcon;
delete b;
delete c;
delete a; // QApplication must be last QT thing to delete
/* Free model data */
if (model1.mesh != NULL) __free_raw_model(model1.mesh);
free(model1.verror);
free(model1.info);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mesh,代码行数:101,代码来源:mesh.cpp
示例16: clicked
// true: block les zones de checks
bool TextWidget::OnMouseClick() {
if(!enabled) {
return false;
}
if(clicked) {
clicked(this);
}
switch(eState) {
case EDIT:
eState=EDIT_TIME;
return true;
case GETTOUCH:
eState=GETTOUCH_TIME;
lOldColor=lColorHighlight;
return true;
default: break;
}
switch(m_id) {
// MENULOADQUEST
case BUTTON_MENUEDITQUEST_LOAD: {
if(pWindowMenu) {
pLoadConfirm->SetCheckOn();
pLoadConfirm->lColor = pLoadConfirm->lOldColor;
pDeleteConfirm->SetCheckOn();
pDeleteConfirm->lColor = pDeleteConfirm->lOldColor;
for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_LOAD) {
page->m_savegame = m_savegame;
for(size_t j = 0; j < page->m_children.m_widgets.size(); j++) {
Widget * widget = page->m_children.m_widgets[j];
if(widget->m_id == BUTTON_MENUEDITQUEST_LOAD) {
((TextWidget *)widget)->bSelected = false;
}
}
bSelected = true;
}
}
}
}
break;
case BUTTON_MENUEDITQUEST_LOAD_CONFIRM: {
if(pWindowMenu) {
for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_LOAD) {
m_savegame = page->m_savegame;
if(m_savegame != SavegameHandle()) {
m_targetMenu = MAIN;
GRenderer->Clear(Renderer::DepthBuffer);
ARXMenu_LoadQuest(m_savegame);
bNoMenu=true;
if(pTextManage) {
pTextManage->Clear();
}
break;
}
}
}
pLoadConfirm->SetCheckOff();
pLoadConfirm->lColor = Color::grayb(127);
pDeleteConfirm->SetCheckOff();
pDeleteConfirm->lColor = Color::grayb(127);
}
}
break;
// MENUSAVEQUEST
case BUTTON_MENUEDITQUEST_SAVE: {
if(pWindowMenu)
for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_SAVE_CONFIRM) {
page->m_savegame = m_savegame;
TextWidget * me = (TextWidget *) page->m_children.m_widgets[1];
if(me) {
m_targetMenu = MAIN;
ARXMenu_SaveQuest(me->m_text, me->m_savegame);
break;
}
}
}
}
break;
// Delete save from the load menu
case BUTTON_MENUEDITQUEST_DELETE_CONFIRM: {
//.........这里部分代码省略.........
开发者ID:nemyax,项目名称:ArxLibertatis,代码行数:101,代码来源:TextWidget.cpp
示例17: UpdateHelp
void UpdateHelp(unsigned index) {
if (!visible || item_help_callback == nullptr)
return;
help_widget->SetText(item_help_callback(index));
two_widgets->UpdateLayout();
}
开发者ID:hor63,项目名称:XCSoar,代码行数:7,代码来源:ListPicker.cpp
注:本文中的TextWidget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论