当前位置: 首页>>代码示例>>C++>>正文


C++ KUniqueApplication::setTopWidget方法代码示例

本文整理汇总了C++中KUniqueApplication::setTopWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KUniqueApplication::setTopWidget方法的具体用法?C++ KUniqueApplication::setTopWidget怎么用?C++ KUniqueApplication::setTopWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KUniqueApplication的用法示例。


在下文中一共展示了KUniqueApplication::setTopWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    KAboutData aboutData( "amor", I18N_NOOP("amor"),
        AMOR_VERSION, description, KAboutData::License_GPL,
        "(c) 1999, Martin R. Jones");
    aboutData.addAuthor("Martin R. Jones",0, "[email protected]");
    aboutData.addAuthor("Gerardo Puga", I18N_NOOP("Current maintainer"), "[email protected]"); 
    KCmdLineArgs::init( argc, argv, &aboutData );

    if (!KUniqueApplication::start()) {
	fprintf(stderr, "%s is already running!\n", aboutData.appName());
	exit(0);
    }
    KUniqueApplication app;

    // session management
    AmorSessionWidget *sessionWidget = new AmorSessionWidget;
    app.setTopWidget(sessionWidget);

    new Amor();

    app.dcopClient()->setDefaultObject( "AmorIface" );

    return app.exec();
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: main

int main( int argc, char **argv )
{

	qRegisterMetaType<ElementList>();

	options.add("convert-sqlite3", ki18n("Convert the current SQLite 2.x database to SQLite 3 and exit") , 0 );
	options.add( 0, KLocalizedString(), 0 );    


	KAboutData about( "krecipes", 0, ki18n( "Krecipes" ), version, ki18n( "The KDE Cookbook" ), KAboutData::License_GPL, ki18n( "(C) 2003 Unai Garro\n(C) 2004-2006 Jason Kivlighn"), ki18n("This product is RecipeML compatible.\nYou can get more information about this file format in:\nhttp://www.formatdata.com/recipeml" ), "http://krecipes.sourceforge.net/" );
	about.addAuthor( ki18n("Unai Garro"), KLocalizedString(), "[email protected]", 0 );
	about.addAuthor( ki18n("Jason Kivlighn"), KLocalizedString(), "[email protected]", 0 );
	about.addAuthor( ki18n("Cyril Bosselut"), KLocalizedString(), "[email protected]", "http://b1project.com" );

	about.addCredit( ki18n("Colleen Beamer"), ki18n("Testing, bug reports, suggestions"), "[email protected]", 0 );
	about.addCredit( ki18n("Robert Wadley"), ki18n("Icons and artwork"), "[email protected]", 0 );
	about.addAuthor( ki18n("Daniel Sauvé"), ki18n("Porting to KDE4"), "[email protected]", "http://metres.homelinux.com" );

        about.addAuthor( ki18n("Laurent Montel"), ki18n("Porting to KDE4"), "[email protected]", 0 );
        about.addAuthor( ki18n("José Manuel Santamaría Lema"), ki18n("Porting to KDE4, current maintainer"), "[email protected]", 0 );
        about.addAuthor( ki18n("Martin Engelmann"), ki18n("Porting to KDE4, developer"), "[email protected]", 0 );
	
	about.addCredit( ki18n("Patrick Spendrin"), ki18n("Patches to make Krecipes work under Windows"), "[email protected]", 0 );
	about.addCredit( ki18n("Mike Ferguson"), ki18n("Help with bugs, patches"), "", 0 );
	about.addCredit( ki18n("Warren Severin"), ki18n("Code to export recipes to *.mx2 files"), "", 0 );
	
	about.addCredit( ki18n("Eduardo Robles Elvira"),
		ki18n("He advised using WebKit to fix printing support during Akademy-es 2010."),
		"[email protected]", 0 );
	about.addCredit( ki18n("José Millán Soto"),
		ki18n("He advised using WebKit to fix printing support during Akademy-es 2010."),
		"", 0 );

	about.setTranslator( ki18n( "INSERT YOUR NAME HERE" ), ki18n( "INSERT YOUR EMAIL ADDRESS" ) );
	KCmdLineArgs::init( argc, argv, &about );
	KCmdLineArgs::addCmdLineOptions( options );
	KUniqueApplication::addCmdLineOptions();

	if ( !KUniqueApplication::start() ) {
		std::cerr << "Krecipes is already running!" << std::endl;
		return 0;
	}

	KUniqueApplication app;

	// see if we are starting with session management
	if ( app.isSessionRestored() ) {
		RESTORE( Krecipes );
	}
	else {
		// no session.. just start up normally
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

		QApplication::flush();

		if ( args->isSet("convert-sqlite3") ) {
			ConvertSQLite3 sqliteConverter;
			sqliteConverter.convert();
			return 0;
		}

		Krecipes * widget = new Krecipes;
		app.setTopWidget( widget );
		widget->show();

		args->clear();
	}

	return app.exec();
}
开发者ID:eliovir,项目名称:krecipes,代码行数:70,代码来源:main.cpp


注:本文中的KUniqueApplication::setTopWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。