本文整理汇总了C++中QSplashScreen::finish方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplashScreen::finish方法的具体用法?C++ QSplashScreen::finish怎么用?C++ QSplashScreen::finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplashScreen
的用法示例。
在下文中一共展示了QSplashScreen::finish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// Start method main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Create splashscreen object
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/img/images/splash.png"));
splash->show();
// Create database object
Database *db = new Database();
Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->showMessage(QObject::tr("Establishing connections..."),
topRight, Qt::white);
// Database connection
if(!db->createConnection())
return 1;
// Client connection
Clock clock;
clock.show();
splash->showMessage(QObject::tr("Setting up main window..."),
topRight, Qt::white);
// Create game window
GameWindow gameWindow;
splash->showMessage(QObject::tr("Setting up game..."),
topRight, Qt::white);
// create game
Game *game = new Game();
gameWindow.setCentralWidget(game);
gameWindow.show();
splash->finish(&gameWindow);
delete splash;
return a.exec();
}// End method main
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QSplashScreen *splash = new QSplashScreen(QPixmap("/home/cesar/Git/appSignal/ucm.png"),Qt::WindowStaysOnTopHint | Qt::SplashScreen);
splash->show();
//splash->showMessage("Iniciando ventana principal ...");
w.upOctave();
//splash->showMessage("Cargando modulos ...", Qt::TopRightSection, Qt::white);
//splash->showMessage("Estableciendo conexiones ...", Qt::AlignRight | Qt::AlignTop,Qt::white);
QThread::sleep(5);
w.show();
splash->finish(&w);
delete splash;
return a.exec();
}
示例3: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QPixmap pixmap=QPixmap("hello1.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->show();
Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->showMessage(QString::fromLocal8Bit("Setting up the main window..."),topRight, Qt::white);
splash->showMessage(QString::fromLocal8Bit("Loading modules..."), topRight,Qt::white);
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK")); //路径名支持中文
QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK")); //QString支持中文
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK")); //string支持中文
QApplication::setFont(QFont(QString::fromLocal8Bit("宋体"), 10, QFont::Normal));
w.setWindowTitle(QString::fromLocal8Bit("数字图像处理"));
w.show();
splash->finish(&w);
delete splash;
return a.exec();
}
示例4: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(eepe);
QApplication app(argc, argv);
QString dir;
if(argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
if ( argc > 1 )
{
DebugMode = 1 ;
}
QSettings settings("er9x-eePe", "eePe");
QString locale = settings.value("locale",QLocale::system().name()).toString();
bool showSplash = settings.value("show_splash", true).toBool();
QPixmap pixmap(":/images/eepe-title.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
if(showSplash)
{
splash->show();
bool checkER9X = settings.value("startup_check_er9x", true).toBool();
bool checkEEPE = settings.value("startup_check_eepe", true).toBool();
if(checkEEPE || checkER9X)
splash->showMessage(QObject::tr("Checking for updates..."));
}
QTranslator *translator = new QTranslator();
translator->load(QString("eepe_") + locale, dir);
app.installTranslator(translator);
MainWindow mainWin;
mainWin.show();
splash->finish(&mainWin);
return app.exec();
}
示例5: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap("C:/Users/Nate/Desktop/Qtstuff/texteditor/Splash.png"));
//splash->setPixmap(QPixmap("C:/Users/Byron/CSE-20212/Images/Splash.png"));
splash->show();
a.setWindowIcon(QIcon("C:/Users/Nate/Desktop/Qtstuff/texteditor/Icon.png"));
// a.setWindowIcon(QIcon("C:/Users/Byron/CSE-20212/Images/Icon.png"));
a.processEvents();
sleep(3);
QFont font("Lucida", 10, 0, false);
MainWindow * mainWin = new MainWindow;
a.setFont(font, "QPlainTextEdit");
mainWin->show();
splash->finish(mainWin);
return a.exec();
}
示例6: main
int main(int argc, char *argv[])
{
qRegisterMetaType<byte>("byte");
qRegisterMetaType<word>("word");
qRegisterMetaType<dword>("dword");
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/icon/icon/splash.png"));
splash->setDisabled(true);
splash->show();
splash->showMessage(QObject::tr("Starting..."), Qt::AlignRight | Qt::AlignTop, Qt::white);
MainWindow w;
w.show();
splash->finish(&w);
delete splash;
return a.exec();
}
示例7: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(pvbrowser);
wsa(); // init windows sockets
QApplication app(argc, argv);
QPixmap pm(splash);
QSplashScreen *splash = new QSplashScreen(pm);
splash->show();
init(argc,argv);
perhapsSetFont(app);
QIcon appIcon(":/images/app.png");
app.setWindowIcon(appIcon);
MainWindow mainWin;
app.processEvents();
splash->finish(&mainWin);
delete splash;
mainWin.show();
app.processEvents();
mainWin.slotReconnect();
mainWin.slotTimeOut();
mainWin.mythread.start(QThread::HighestPriority);
return app.exec();
}
示例8: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(icons);
QApplication a(argc, argv);
// 系统图标
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
QMessageBox::critical(0, QObject::tr("Systray"),
QObject::tr("I couldn't detect any system tray "
"on this system."));
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
QApplication::addLibraryPath("./plugins");
QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
bool isrunning = CheckIfRunning("lz_master_gui.exe", false);
if (isrunning)
{
return 1;
}
isrunning = CheckIfRunning("lz_master_monitor.exe", true);
if (isrunning)
{
return 1;
}
QSplashScreen *splash = new QSplashScreen();
splash->setPixmap(QPixmap(":/image/start.png"));
QTimer::singleShot(3000, splash, SLOT(close()));
splash->show();
Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->showMessage(QObject::tr("正在初始化..."),topRight,Qt::yellow);
// 加载本地文件存储目录
QFile file("master_datastore_path.txt");
if (!file.open(QIODevice::ReadOnly))
{
qDebug() << QObject::tr("无文件master_datastore_path.txt,无法加载主控机数据存储目录位置");
return 1;
}
else
{
QString parentpath = file.readLine().trimmed();
MasterSetting::getSettingInstance()->setParentPath(parentpath);
file.close();
}
// 【标记2】此处作废-因为MasterProgram类的run函数作废
// 【注意】顺序:先有masterProgramInstance,才run,能连接信号槽
//MasterProgram::getMasterProgramInstance()->run();
/*******************************/
MainWidget *w = new MainWidget(true, Collecting);
w->show();
// 【注意】顺序:先有masterProgramInstance,才能连接信号槽
MasterProgram::getMasterProgramInstance();
// connect函数必在MasterProgram::getMasterProgramInstance()之后
MasterProgram::getMasterProgramInstance()->init();
splash->showMessage(QObject::tr("正在启动程序..."),topRight,Qt::yellow);
splash->finish(w);
delete splash;
return a.exec();
}
开发者ID:fanxiang090909,项目名称:Railway-Tunnel-Construction-Dlearance-Measure-LanZhou,代码行数:73,代码来源:main.cpp
示例9: load
void LiteApp::load(bool bUseSession)
{
QSplashScreen *splash = 0;
bool bSplash = m_settings->value(LITEAPP_SPLASHVISIBLE,true).toBool();
if (bSplash) {
splash = new QSplashScreen(QPixmap::fromImage(makeSplashImage(this)),Qt::WindowStaysOnTopHint);
}
if (bSplash) {
splash->show();
}
if (bSplash) {
splash->showMessage("liteide scan plugins ...",Qt::AlignLeft|Qt::AlignBottom);
}
qApp->processEvents();
loadMimeType();
loadPlugins();
if (bSplash) {
splash->showMessage("liteide load plugins ...",Qt::AlignLeft|Qt::AlignBottom);
}
qApp->processEvents();
initPlugins();
if (bSplash) {
splash->showMessage("liteide load state ...",Qt::AlignLeft|Qt::AlignBottom);
}
qApp->processEvents();
loadState();
m_mainwindow->show();
emit loaded();
m_projectManager->setCurrentProject(0);
if (bSplash) {
splash->showMessage("liteide load session ...",Qt::AlignLeft|Qt::AlignBottom);
}
qApp->processEvents();
appendLog("LiteApp","loaded");
bool b = m_settings->value(LITEAPP_AUTOLOADLASTSESSION,true).toBool();
if (b && bUseSession) {
loadSession("default");
}
if (bSplash) {
m_mainwindow->raise();
splash->finish(m_mainwindow);
splash->deleteLater();
}
this->appendLog("HtmlWidgetFactory",m_htmlWidgetManager->classNameList().join(" "));
this->appendLog("DefaultHtmlWidgetFactory",m_htmlWidgetManager->defaultClassName());
m_goProxy->call("version");
m_goProxy->call("cmdlist");
}
示例10: main
int main(int argc, char *argv[])
{
int dummy = errno;
QApplication a(argc, argv);
Debug::init(0);
#ifdef WIN32
QFont font;
font.setPointSize(10);
font.setFamily(("΢ÈíÑźÚ"));
font.setBold(false);
a.setFont(font);
#else
QFont font;
font.setPointSize(10);
font.setFamily(("WenQuanYi Zen Hei"));
font.setBold(false);
a.setFont(font);
#endif
QPixmap pixmap(":/logo/resources/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->setStyleSheet(QStringLiteral("color : white;"));
splash->show();
gFactory = new Factory;
if (gFactory->Init() == FALSE)
{
#ifdef WIN32
astring strPath = "C:\\";//TODO get the hdd from hdd
VSCHddDevice hdd;
hdd.show();
hdd.exec();
s32 size = hdd.GetDiskSize();
hdd.GetDiskPath(strPath);
#else
astring strPath = "ve/";//TODO get the hdd from hdd
s32 size = 2;
#endif
gFactory->SetSystemPath(strPath);
//splash->showMessage(QObject::tr("Create Video Database ..."));
gFactory->Init();
}
VSCLangType m_lang;
gFactory->GetLang(m_lang);
if (m_lang == VSC_LANG_AUTO)
{
if (QLocale::system().name() == "zh_CN")
{
LoadLangZH(a);
}
}
else if (m_lang == VSC_LANG_ZH)
{
LoadLangZH(a);
}//else if add more language to here
splash->showMessage(QObject::tr("Starting ..."));
VEvent::Init(*gFactory);
VEMap::Init(*gFactory);
VServiceMgr *pServiceMgr = VServiceMgr::CreateObject(*gFactory);
VSCMainWindows w;
//w.showMaximized();
w.hide();
//w.showFullScreen();
splash->finish(&w);
/* Auto */
if (gFactory->GetAutoLogin() == FALSE)
{
w.ShowLogin();
}else
{
w.showMaximized();
}
delete splash;
/* Every thread is ready, start the factory thread */
gFactory->start();
/* Init Mining framework */
gMFramework = new MFramework(*gFactory);
gMFramework->Init();
gMFramework->start();
/* Start the OpenCVR api server */
gOAPIServer = new OAPIServer(*gFactory);
gOAPIServer->start();
return a.exec();
}
示例11: main
int main( int argc, char *argv[] )
{
QApplication::setColorSpec( QApplication::ManyColor );
DesignerApplication a( argc, argv );
DesignerApplication::setOverrideCursor( Qt::WaitCursor );
bool creatPid = FALSE;
if ( a.argc() > 1 ) {
QString arg1 = a.argv()[ 1 ];
if ( arg1 == "-client" ) {
QFile pf( QDir::homeDirPath() + "/.designerpid" );
if ( pf.exists() && pf.open( IO_ReadOnly ) ) {
QString pidStr;
pf.readLine( pidStr, pf.size() );
QFile f( QDir::homeDirPath() + "/.designerargs" );
f.open( IO_WriteOnly );
QTextStream ts( &f );
for ( int i = 1; i < a.argc(); ++i )
ts << a.argv()[ i ] << " ";
ts << endl;
f.close();
#if defined(Q_OS_UNIX)
if ( kill( pidStr.toInt(), SIGUSR1 ) == -1 )
creatPid = TRUE;
else
return 0;
#elif defined(Q_OS_WIN32)
if ( !GetProcessVersion( pidStr.toUInt() ) ) {
creatPid = TRUE;
} else {
if ( a.winVersion() & Qt::WV_NT_based )
SendMessage( HWND_BROADCAST, RegisterWindowMessage((TCHAR*)"QT_DESIGNER_OPEN_FILE"), 0, 0 );
else
SendMessage( HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0 );
return 0;
}
#endif
} else {
creatPid = TRUE;
}
} else if(arg1 == "-debug_stderr") {
extern bool debugToStderr; //outputwindow.cpp
debugToStderr = TRUE;
}
}
if ( creatPid ) {
QFile pf( QDir::homeDirPath() + "/.designerpid" );
pf.open( IO_WriteOnly );
QTextStream ts( &pf );
#if defined(Q_OS_UNIX)
signal( SIGUSR1, signalHandler );
#endif
ts << getpid() << endl;
pf.close();
signal( SIGABRT, exitHandler );
signal( SIGFPE, exitHandler );
signal( SIGILL, exitHandler );
signal( SIGINT, exitHandler );
signal( SIGSEGV, exitHandler );
signal( SIGTERM, exitHandler );
}
extern void qInitImages_designercore();
qInitImages_designercore();
QSettings config;
QString keybase = DesignerApplication::settingsKey();
config.insertSearchPath( QSettings::Windows, "/Trolltech" );
QStringList pluginPaths = config.readListEntry( keybase + "PluginPaths" );
if (pluginPaths.count())
QApplication::setLibraryPaths(pluginPaths);
QSplashScreen *splash = a.showSplash();
MainWindow *mw = new MainWindow( creatPid );
a.setMainWidget( mw );
#if defined(QT_NON_COMMERCIAL)
mw->setCaption( "Qt Designer by Trolltech for non-commercial use" );
#else
mw->setCaption( "Qt Designer by Trolltech" );
#endif
if ( config.readBoolEntry( keybase + "Geometries/MainwindowMaximized", FALSE ) ) {
int x = config.readNumEntry( keybase + "Geometries/MainwindowX", 0 );
int y = config.readNumEntry( keybase + "Geometries/MainwindowY", 0 );
mw->move( x, y );
mw->showMaximized();
} else {
mw->show();
}
if ( splash )
splash->finish( mw );
delete splash;
QApplication::restoreOverrideCursor();
for ( int i = 1; i < a.argc(); ++i ) {
QString arg = a.argv()[ i ];
//.........这里部分代码省略.........
示例12: prevSettings
//.........这里部分代码省略.........
splash->showMessage(tr(" Загрузка системы: ") + QString::number(i) + "%", Qt::AlignLeft | Qt::AlignBottom , Qt::black);
QCoreApplication::processEvents();
}
QSqlQuery * empNameQuery = new QSqlQuery(dal_main->db);
empNameQuery->prepare("SELECT st_fio, st_photo FROM is_sotrudniki where id_sotr = " + QString::number(dal_main->getCurrentEmployee()));
empNameQuery->exec();
empNameQuery->first();
if(empNameQuery->isValid())
this->setWindowTitle("SMT v. 1.0 (текущий пользователь - " + empNameQuery->value(0).toString() + ")");
checkNaznPoruch = new QSqlQuery(dal_main->db);
checkNaznPoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where checkPoruch = 0 and poruchitel = " + QString::number(dal_main->getCurrentEmployee()));
checkIspolPoruch = new QSqlQuery(dal_main->db);
checkIspolPoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where checkIspoln = 0 and ispolnitel = " + QString::number(dal_main->getCurrentEmployee()));
checker = new QTimer;
// checkDatePoruch = new QSqlQuery(dal_main->db);
// checkDatePoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where check_date and checkIspoln = 1 and ispolnitel = " + QString::number(dal_main->getCurrentEmployee()));
connect(checker,SIGNAL(timeout()),this,SLOT(on_check()));
checker->setInterval(10000);
checker->start();
icon = new QSystemTrayIcon(this);
icon->setIcon(QIcon(":/img/img/institution_icon.png"));
icon->show();
//icon->setContextMenu(ui->menu_file);
connect(icon,SIGNAL(messageClicked()),this,SLOT(on_actionChecks())); //Open form Request
ui->pushButton_show->setVisible(false);
ui->pushButton_show->setFlat(true);
ui->pushButton_hide->setFlat(true);
ui->groupBox_main->setContentsMargins(0,0,0,0);
ui->mdiArea->setVisible(false);
QGraphicsDropShadowEffect * ef1 = new QGraphicsDropShadowEffect;
ef1->setBlurRadius(15);
QGraphicsDropShadowEffect * ef2 = new QGraphicsDropShadowEffect;
ef2->setBlurRadius(15);
QGraphicsDropShadowEffect * ef3 = new QGraphicsDropShadowEffect;
ef3->setBlurRadius(15);
QGraphicsDropShadowEffect * ef4 = new QGraphicsDropShadowEffect;
ef4->setBlurRadius(15);
QGraphicsDropShadowEffect * ef5 = new QGraphicsDropShadowEffect;
ef5->setBlurRadius(15);
QGraphicsDropShadowEffect * ef6 = new QGraphicsDropShadowEffect;
ef6->setBlurRadius(15);
QGraphicsDropShadowEffect * ef7 = new QGraphicsDropShadowEffect;
ef7->setBlurRadius(15);
QGraphicsDropShadowEffect * ef8 = new QGraphicsDropShadowEffect;
ef8->setBlurRadius(15);
QGraphicsDropShadowEffect * ef9 = new QGraphicsDropShadowEffect;
ef9->setBlurRadius(15);
ui->pushButton1->setGraphicsEffect(ef1);
ui->pushButton2->setGraphicsEffect(ef2);
ui->pushButton3->setGraphicsEffect(ef3);
ui->pushButton4->setGraphicsEffect(ef4);
ui->pushButton5->setGraphicsEffect(ef5);
ui->pushButton6->setGraphicsEffect(ef6);
ui->pushButton7->setGraphicsEffect(ef7);
ui->pushButton8->setGraphicsEffect(ef8);
ui->pushButton9->setGraphicsEffect(ef9);
// this->setCentralWidget(ui->mdiArea);
// Настраиваем виджет перекрытия
QLightBoxWidget* lightBox = new QLightBoxWidget(this);
QLabel* lbTitle = new QLabel(empNameQuery->value(0).toString());
lbTitle->setStyleSheet("font-size: 28px; font-weight: bold; color: white");
QLabel* lbProgress = new QLabel;
QMovie* progressMovie = new QMovie(empNameQuery->value(1).toString());
progressMovie->setScaledSize(QSize(250,200));
lbProgress->setMovie(progressMovie);
progressMovie->start();
QLabel* lbDescription = new QLabel(tr("Для входа в систему нажмите Войти"));
lbDescription->setStyleSheet("color: white");
QPushButton* lbClose = new QPushButton(tr("Войти"));
QGridLayout* lbLayout = new QGridLayout;
lbLayout->setRowStretch(0, 1);
lbLayout->setColumnStretch(0, 1);
lbLayout->addWidget(lbTitle, 1, 1);
lbLayout->addWidget(lbProgress, 1, 2, Qt::AlignRight);
lbLayout->setColumnStretch(3, 1);
lbLayout->addWidget(lbDescription, 2, 1, 1, 2);
lbLayout->addWidget(lbClose, 3, 2);
lbLayout->setRowStretch(4, 1);
connect(ui->action_Oteshel, SIGNAL(triggered()), lightBox, SLOT(show()));
connect(lbClose, SIGNAL(clicked()), lightBox, SLOT(hide()));
lightBox->setLayout(lbLayout);
// ui->menuBar->setVisible(false);
ui->mainToolBar->setVisible(false);
ui->groupBox->setVisible(false);
splash->finish(this);
/*QGridLayout *userl = new QGridLayout(ui->userWidget);
ui->userWidget->setLayout(userl);
QLabel* lbProgress1 = new QLabel;
QMovie* progressMovie1 = new QMovie(empNameQuery->value(1).toString());
progressMovie1->setScaledSize(QSize(250,200));
lbProgress1->setMovie(progressMovie1);
progressMovie1->start();
userl->addWidget(lbProgress1);*/
}
示例13: finish
void finish(QWidget *w) override { splash.finish(w); }
示例14: main
//.........这里部分代码省略.........
conf = new Cconfigurator();
conf->loadConfig(resPath, configfile);
print_debug(DEBUG_SYSTEM, "starting up...");
if (override_base_file[0] != 0) {
conf->setBaseFile(override_base_file);
} else if ( conf->getBaseFile() == "") {
conf->setBaseFile(default_base_file);
}
print_debug(DEBUG_SYSTEM, "Using database file : %s.", (const char*) conf->getBaseFile() );
if (override_remote_host[0] != 0) {
conf->setRemoteHost(override_remote_host);
} else if ( conf->getRemoteHost().isEmpty() ) {
conf->setRemoteHost(default_remote_host);
}
print_debug(DEBUG_SYSTEM, "Using target hostname : %s.", (const char*) conf->getRemoteHost() );
if (override_local_port != 0) {
conf->setLocalPort(override_local_port);
} else if ( conf->getLocalPort() == 0) {
conf->setLocalPort(default_local_port);
}
print_debug(DEBUG_SYSTEM, "Using local port : %i.", conf->getLocalPort());
if (override_remote_port != 0) {
conf->setRemotePort(override_remote_port);
} else if (conf->getRemotePort() == 0) {
conf->setRemotePort(default_remote_port);
}
print_debug(DEBUG_SYSTEM, "Using target port : %i.", conf->getRemotePort());
conf->setConfigModified( false );
splash->showMessage("Starting Analyzer and Proxy...");
engine = new CEngine(new CRoomManager());
proxy = new Proxy();
/* special init for the mud emulation */
if (mud_emulation) {
print_debug(DEBUG_SYSTEM, "Starting in MUD emulation mode...");
engine->initEmulationMode();
}
proxy->setMudEmulation( mud_emulation );
print_debug(DEBUG_SYSTEM, "Starting renderer ...\n");
if ( !QGLFormat::hasOpenGL() ) {
qWarning( "This system has no OpenGL support. Quiting." );
return -1;
}
QRect rect = app.desktop()->availableGeometry(-1);
if (conf->getWindowRect().x() == 0 || conf->getWindowRect().x() >= rect.width() ||
conf->getWindowRect().y() >= rect.height() ) {
print_debug(DEBUG_SYSTEM && DEBUG_INTERFACE, "Autosettings for window size and position");
int x, y, height, width;
x = rect.width() / 3 * 2;
y = 0;
height = rect.height() / 3;
width = rect.width() - x;
conf->setWindowRect( x, y, width, height);
}
QGLFormat f = QGLFormat::defaultFormat();
f.setDoubleBuffer( true );
f.setDirectRendering( true );
f.setRgba( true );
f.setDepth( true );
f.setAlpha( true );
if (conf->getMultisampling())
f.setSampleBuffers( true );
//f.setSamples(4);
QGLFormat::setDefaultFormat( f );
renderer_window = new CMainWindow;
renderer_window->show();
splash->finish(renderer_window);
delete splash;
proxy->start();
QObject::connect(proxy, SIGNAL(startEngine()), engine, SLOT(slotRunEngine()), Qt::QueuedConnection );
QObject::connect(proxy, SIGNAL(startRenderer()), renderer_window->renderer, SLOT(display()), Qt::QueuedConnection);
// this will be done via mainwindow itself
//userland_parser->parse_user_input_line("mload");
return app.exec();
}
示例15: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
int currentExitCode = 0;
QScopedPointer<QSymbianApplication> app(new QSymbianApplication(argc, argv));
// Set App Info:
app->setApplicationName("Battery Status");
app->setOrganizationName("Motaz Alnuweiri");
app->setApplicationVersion(APP_Version);
// QT_DEBUG or QT_NO_DEBUG
// #ifdef QT_DEBUG
// // Install Debug Msgs Handler:
// ClearDebugFile();
// qInstallMsgHandler(DebugFileHandler);
// #endif
// Install EventFilter in QApplication:
//app->installEventFilter(new myEventFilter);
// Set App Splash Screen:
QSplashScreen *splash = new QSplashScreen(QPixmap(":qml/Images/JPG/Splash_Screen.jpg"),
Qt::WindowStaysOnTopHint);
splash->show();
// Check System Language & Load App Translator:
QString systemLang = QLocale::system().name();
QTranslator appTranslator;
systemLang.truncate(2); //truncate(2) to ignore the country code
if (QFile::exists("Languages/batterystatus_" + systemLang + ".qm")) {
appTranslator.load("batterystatus_" + systemLang, "Languages");
} else {
appTranslator.load("batterystatus_en", "Languages");
}
// Install QTranslator to QApplication:
app->installTranslator(&appTranslator);
// Hide The App If Deactive:
if (!app->foreground())
QSymbianHelper::hideInBackground();
// Register QSettings:
QAppSettings appSettings;
// Register QmlApplicationViewer:
QmlApplicationViewer *viewer = new QmlApplicationViewer();
//viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView);
//viewer.setAutoFillBackground(false);
//viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
// Register App HSWidget:
QBatteryHSWidget *batteryHSWidget = new QBatteryHSWidget();
batteryHSWidget->setBackgroundOpacity(appSettings.getWidgetOpacity());
// Register QDeviceName:
QDeviceName deviceName;
// Register Class to QML:
qmlRegisterType<QPSMode>("PSMode", 1, 0, "PSMode");
qmlRegisterType<QGlobalNote>("GlobalNote", 1, 0, "GlobalNote");
qmlRegisterType<QCBatteryInfo>("CBatteryInfo", 1, 0, "CBatteryInfo");
qmlRegisterType<CommonType>("CommonType", 1, 0, "CommonType");
// Set Propertys to QML:
viewer->rootContext()->setContextProperty("APPName", QObject::tr("Battery Status"));
viewer->rootContext()->setContextProperty("APPVersion", app->applicationVersion());
viewer->rootContext()->setContextProperty("AppPath", app->applicationDirPath());
viewer->rootContext()->setContextProperty("SymbianHelper", new QSymbianHelper);
viewer->rootContext()->setContextProperty("AppSettings", &appSettings);
viewer->rootContext()->setContextProperty("HSWidget", batteryHSWidget);
viewer->rootContext()->setContextProperty("DeviceName", &deviceName);
viewer->rootContext()->setContextProperty("QApp", app->instance());
viewer->setSource(QUrl(QLatin1String("qrc:qml/main.qml")));
//viewer.setSource(QUrl::fromLocalFile("qrc:qml/main.qml"));
// Lock screen orientation in portrait only
//viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
//viewer.setGeometry(app->desktop()->screenGeometry());
viewer->showFullScreen();
// Stop Splash Screen & Delete It:
splash->finish(viewer);
splash->deleteLater();
//viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
// Enter App Event Loop:
currentExitCode = app->exec();
// Cleun Pointers:
delete viewer;
delete batteryHSWidget;
// Check If App Is Restarting:
//.........这里部分代码省略.........