本文整理汇总了C++中QSplashScreen::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplashScreen::setAttribute方法的具体用法?C++ QSplashScreen::setAttribute怎么用?C++ QSplashScreen::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplashScreen
的用法示例。
在下文中一共展示了QSplashScreen::setAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
const int splashTime = 1000;
QApplication app(argc, argv);
ControllerWindow w;
QDir imageDir(qApp->applicationDirPath());
imageDir.cd("plugins");
QPixmap pixmap(imageDir.absoluteFilePath("logoupwind.png"));
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->setAttribute(Qt::WA_DeleteOnClose);
fadePlugin(splash, splashTime, false);
splash->show();
QTimer::singleShot(splashTime, &w, SLOT(show()));
QTimer::singleShot(splashTime, splash, SLOT(close()));
//w.show();
return app.exec();
}
示例2: main
QT_USE_NAMESPACE
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(linguist);
QApplication app(argc, argv);
QApplication::setOverrideCursor(Qt::WaitCursor);
QStringList files;
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
QStringList args = app.arguments();
for (int i = 1; i < args.count(); ++i) {
QString argument = args.at(i);
if (argument == QLatin1String("-resourcedir")) {
if (i + 1 < args.count()) {
resourceDir = QFile::decodeName(args.at(++i).toLocal8Bit());
} else {
// issue a warning
}
} else if (!files.contains(argument)) {
files.append(argument);
}
}
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
if (qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir))
app.installTranslator(&qtTranslator);
else
app.removeTranslator(&translator);
}
app.setOrganizationName(QLatin1String("Trolltech"));
app.setApplicationName(QLatin1String("Linguist"));
QSettings config;
QWidget tmp;
tmp.restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());
QSplashScreen *splash = 0;
int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
splash = new QSplashScreen(QApplication::desktop()->screen(screenId),
QPixmap(QLatin1String(":/images/splash.png")));
if (QApplication::desktop()->isVirtualDesktop()) {
QRect srect(0, 0, splash->width(), splash->height());
splash->move(QApplication::desktop()->availableGeometry(screenId).center() - srect.center());
}
splash->setAttribute(Qt::WA_DeleteOnClose);
splash->show();
MainWindow mw;
mw.show();
splash->finish(&mw);
QApplication::restoreOverrideCursor();
mw.openFiles(files, true);
return app.exec();
}
示例3: main
/**
* Main. Creates Application window.
*/
int main(int argc, char** argv)
{
RS_DEBUG->setLevel(RS_Debug::D_WARNING);
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("LibreCAD");
QCoreApplication::setApplicationName("/LibreCAD");
QCoreApplication::setApplicationVersion("master");
QSplashScreen* splash = new QSplashScreen;
RS_SETTINGS->beginGroup("Appearance");
bool show_splash = RS_SETTINGS->readNumEntry("/ShowSplash", 1);
RS_SETTINGS->endGroup();
if (show_splash)
{
QPixmap pixmap(":/main/splash_librecad.png");
splash->setPixmap(pixmap);
splash->setAttribute(Qt::WA_DeleteOnClose);
splash->show();
splash->showMessage(QObject::tr("Loading.."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
app.processEvents();
RS_DEBUG->print("main: splashscreen: OK");
}
#if defined(Q_OS_MAC) && QT_VERSION > 0x050000
//need stylesheet for Qt5 on mac
app.setStyleSheet(
"QToolButton:checked"
"{"
" background-color: rgb(160,160,160);"
" border-style: inset;"
"}"
""
"QToolButton"
"{"
" background-color: transparent;"
"}"
""
"QToolButton:hover"
"{"
" background-color: rgb(255,255,255);"
" border-style: outset;"
"}"
);
#endif
const QString lpDebugSwitch0("-d"),lpDebugSwitch1("--debug") ;
const QString help0("-h"), help1("--help");
bool allowOptions=true;
QList<int> argClean;
for (int i=0; i<argc; i++)
{
QString argstr(argv[i]);
if(allowOptions&&QString::compare("--", argstr)==0)
{
allowOptions=false;
continue;
}
if (allowOptions && (help0.compare(argstr, Qt::CaseInsensitive)==0 ||
help1.compare(argstr, Qt::CaseInsensitive)==0 ))
{
qDebug()<<"librecad::usage: <options> <dxf file>";
qDebug()<<"-h, --help\tdisplay this message";
qDebug()<<"";
qDebug()<<" --help\tdisplay this message";
qDebug()<<"-d, --debug <level>";
RS_DEBUG->print( RS_Debug::D_NOTHING, "possible debug levels:");
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Nothing", RS_Debug::D_NOTHING);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Critical", RS_Debug::D_CRITICAL);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Error", RS_Debug::D_ERROR);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Warning", RS_Debug::D_WARNING);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Notice", RS_Debug::D_NOTICE);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Informational", RS_Debug::D_INFORMATIONAL);
RS_DEBUG->print( RS_Debug::D_NOTHING, " %d Debugging", RS_Debug::D_DEBUGGING);
exit(0);
}
if ( allowOptions&& (argstr.startsWith(lpDebugSwitch0, Qt::CaseInsensitive) ||
argstr.startsWith(lpDebugSwitch1, Qt::CaseInsensitive) ))
{
argClean<<i;
// to control the level of debugging output use --debug with level 0-6, e.g. --debug3
// for a list of debug levels use --debug?
// if no level follows, the debugging level is set
argstr.remove(QRegExp("^"+lpDebugSwitch0));
argstr.remove(QRegExp("^"+lpDebugSwitch1));
char level;
if(argstr.size()==0)
{
if(i+1<argc)
{
if(QRegExp("\\d*").exactMatch(argv[i+1]))
{
++i;
//.........这里部分代码省略.........