本文整理汇总了C++中QLocale::setDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ QLocale::setDefault方法的具体用法?C++ QLocale::setDefault怎么用?C++ QLocale::setDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLocale
的用法示例。
在下文中一共展示了QLocale::setDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(caQtDM);
#ifdef MOBILE
Q_INIT_RESOURCE(qtcontrols);
#endif
QApplication app(argc, argv);
QApplication::setOrganizationName("Paul Scherrer Institut");
QApplication::setApplicationName("caQtDM");
#ifdef MOBILE_ANDROID
app.setStyle(QStyleFactory::create("fusion"));
#endif
// we do not want numbers with a group separators
QLocale loc = QLocale::system();
loc.setNumberOptions(QLocale::OmitGroupSeparator);
loc.setDefault(loc);
QString fileName = "";
QString macroString = "";
QString geometry = "";
QString macroFile = "";
QMap<QString, QString> options;
options.clear();
searchFile *s = new searchFile("caQtDM_stylesheet.qss");
QString fileNameFound = s->findFile();
if(fileNameFound.isNull()) {
printf("caQtDM -- file <caQtDM_stylesheet.qss> could not be loaded, is 'CAQTDM_DISPLAY_PATH' <%s> defined?\n", qasc(s->displayPath()));
} else {
QFile file(fileNameFound);
file.open(QFile::ReadOnly);
QString StyleSheet = QLatin1String(file.readAll());
printf("caQtDM -- file <caQtDM_stylesheet.qss> loaded as the default application stylesheet\n");
app.setStyleSheet(StyleSheet);
file.close();
}
int in, numargs;
bool attach = false;
bool minimize= false;
bool nostyles = false;
bool printscreen = false;
bool resizing = true;
for (numargs = argc, in = 1; in < numargs; in++) {
//qDebug() << argv[in];
if ( strcmp (argv[in], "-display" ) == 0 ) {
in++;
printf("caQtDM -- display <%s>\n", argv[in]);
} else if ( strcmp (argv[in], "-macro" ) == 0 ) {
in++;
printf("caQtDM -- macro <%s>\n", argv[in]);
macroString = QString(argv[in]);
} else if ( strcmp (argv[in], "-attach" ) == 0 ) {
printf("caQtDM -- will attach to another caQtDM if running\n");
attach = true;
} else if ( strcmp (argv[in], "-noMsg" ) == 0 ) {
printf("caQtDM -- will minimize its main windows\n");
minimize = true;
} else if( strcmp (argv[in], "-macrodefs" ) == 0) {
in++;
printf("caQtDM -- will load macro string from file <%s>\n", argv[in]);
macroFile = QString(argv[in]);
} else if ( strcmp (argv[in], "-noStyles" ) == 0 ) {
printf("caQtDM -- will not replace the default application stylesheet caQtDM_stylesheet.qss\n");
nostyles = true;
} else if ( strcmp (argv[in], "-x" ) == 0 ) {
} else if ( strcmp (argv[in], "-displayFont" ) == 0 ) {
in++;
} else if(!strcmp(argv[in],"-help") || !strcmp(argv[in],"-h") || !strcmp(argv[in],"-?")) {
in++;
printf("Usage:\n"
" caQtDM[X options]\n"
" [-help | -h | -?]\n"
" [-x]\n"
" [-attach]\n"
" [-noMsg]\n"
" [-noStyles] works only when not attaching\n"
" [-macro \"xxx=aaa,yyy=bbb, ...\"]\n"
" [-macrodefs filename] will load macro definitions from file\n"
" [-dg [<width>x<height>][+<xoffset>-<yoffset>]\n"
" [-httpconfig] will display a network configuration screen at startup\n"
" [-print] will print file and exit\n"
" [-noResize] will prevent resizing\n"
" [-cs defaultcontrolsystempluginname]\n"
" [-option \"xxx=aaa,yyy=bbb, ...\"] options for cs plugins\n"
" [file]\n"
" [&]\n"
"\n"
" -x -displayFont -display are ignored !\n\n");
exit(1);
} else if((!strcmp(argv[in],"-displayGeometry")) || (!strcmp(argv[in],"-dg"))) {
// [-dg [xpos[xypos]][+xoffset[+yoffset]]
in++;
geometry = QString(argv[in]);
} else if(!strcmp(argv[in], "-print")) {
printscreen = true;
//.........这里部分代码省略.........