本文整理汇总了C++中KApplication::setTopWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::setTopWidget方法的具体用法?C++ KApplication::setTopWidget怎么用?C++ KApplication::setTopWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::setTopWidget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
KAboutData about("kiriki", 0, ki18n("Kiriki"), "0.2", ki18n("A Yahtzee dice game for KDE"), KAboutData::License_GPL, ki18n("© 2005-2007 Albert Astals Cid"), KLocalizedString(), "http://games.kde.org/kiriki" );
about.addAuthor(ki18n("Albert Astals Cid"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
app.setTopWidget(new kiriki());
return app.exec();
}
示例2: main
int main( int argc, char **argv )
{
KAboutData aboutData( "ktimer", I18N_NOOP("KTimer"),
version, description, KAboutData::License_GPL,
"(c) 2001, Stefan Schimanski");
aboutData.addAuthor("Stefan Schimanski",0, "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
KTimerPref *timer = new KTimerPref;
app.setMainWidget( timer );
app.setTopWidget( timer );
return app.exec();
}
示例3: main
int main ( int argc, char *argv[] )
{
KAboutData aboutData ( "SUSEgreeter", 0, ki18n ( "SUSEgreeter" ), "0.1",
ki18n ( "SUSEgreeter" ), KAboutData::License_GPL, ki18n ( "(c) 2001, Adrian Schroeter" ) );
aboutData.addAuthor ( ki18n ( "Adrian Schroeter" ), KLocalizedString(), "[email protected]" );
KCmdLineArgs::init ( argc, argv, &aboutData );
KLocale::setMainCatalog ( "SUSEgreeter" );
KApplication a;
KGlobal::locale()->insertCatalog ( QString::fromLatin1 ( "kpersonalizer" ) );
// first, reset the startup from true (see desktop file in share/autostart) to false
KConfig SUSEgreeterrc ( "SUSEgreeterrc" );
KConfigGroup grp = SUSEgreeterrc.group ( "General" );
bool ktip = ( grp.readEntry ( "FirstLogin113", true ) );
grp.writeEntry ( "FirstLogin113", false );
grp.sync();
SUSEgreetings greeter;
a.setTopWidget ( &greeter );
greeter.adjustSize();
QDesktopWidget *dsk = kapp->desktop();
QRect scr = dsk->screenGeometry ( dsk->screenNumber ( QPoint ( 0, 0 ) ) );
QRect grt ( 0, 0, greeter.width(), greeter.height() );
grt.moveCenter ( scr.center() );
greeter.setGeometry ( grt );
greeter.show();
int ret = a.exec();
if ( ktip ) { // only run if we set this to true in the constructor. then SUSEgreeter didn't run before
// set the ktiprc file entry to true. The global one is set to false for starting SUSEgreeter
#if 0
KConfig ktiprc ( "ktiprc" );
KConfigGroup group = ktiprc.group ( "TipOfDay" );
group.writeEntry ( "RunOnStart", true );
ktiprc.sync();
#endif
// kapp->dcopClient()->send("kicker", "kicker", "showKMenu()", "");
}
return ret;
}
示例4: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "kteatime", I18N_NOOP("KTeaTime"),
version, description, KAboutData::License_GPL,
"(c) 1998-1999, Matthias Hoelzer-Kluepfel\n(c) 2002-2003, Martin Willers");
aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]");
aboutData.addAuthor("Martin Willers", 0, "[email protected]");
aboutData.addCredit("Daniel Teske", I18N_NOOP("Many patches"), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
TopLevel toplevel;
KWin::setSystemTrayWindowFor(toplevel.winId(), 0);
toplevel.show();
app.setTopWidget(&toplevel);
KStartupInfo::appStarted();
return app.exec();
}
示例5: main
int main(int argc, char* argv[])
{
ScanDialogAboutData* aboutData = new ScanDialogAboutData;
aboutData->setAppName("scangui");
aboutData->setCatalogName("kipiplugin_acquireimages");
KCmdLineArgs::init(argc, argv, aboutData);
KPMetadata::initializeExiv2();
KApplication app;
aboutData->setProgramLogo(KIcon("scanner"));
KSaneWidget* saneWidget = new KSaneWidget(0);
if (!saneWidget)
return -1;
QString dev = saneWidget->selectDevice(0);
if (dev.isEmpty())
return -1;
if (!saneWidget->openDevice(dev))
{
// could not open a scanner
KMessageBox::sorry(0, i18n("Cannot open scanner device."));
return -1;
}
ScanDialog* dlg = new ScanDialog(saneWidget, app.activeWindow(), aboutData);
app.setTopWidget(dlg);
dlg->show();
int ret = app.exec();
KPMetadata::cleanupExiv2();
return ret;
}
示例6: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, "Testkhtml", "a basic web browser using the KHTML library", "1.0");
KCmdLineArgs::addCmdLineOptions(options);
KApplication a;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs( );
if ( args->count() == 0 ) {
KCmdLineArgs::usage();
::exit( 1 );
}
KHTMLFactory *fac = new KHTMLFactory();
KMainWindow *toplevel = new KMainWindow();
KHTMLPart *doc = new KHTMLPart( toplevel, 0, toplevel, 0, KHTMLPart::BrowserViewGUI );
Dummy *dummy = new Dummy( doc );
QObject::connect( doc->browserExtension(), SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ),
dummy, SLOT( slotOpenURL( const KURL&, const KParts::URLArgs & ) ) );
if (args->url(0).url().right(4).find(".xml", 0, false) == 0) {
KParts::URLArgs ags(doc->browserExtension()->urlArgs());
ags.serviceType = "text/xml";
doc->browserExtension()->setURLArgs(ags);
}
doc->openURL( args->url(0) );
// DOMTreeView * dtv = new DOMTreeView(0, doc, "DomTreeView");
// dtv->show();
toplevel->setCentralWidget( doc->widget() );
toplevel->resize( 640, 800);
// dtv->resize(toplevel->width()/2, toplevel->height());
QDomDocument d = doc->domDocument();
QDomElement viewMenu = d.documentElement().firstChild().childNodes().item( 2 ).toElement();
QDomElement e = d.createElement( "action" );
e.setAttribute( "name", "debugRenderTree" );
viewMenu.appendChild( e );
e = d.createElement( "action" );
e.setAttribute( "name", "debugDOMTree" );
viewMenu.appendChild( e );
QDomElement toolBar = d.documentElement().firstChild().nextSibling().toElement();
e = d.createElement( "action" );
e.setAttribute( "name", "reload" );
toolBar.insertBefore( e, toolBar.firstChild() );
e = d.createElement( "action" );
e.setAttribute( "name", "print" );
toolBar.insertBefore( e, toolBar.firstChild() );
(void)new KAction( "Reload", "reload", Qt::Key_F5, dummy, SLOT( reload() ), doc->actionCollection(), "reload" );
KAction* kprint = new KAction( "Print", "print", 0, doc->browserExtension(), SLOT( print() ), doc->actionCollection(), "print" );
kprint->setEnabled(true);
toplevel->guiFactory()->addClient( doc );
doc->setJScriptEnabled(true);
doc->setJavaEnabled(true);
doc->setURLCursor(QCursor(Qt::PointingHandCursor));
a.setTopWidget(doc->widget());
QWidget::connect(doc, SIGNAL(setWindowCaption(const QString &)),
doc->widget(), SLOT(setCaption(const QString &)));
doc->widget()->show();
toplevel->show();
((QScrollView *)doc->widget())->viewport()->show();
int ret = a.exec();
//delete doc;
//delete dtv;
khtml::Cache::clear();
khtml::CSSStyleSelector::clear();
khtml::RenderStyle::cleanup();
delete fac;
return ret;
}