本文整理汇总了C++中KApplication::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::exec方法的具体用法?C++ KApplication::exec怎么用?C++ KApplication::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "klatin", I18N_NOOP("KLatin"),
"0.9", description, KAboutData::License_GPL,
"(C) 2001-2004, George Wright", 0, "http://edu.kde.org/klatin", "[email protected]");
aboutData.addAuthor("George Wright",I18N_NOOP("Author and Maintainer"), "[email protected]");
aboutData.addCredit("Anne-Marie Mahfouf",I18N_NOOP("Bug fixes, documentation"), "[email protected]");
aboutData.addCredit("Neil Stevens",I18N_NOOP("Vocabulary shuffling code"), "[email protected]");
aboutData.addCredit("Danny Allen",I18N_NOOP("SVG icon"), "[email protected]");
aboutData.addCredit("Pino Toscano",I18N_NOOP("Bug fixes and code improvement, Italian Vocabulary Data Translation"), "[email protected]");
aboutData.addCredit("Mikolaj Machowski",I18N_NOOP("Polish Vocabulary Data Translation"), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
KLatin *klatin = new KLatin();
if (a.isRestored()) {
RESTORE(KLatin);
} else {
a.setMainWidget(klatin);
klatin->show();
}
return a.exec();
}
示例2: main
int main(int argc, char**argv) {
kDebug() << "hello world";
KAboutData ad( "asdf",
0,
ki18n("asdf"),
"1.0",
ki18n("asdf"),
KAboutData::License_GPL,
ki18n("(c) 2007")
);
KCmdLineArgs::init( argc, argv, &ad );
KApplication app;
QWidget window;
QLabel label("hello world");
QLineEdit edit("edit me");
QVBoxLayout box(&window);
box.addWidget(&label);
box.addWidget(&edit);
window.show();
return app.exec();
}
示例3: main
int main(int argc, char **argv)
{
KAboutData aboutData( "ksnapshot", I18N_NOOP("KSnapshot"),
KSNAPVERSION, description, KAboutData::License_GPL,
"(c) 1997-2004, Richard J. Moore,\n(c) 2000, Matthias Ettrich,\n(c) 2002-2003 Aaron J. Seigo");
aboutData.addAuthor("Richard J. Moore",0, "[email protected]");
aboutData.addAuthor("Matthias Ettrich",0, "[email protected]");
aboutData.addAuthor("Aaron J. Seigo", 0, "[email protected]");
aboutData.addCredit( "Nadeem Hasan", I18N_NOOP("Region Grabbing\nReworked GUI"),
"[email protected]" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication app;
KImageIO::registerFormats();
// Create top level window
KSnapshot *toplevel;
if ( args->isSet( "current" ) )
toplevel = new KSnapshot( 0, 0, true );
else
toplevel = new KSnapshot();
args->clear();
app.dcopClient()->setDefaultObject( toplevel->objId() );
toplevel->setCaption( app.makeStdCaption("") );
app.setMainWidget(toplevel);
toplevel->show();
return app.exec();
}
示例4: main
int main(int argc, char *argv[])
{
KAboutData aboutData("photolayoutseditor",
0,
ki18n("Photo Layouts Editor"),
QString("").toUtf8(),
ki18n(""),
KAboutData::License_GPL,
ki18n(""),
ki18n(""),
QString("").toUtf8());
KCmdLineArgs::init(argc,argv,&aboutData);
KApplication a;
PhotoLayoutsEditor * w = PhotoLayoutsEditor::instance(0);
w->setAttribute(Qt::WA_DeleteOnClose, true);
int height = QApplication::desktop()->height()-500;
w->resize(round(height*16.0/9.0),height);
QDesktopWidget * d = a.desktop();
w->move(d->rect().center()-w->frameGeometry().center());
w->show();
int result = a.exec();
return result;
}
示例5: main
int main( int argc, char *argv[] )
{
KAboutData about("kooka", // appName
"", // catalogName
ki18n("Kooka"), // programName
#if VCS_AVAILABLE
(VERSION " (" VCS_TYPE " " VCS_REVISION ")"),
#else
VERSION, // version
#endif
ki18n(shortDesc), // shortDescription
KAboutData::License_GPL_V2, // licenseType
ki18n(copyright), // copyrightStatement
ki18n(longDesc), // text
"http://techbase.kde.org/Projects/Kooka");
about.addAuthor(ki18n("Jonathan Marten"), ki18n("Current maintainer, KDE4 port"), "[email protected]");
about.addAuthor(ki18n("Klaas Freitag"), ki18n("Developer"), "[email protected]");
about.addCredit(ki18n("Mat Colton"), ki18n("Graphics, web"), "[email protected]");
about.addCredit(ki18n("Ivan Shvedunov"), ki18n("Original kscan application"), "[email protected]");
about.addCredit(ki18n("Alex Kempshall"), ki18n("Photocopy facility"), "[email protected]");
about.addLicenseText(ki18n(addLicense));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("d <device>", ki18n("The SANE device specification (e.g. 'umax:/dev/sg0')"));
options.add("g", ki18n("Gallery mode - do not connect to scanner"));
KCmdLineArgs::addCmdLineOptions(options); // Add my own options
KApplication app;
KGlobal::locale()->insertCatalog("libkscan");
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString devToUse = args->getOption("d");
if (args->isSet("g"))
{
devToUse = "gallery";
}
kDebug() << "DevToUse is" << devToUse;
// TODO: not sure what this did
// if (args->count()==1)
// {
// args->usage();
// // exit(-1);
// }
// TODO: try ScanGlobal::init(), if that fails no point in carrying on
// so show an error box and give up (or can we carry on and run in
// gallery mode only?)
Kooka *kooka = new Kooka(devToUse.toLocal8Bit());
kooka->show();
app.processEvents();
kooka->startup();
args->clear();
return (app.exec());
}
示例6: main
int main(int argc, char *argv[])
{
KAboutData aboutData("orario", 0, ki18n("Orario"),
"0.1", ki18n("Description"),
KAboutData::License_GPL,
ki18n("(c) 2008 Riccardo Iaconelli"),
KLocalizedString(), "", "[email protected]");
aboutData.addAuthor(ki18n("Riccardo Iaconelli"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs::parsedArgs();
KApplication app;
KMainWindow *wi = new KMainWindow;
QWidget *w = new QWidget;
Ui::Form ui;
ui.setupUi(w);
wi->setCentralWidget(w);
wi->show();
return app.exec();
}
示例7: main
int main(int argc, char **argv)
{
KAboutData aboutData("liri-control-kde4",
0,
ki18n("Liri Control"), //programname
ABOUT_VERSION, //version
ki18n(ABOUT_SUMMARY), //short Desc
KAboutData::License_LGPL_V3, //license
ki18n(ABOUT_COPYRIGHT), //copywrite statement
ki18n("Status of liri components"), //text
"http://cerebro.webhop.net/liri", //homepage
ABOUT_AUTHOR_EMAIL); //bugsemail address
aboutData.addAuthor(ki18n(ABOUT_AUTHOR), ki18n("Lead developer"), ABOUT_AUTHOR_EMAIL);
aboutData.setProgramIconName(QLatin1String("liri-control"));
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
app.setWindowIcon(KIcon(QLatin1String("liri-control")));
app.setQuitOnLastWindowClosed(true);
BusConnection* busconnection = new BusConnection();
/* self freeing object! */
MainWindow* window = new MainWindow(busconnection);
window->show();
int res = app.exec();
delete busconnection;
return res;
}
示例8: main
int main( int argc, char **argv )
{
KCmdLineArgs::init(argc, argv, "kurlrequestertest", 0, ki18n("kurlrequestertest"), "0", ki18n("test app"));
KApplication app;
app.setQuitOnLastWindowClosed(false);
KUrl url = KUrlRequesterDialog::getUrl( "ftp://ftp.kde.org" );
qDebug( "Selected url: %s", url.url().toLatin1().constData());
KUrlRequester *req = new KUrlRequester();
#ifndef KDE_NO_DEPRECATED
KEditListBox *el = new KEditListBox( QLatin1String("Test"), req->customEditor() );
#else
KEditListWidget *el = new KEditListWidget( req->customEditor() );
el->setWindowTitle( QLatin1String("Test") );
#endif
el->show();
KUrlRequester *req1 = new KUrlRequester();
req1->fileDialog();
req1->setWindowTitle("AAAAAAAAAAAA");
req1->show();
return app.exec();
}
示例9: main
int main(int argc, char *argv[])
{
KAboutData aboutData(
"gwenview", /* appname */
0, /* catalogName */
ki18n("Gwenview"), /* programName */
GWENVIEW_VERSION); /* version */
aboutData.setShortDescription(ki18n("An Image Viewer"));
aboutData.setLicense(KAboutData::License_GPL);
aboutData.setCopyrightStatement(ki18n("Copyright 2000-2010 Aurélien Gâteau"));
aboutData.addAuthor(
ki18n("Aurélien Gâteau"),
ki18n("Main developer"),
"[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("f", ki18n("Start in fullscreen mode"));
options.add("s", ki18n("Start in slideshow mode"));
options.add("+[file or folder]", ki18n("A starting file or folder"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
Gwenview::ImageFormats::registerPlugins();
// startHelper must live for the whole live of the application
StartHelper startHelper;
if (app.isSessionRestored()) {
kRestoreMainWindows<Gwenview::MainWindow>();
} else {
startHelper.createMainWindow();
}
return app.exec();
}
示例10: main
int main(int argc, char **argv)
{
// Default start-up routine
KAboutData about("kmditest", I18N_NOOP("KMDITest"), version, description,
KAboutData::License_GPL, "(C) 2004 Andrea Bergia", 0, 0, "[email protected]");
about.addAuthor( "Andrea Bergia", 0, "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
// Read MDI mode
KConfig *c = app.config();
QString strMode = c->readEntry( "MDIMode", "ideal" );
KMdi::MdiMode mode = KMdi::IDEAlMode;
if ( strMode == "toplevel" ) {
mode = KMdi::ToplevelMode;
} else if ( strMode == "childframe" ) {
mode = KMdi::ChildframeMode;
} else if ( strMode == "tabpage" ) {
mode = KMdi::TabPageMode;
}
// Create main window
KMDITest *mainWin = new KMDITest( mode );
app.setMainWidget( mainWin );
mainWin->show();
// mainWin has WDestructiveClose flag by default, so it will delete itself.
return app.exec();
}
示例11: main
int main(int argc, char *argv[])
{
KAboutData aboutData("itemview-test", 0, ki18n("test for item view"),
"0.1", ki18n("test app"),
KAboutData::License_GPL,
ki18n("(c) 2008 Alessandro Diaferia"),
KLocalizedString(), "", "[email protected]");
aboutData.addAuthor(ki18n("Alessandro Diaferia"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs::parsedArgs();
KApplication app;
KDialog *window = new KDialog();
RaptorItemsView *itemsView = new RaptorItemsView(window);
Kickoff::ApplicationModel *model = new Kickoff::ApplicationModel();
itemsView->setModel(model);
RaptorItemDelegate *delegate = new RaptorItemDelegate();
itemsView->setItemDelegate(delegate);
window->setMainWidget(itemsView);
window->show();
return app.exec();
}
示例12: main
int main( int argc, char** argv )
{
QString dbname = "test";
KAboutData aboutData( "tests","Test","0.1" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
Classes::setup();
QSqlDatabase *db = QSqlDatabase::addDatabase( "QPSQL7" );
db->setDatabaseName( dbname );
db->setUserName( "ak213" );
db->setPassword( "ak" );
db->setHostName( "localhost" );
if ( ! db->open() ) {
kdDebug() << "Failed to open database: " << db->lastError().text() << endl;
return 0;
}
//Notifier *notifier = new Notifier();
DbBackendIface *backend = new SqlDbBackend( db );
//Manager *manager = new Manager( backend, notifier );
Manager *manager = new Manager( backend );
manager->setMaxObjects( 1000 );
/* Collection col( "CustomerOrder" );
CollectionIterator it( col.begin() );
CollectionIterator end( col.end() );
if ( it != end ) {*/
ClassMainWindow *window = new ClassMainWindow();
window->show();
app.setMainWidget( window );
// }
return app.exec();
}
示例13: main
int main( int argc, char** argv ) {
if ( argc < 3 ) {
kDebug(5150) <<"Need at least two arguments";
return 1;
}
KAboutData aboutData( "test_gnupgprocessbase", 0, ki18n("GnuPGProcessBase Test"), "0.1" );
KCmdLineArgs::init( &aboutData );
KApplication app;
Kleo::GnuPGProcessBase gpg;
for ( int i = 1 ; i < argc ; ++i )
gpg << argv[i];
gpg.setUseStatusFD( true );
GnuPGViewer * gv = new GnuPGViewer();
gv->setProcess( &gpg );
gv->show();
gpg.setOutputChannelMode(KProcess::SeparateChannels);
gpg.start();
return app.exec();
}
示例14: main
int main(int argc, char ** argv)
{
KCmdLineOptions options;
options.add("+URL1", ki18n("The first URL to play"));
options.add("+URL2", ki18n("The second URL to play"));
KAboutData about("crossfade", 0, ki18n("Phonon Crossfade Example"),
"1.0", KLocalizedString(),
KAboutData::License_LGPL);
about.addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KUrl url1;
KUrl url2;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 2)
{
url1 = args->url(0);
url2 = args->url(1);
if (url1.isValid() && url2.isValid())
{
Crossfader xfader(url1, url2);
return app.exec();
}
}
return 1;
}
示例15: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "poof2", I18N_NOOP("Poof2"),
"0.1", description, KAboutData::License_GPL,
"(c) 2004, Augusto Beiro", 0, 0, "[email protected]");
aboutData.addAuthor("Augusto Beiro",0, "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
pid_t tenedor;
mainWin *poof2 = new mainWin();
a.setMainWidget(poof2);
int wxx=poof2->width();
int hxx=poof2->height();
QWidget* tmp = QApplication::desktop();
poof2->setGeometry(tmp->width()/2-(wxx/2),tmp->height()/2-(hxx/2),wxx, hxx);
//poof2->show();
return a.exec();
}