本文整理汇总了C++中KApplication::setMainWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::setMainWidget方法的具体用法?C++ KApplication::setMainWidget怎么用?C++ KApplication::setMainWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::setMainWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
KLocale::setMainCatalogue("kmailcvt");
KAboutData aboutData( "kmailcvt", I18N_NOOP("KMailCVT"),
"3", I18N_NOOP("KMail Import Filters"), KAboutData::License_GPL_V2,
I18N_NOOP("(c) 2000-2005, The KMailCVT developers"));
aboutData.addAuthor("Hans Dijkema",I18N_NOOP("Original author"), "[email protected]");
aboutData.addAuthor("Danny Kukawka", I18N_NOOP("Maintainer & New filters"), "[email protected]");
aboutData.addAuthor("Laurence Anderson", I18N_NOOP("New GUI & cleanups"), "[email protected]");
aboutData.addCredit("Daniel Molkentin", I18N_NOOP("New GUI & cleanups"), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
KMailCVT *kmailcvt = new KMailCVT();
a.setMainWidget(kmailcvt);
kmailcvt->show();
DCOPClient *client=a.dcopClient();
if (!client->attach()) {
return 1;
}
return a.exec();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
示例7: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KLock"), description, version);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCrash::setCrashHandler( crashHandler );
DemoWindow *demoWidget = 0;
Window saveWin = 0;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("setup"))
{
setupScreenSaver();
exit(0);
}
if (args->isSet("window-id"))
{
saveWin = atol(args->getOption("window-id"));
}
if (args->isSet("root"))
{
saveWin = TQApplication::desktop()->handle();
}
if (args->isSet("demo"))
{
saveWin = 0;
}
if (saveWin == 0)
{
demoWidget = new DemoWindow();
demoWidget->setBackgroundMode(TQWidget::NoBackground);
// demoWidget->setBackgroundColor(TQt::black);
demoWidget->show();
saveWin = demoWidget->winId();
app.setMainWidget(demoWidget);
app.processEvents();
}
startScreenSaver(saveWin);
app.exec();
stopScreenSaver();
if (demoWidget)
{
delete demoWidget;
}
return 0;
}
示例8: main
int main(int argc, char **argv)
{
KAboutData about("fedge", I18N_NOOP("fedge"), version, description, KAboutData::License_GPL, "(C) 2004 mkulke", 0, 0, "[email protected]");
about.addAuthor( "mkulke", 0, "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
app.setMainWidget(new Fedge());
return app.exec();
}
示例9: main
int main(int argc, char *argv[])
{
KAboutData aboutData("kcemirror", I18N_NOOP("KCeMirror"), VERSION, description,
KAboutData::License_Custom,
"(c) 2003, Volker Christian (voc)", 0,
"http://synce.sourceforge.net/synce/kde/",
"[email protected]");
aboutData.addAuthor("Volker Christian", 0, "[email protected]");
aboutData.addCredit("Ludovic Lange",
I18N_NOOP("is the Initiator of the SynCE-Project."),
"[email protected]");
aboutData.addCredit("David Eriksson",
I18N_NOOP("is the current Project Manager."),
"[email protected]");
aboutData.addCredit("Ganesh Varadarajan",
I18N_NOOP("has developed the serial-over-USB driver."),
"[email protected]");
aboutData.setLicenseText(MITlicense);
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options );
KApplication::addCmdLineOptions();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString pdaName = args->arg(0);
bool synce = args->isSet("synce");
bool forceInstall = args->isSet("forceinstall");
kdDebug(2120) << "Synce: " << synce << endl;
kdDebug(2120) << "ForceInstall: " << forceInstall << endl;
#if KDE_VERSION < KDE_MAKE_VERSION(3,2,0) // KDE-3.1
KApplication a(argc, argv, QCString("kcemirror"));
#else
KApplication a;
#endif
CeScreen *ceScreen = new CeScreen();
QObject::connect(ceScreen, SIGNAL(pdaError()), &a, SLOT(quit()));
if (!ceScreen->connectPda(pdaName, synce, forceInstall)) {
kdDebug(2120) << "Could not contact PDA " << pdaName << endl;
return -1;
}
a.setMainWidget(ceScreen);
ceScreen->show();
return a.exec();
}
示例10: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KXSConfig"), description, version);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(args->count()==0)
exit(1);
/* We must read exactly the same resources as xscreensaver.
That means we must have both the same progclass *and* progname,
at least as far as the resource database is concerned. So,
put "xscreensaver" in argv[0] while initializing Xt.
*/
const char *dummyargs[] = { "xscreensaver" };
int dummyargc = 1;
progname = dummyargs[0];
// Teach Xt to use the Display that TQt has already opened.
XtToolkitInitialize ();
XtAppContext xtApp = XtCreateApplicationContext ();
Display *dpy = qt_xdisplay();
XtAppSetFallbackResources (xtApp, const_cast<char**>(defaults));
XtDisplayInitialize (xtApp, dpy, progname, progclass, 0, 0,
&dummyargc,
const_cast<char**>(dummyargs));
Widget toplevel_shell = XtAppCreateShell (progname, progclass,
applicationShellWidgetClass,
dpy, 0, 0);
dpy = XtDisplay (toplevel_shell);
db = XtDatabase (dpy);
XtGetApplicationNameAndClass (dpy, const_cast<char**>(&progname),
const_cast<char**>(&progclass));
TQString name = TQString::fromLocal8Bit(args->arg(args->count() - 1));
KXSConfigDialog *dialog=new KXSConfigDialog(args->arg(0), name);
if ( dialog->create() ) {
dialog->show();
app.setMainWidget(dialog);
app.exec();
} else {
KMessageBox::sorry(0,
i18n("No configuration available for %1").tqarg(name),
name );
}
delete dialog;
}
示例11: main
int main( int argc, char** argv )
{
KAboutData aboutData( "kdat", I18N_NOOP("KDat"),
KDAT_VERSION, description, KAboutData::License_GPL,
"(c) 1999-2000, Sean Vyain; 2001-2002 Lawrence Widman");
/* 2002-01-28 LEW: so we can dump core if we want to */
// KCrash::setCrashHandler(0); // this is supposed to work, but it doesn't
#ifdef DEBUG
{
char *newarg;
if( ( newarg = (char *)malloc( strlen("--nocrashhandler") + 1 ) ) == NULL )
{
KMessageBox::sorry(NULL, i18n("Can't allocate memory in kdat"));
exit(1);
}
strcpy( newarg, "--nocrashhandler" );
argv[ argc ] = newarg;
argc++;
}
{
int i;
for(i=0; i<argc; i++){
printf("Arg %d: %s\n", i, argv[i]);
}
}
#endif /* DEBUG */
/* 2002-01-28 LEW */
KCmdLineArgs::init( argc, argv, &aboutData );
aboutData.addAuthor( "Lawrence Widman", 0, "[email protected]");
// KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication app;
app.setMainWidget( KDatMainWindow::getInstance() );
/* set up error handler so we don't crash without notice */
signal(SIGHUP, error_handler);
signal(SIGINT, error_handler);
signal(SIGFPE, error_handler);
signal(SIGSEGV, error_handler);
signal(SIGTERM, error_handler);
if ( app.isRestored() && KDatMainWindow::canBeRestored( 1 ) ) {
KDatMainWindow::getInstance()->restore( 1 );
} else {
KDatMainWindow::getInstance()->show();
}
return app.exec();
}
示例12: main
int main(int argc, char **argv) {
KAboutData about(PROGRAM_NAME, PROGRAM_NAME, VERSION, "ZMD Repo Config");
KCmdLineArgs::init(argc, argv, &about);
KApplication::addCmdLineOptions();
KApplication *app = new KApplication();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
MainWindow *main = new MainWindow();
app->setMainWidget(main);
return app->exec();
}
示例13: kdemain
extern "C" int KDE_EXPORT kdemain(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, "kprinter", I18N_NOOP("KPrinter"), I18N_NOOP("A printer tool for KDE"), "0.0.1");
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
PrintWrapper *wrap = new PrintWrapper;
app.setMainWidget(wrap);
QTimer::singleShot(10, wrap, SLOT(slotPrint()));
int result = app.exec();
delete wrap;
return result;
}
示例14: main
int main(int argc, char **argv)
{
KAboutData about("knetattach", I18N_NOOP("KDE Network Wizard"), "1.0", I18N_NOOP("KDE Network Wizard"), KAboutData::License_GPL,
I18N_NOOP("(c) 2004 George Staikos"), 0, "http://www.kde.org/");
about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KApplication a;
KNetAttach na;
a.setMainWidget(&na);
na.show();
return a.exec();
}
示例15: main
int main( int argc, char* argv[] ) {
KAboutData aboutData( "dbtest", I18N_NOOP( "dBTest" ),
"0.1", "", KAboutData::License_GPL,
"(c) 2002, Arnold Krille" );
aboutData.addAuthor( "Arnold Krille", I18N_NOOP( "Creator" ), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
dBTestWidget* w = new dBTestWidget( 0 );
w->show();
app.setMainWidget( w );
return app.exec();
}