本文整理汇总了C++中KApplication::desktop方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::desktop方法的具体用法?C++ KApplication::desktop怎么用?C++ KApplication::desktop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::desktop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: main
int main ( int argc, char **argv ) {
KAboutData about ( "kmilion", 0, ki18n ( "KMilion" ), version, ki18n ( description ),
KAboutData::License_GPL, ki18n ( "(C) 2010 Mikołaj Sochacki" ), KLocalizedString(), 0, "[email protected]" );
about.addAuthor ( ki18n ( "Mikołaj Sochacki" ), KLocalizedString(), "[email protected]" );
KCmdLineArgs::init ( argc, argv, &about );
KCmdLineOptions options;
options.add ( "+[URL]", ki18n ( "Document to open" ) );
KCmdLineArgs::addCmdLineOptions ( options );
KApplication app;
KMilion *widget = new KMilion;
const QRect r = app.desktop()->frameGeometry();
widget->setScreenSize ( r.width(), r.height() );
KCmdLineArgs *args;
if ( app.isSessionRestored() ) {
RESTORE ( KMilion );
}
else {
args = KCmdLineArgs::parsedArgs();
widget->show();
}
args->clear();
// Tak jest w orginale nie mam pojęcia dlaczego? Szczególnie po co kilka razy show!
//see if we are starting with session management
// if (app.isSessionRestored())
// {
// RESTORE(KMilion);
// }
// else
// {
// // no session.. just start up normally
// KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
// if (args->count() == 0)
// {
// //kmilion *widget = new kmilion;
// widget->show();
// }
// else
// {
// int i = 0;
// for (; i < args->count(); i++)
// {
// //kmilion *widget = new kmilion;
// widget->show();
// }
// }
// args->clear();
// }
return app.exec();
}