本文整理汇总了C++中MyApp::setMainWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ MyApp::setMainWidget方法的具体用法?C++ MyApp::setMainWidget怎么用?C++ MyApp::setMainWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyApp
的用法示例。
在下文中一共展示了MyApp::setMainWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
static KCmdLineOptions options[] = {
{"show", I18N_NOOP("Show window on startup"), 0},
{"kwalletd", I18N_NOOP("For use by kwalletd only"), 0},
{"+name", I18N_NOOP("A wallet name"), 0},
KCmdLineLastOption
};
KAboutData about("kwalletmanager", I18N_NOOP("KDE Wallet Manager"), "1.1",
I18N_NOOP("KDE Wallet Management Tool"),
KAboutData::License_GPL,
I18N_NOOP("(c) 2003,2004 George Staikos"), 0,
"http://www.kde.org/");
about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "[email protected]");
about.addAuthor("Isaac Clerencia", I18N_NOOP("Developer"), "[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
if (!KUniqueApplication::start()) {
return 0;
}
MyApp a;
KWalletManager wm;
wm.setCaption(i18n("KDE Wallet Manager"));
a.setMainWidget(&wm);
KGlobal::dirs()->addResourceType("kwallet", "share/apps/kwallet");
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("show")) {
wm.show();
}
if (args->isSet("kwalletd")) {
wm.kwalletdLaunch();
}
for (int i = 0; i < args->count(); ++i) {
QString fn = QFileInfo(args->arg(i)).absFilePath();
KMimeType::Ptr ptr;
if (QFile::exists(fn) &&
(ptr = KMimeType::findByFileContent(fn)) &&
ptr->is("application/x-kde-wallet")) {
wm.openWalletFile(fn);
} else {
wm.openWallet(args->arg(i));
}
}
args->clear();
return a.exec();
}
示例2: main
//.........这里部分代码省略.........
sge_PutPixel(s,x+32,y+50,c.toColor(s));
}
for(x=0;x<32;x++)
{
int y=spline3(x/32.0,v2,v3,v4,v5);
sge_PutPixel(s,x+64,y+50,c.toColor(s));
}
for(x=0;x<32;x++)
{
int y=spline3(x/32.0,v3,v4,v5,v6);
sge_PutPixel(s,x+96,y+50,c.toColor(s));
}
SDL_Flip(s);
// SDL_Delay(1000);
}
else if(test==9)
{
SplineMap<float> m(64,64,50);
int w=64;
VoxelView v(w,w*2,Pos3D(0,0,0),false);
int z=0;
for(int x=0;x<w;x++)
{
float h=20+x/16.0;
for(int y=0;y<h;y++)
{
float a=std::min(1.0f,h-y);
// if(a<1)
if(a>0)
{
cdebug(a);
v.set(Pos3D(x,y,z),Color(0xFF,0xFF,0xFF,a));//Color(0xAA*a,0xAA*a,0));//,a));
}
}
}
av->insert(new VoxelImage(v.getSurface(),Pos3D(0,0,0)));
}
else if(test==10)
{
SDL_Surface *s=getScreen().surface();
for(int x=0;x<100;x++)
{
float h=20+x/16.0;
for(int y=0;y<h;y++)
{
float a=std::min(1.0f,h-y);
if(a>0)
{
sge_PutPixelAlpha(s,x,100-y,SDL_MapRGBA(s->format,0xFF,0xFF,0xFF,a*0xFF),a*0xFF);
}
}
}
SDL_Flip(s);
SDL_Delay(1000);
}
else if(test==11 || test==12)
{
int w=8;
SplineMap<float> m(POINTS_PER_TILE*(w+2),POINTS_PER_TILE*(w+2),40);
SplineMap<float> gm(POINTS_PER_TILE*(w+2),POINTS_PER_TILE*(w+2),10);
if(test==12)
w=2;
for(int y=0;y<w;y++)
for(int x=0;x<w;x++)
{
int mx=x*(POINTS_PER_TILE);
int my=y*(POINTS_PER_TILE/2);
if(y&1)
mx+=(POINTS_PER_TILE/2);
av->insert(new VoxelImage(makeTerrainTile(m,gm,mx,my),Pos3D(mx*TILE_WIDTH/POINTS_PER_TILE,0,my*TILE_WIDTH/POINTS_PER_TILE)));
}
}
else if(test==13)
{
AGSurface s=makeWaterTile();
av->insert(new VoxelImage(s,Pos3D(64,0,0)));
av->insert(new VoxelImage(s,Pos3D(0,0,0)));
av->insert(new VoxelImage(s,Pos3D(64+32,0,32)));
av->insert(new VoxelImage(s,Pos3D(32,0,32)));
av->insert(new VoxelImage(s,Pos3D(64+32,0,-32)));
av->insert(new VoxelImage(s,Pos3D(32,0,-32)));
}
else if(test==14)
{
AGSurface s=makeWaterTile();
std::string ms=toPNG(s.surface());
s=fromPNG(ms);
av->insert(new VoxelImage(s,Pos3D(64,0,0)));
}
app.setMainWidget(av);
app.run();
}