本文整理汇总了C++中KApplication::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::connect方法的具体用法?C++ KApplication::connect怎么用?C++ KApplication::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char **argv )
{
KAboutData about( "test-kjsembed", I18N_NOOP("KJS Embed Test"), "0.1",
I18N_NOOP("Test"),
KAboutData::License_LGPL, I18N_NOOP("(c) 2001-2003 Richard Moore") );
KCmdLineArgs::init( argc, argv, &about );
KApplication app;
// Setup Interpreter
KJS::Interpreter *js = KJSEmbed::JSFactory::defaultJS();
KJS::Object global = js->globalObject();
// Create Console
KJSEmbed::JSConsoleWidget *console = new KJSEmbed::JSConsoleWidget( js );
console->addBindings( global );
JSFactory::publish( &app, js, global, "app" );
JSFactory::publish( console, js, global, "console" );
// Setup Window
app.setMainWidget( console );
app.connect( &app, SIGNAL( lastWindowClosed() ), SLOT(quit()) );
console->resize( 600, 450 );
console->show();
return app.exec();
}
示例2: main
int main( int argc, char ** argv )
{
KAboutData aboutData("kcachegrind", 0,
ki18n("KCachegrind"),
KCACHEGRIND_VERSION,
ki18n("KDE Frontend for Callgrind/Cachegrind"),
KAboutData::License_GPL,
ki18n("(C) 2002 - 2011"), KLocalizedString(),
"http://kcachegrind.sf.net");
aboutData.addAuthor(ki18n("Josef Weidendorfer"),
ki18n("Author/Maintainer"),
"[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
//options.add("r <exec>", ki18n("Run <exec> under cachegrind"));
options.add("+[trace]", ki18n("Show information of this trace"));
KCmdLineArgs::addCmdLineOptions( options );
KApplication a;
KGlobal::locale()->insertCatalog("kcachegrind_qt");
TopLevel* t;
Loader::initLoaders();
KConfig* kc = KGlobal::config().data();
ConfigStorage::setStorage(new KDEConfigStorage(kc));
if (a.isSessionRestored()){
int n = 1;
while (KMainWindow::canBeRestored(n)){
(new TopLevel())->restore(n);
n++;
}
}
else {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
int nbArgs = args->count();
if (nbArgs>0) {
for(int i = 0; i < nbArgs; i++) {
t = new TopLevel();
t->show();
t->loadDelayed(args->arg(i));
}
}
else {
// load trace in current dir
t = new TopLevel();
t->show();
t->loadDelayed(".");
}
}
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
int res = a.exec();
// to make leak checking in valgrind happy...
Loader::deleteLoaders();
ProfileContext::cleanup();
ConfigStorage::cleanup();
return res;
}