本文整理汇总了C++中Q_INIT_RESOURCE函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_INIT_RESOURCE函数的具体用法?C++ Q_INIT_RESOURCE怎么用?C++ Q_INIT_RESOURCE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_INIT_RESOURCE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(ctSESAM);
QApplication a(argc, argv);
QTranslator translator;
bool ok = translator.load(":/translations/i18n_" + QLocale::system().name());
#ifndef QT_NO_DEBUG
if (!ok)
qWarning() << "Could not load translations for" << QLocale::system().name() << "locale";
#endif
if (ok)
a.installTranslator(&translator);
MainWindow w;
w.activateWindow();
return a.exec();
}
示例2: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(fridgemagnets);
bool smallScreen = false;
for (int i=0; i<argc; i++)
if (QString(argv[i]) == "-small-screen")
smallScreen = true;
QApplication app(argc, argv);
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
DragWidget window;
if (smallScreen)
window.showFullScreen();
else
window.show();
return app.exec();
}
示例3: main
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(portedasteroids);
QApplication app(argc, argv);
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
KAstTopLevel topLevel;
topLevel.setWindowTitle("Ported Asteroids Game");
#if defined(Q_OS_SYMBIAN)
topLevel.showFullScreen();
#else
topLevel.show();
#endif
app.setQuitOnLastWindowClosed(true);
return app.exec();
}
示例4: main
int main(int argc, char * argv[])
{
int ret = 0;
try
{
qInstallMessageHandler(message_handler);
Q_INIT_RESOURCE(scripts);
throw_if(argc != 4, "Недостаточное количество аргументов");
const QString script_fname = argv[1];
const QString src_video_fname = argv[2];
const QString dst_video_fname = argv[3];
// ############################################################################
CDisplay::init();
CMatrix::init();
CImage::init();
CLua lua;
CMainLoop main_loop(lua);
lua.load_module("/home/natalya/Science/super_stend/src/stend_modules/build/demo_image/libdemo_image.so");
lua.load_script(script_fname);
main_loop.start(src_video_fname, dst_video_fname);
main_loop.stats["sec_per_frame"]->display();
main_loop.stats["sec_per_frame"]->save("/home/amv/trash/sec_per_frame");
}
catch(...)
{
ret = -1;
}
CDisplay::destroy();
CMatrix::destroy();
CImage::destroy();
return ret;
}
示例5: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(preload);
QGuiApplication app (argc, argv);
if (app.arguments().count() != 2) {
return 10;
}
QmlModule::registerTypes();
QString source = app.arguments().at(1);
QmlRuntime::Ptr runtime (QmlRuntimeFactory::create());
bool preloaded = runtime->preload(QUrl(QLatin1String("qrc:/preload.qml")));
Q_ASSERT(preloaded);
Q_UNUSED(preloaded);
runtime->execute(QUrl(source));
return app.exec();
}
示例6: main
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(pathstroke);
QApplication app(argc, argv);
bool smallScreen = false;
for (int i=0; i<argc; i++)
if (QString(argv[i]) == "-small-screen")
smallScreen = true;
PathStrokeWidget pathStrokeWidget(smallScreen);
QStyle *arthurStyle = new ArthurStyle();
pathStrokeWidget.setStyle(arthurStyle);
QList<QWidget *> widgets = qFindChildren<QWidget *>(&pathStrokeWidget);
foreach (QWidget *w, widgets) {
w->setStyle(arthurStyle);
w->setAttribute(Qt::WA_AcceptTouchEvents);
}
示例7: main
int main(int argc, char** argv)
{
Q_INIT_RESOURCE(portedcanvas);
QApplication app(argc,argv);
if ( argc > 1 )
butterfly_fn = argv[1];
else
butterfly_fn = ":/trolltech/examples/graphicsview/portedcanvas/butterfly.png";
if ( argc > 2 )
logo_fn = argv[2];
else
logo_fn = ":/trolltech/examples/graphicsview/portedcanvas/qtlogo.png";
QGraphicsScene canvas;
canvas.setSceneRect(0, 0, 800, 600);
Main m(canvas);
m.resize(m.sizeHint());
m.setWindowTitle("Ported Canvas Example");
#if defined(Q_OS_SYMBIAN)
m.showMaximized();
#elif defined(Q_WS_MAEMO_5)
m.show();
#else
if ( QApplication::desktop()->width() > m.width() + 10
&& QApplication::desktop()->height() > m.height() +30 )
m.show();
else
m.showMaximized();
#endif
QTimer timer;
QObject::connect(&timer, SIGNAL(timeout()), &canvas, SLOT(advance()));
timer.start(30);
QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
return app.exec();
}
示例8: main
int main(int argc, char* argv[]) {
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
app.setOrganizationName(SETTING_ORGANIZATION);
app.setApplicationName(SETTING_APPLICATION);
QSettings settings(QSettings::IniFormat, QSettings::UserScope,
SETTING_ORGANIZATION, SETTING_APPLICATION);
//Set the style saved inside the configuration if any
QString style = settings.value("GUI/Style").toString();
if (style.isEmpty()) {
app.setStyle(QStyleFactory::create("Plastique"));
} else {
app.setStyle(QStyleFactory::create(style));
}
//Set the icon theme saved inside the configuration if any
QString iconTheme = settings.value("GUI/IconTheme").toString();
if (!iconTheme.isEmpty()) {
QIcon::setThemeName(iconTheme);
}
static const char * GENERIC_ICON_TO_CHECK = "fileopen";
static const char * FALLBACK_ICON_THEME = "QBE-Faenza";
if (!QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK)) {
//If there is no default working icon theme then we should
//use an icon theme that we provide via a .qrc file
//This case happens under Windows and Mac OS X
//This does not happen under GNOME or KDE
QIcon::setThemeName(FALLBACK_ICON_THEME);
}
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
MainWindow mainWin;
mainWin.show();
for (int i = 1; i < argc; ++i) {
mainWin.addChild(argv[i]);
}
return app.exec();
}
示例9: mousePressEvent
void GameBody :: mousePressEvent(QMouseEvent *event){
Q_INIT_RESOURCE(flowfree_resources);
int inteval = (this->frameSize().height())/(gamesection->size);
qDebug()<<this->frameSize();
if (event->button() == Qt::LeftButton){
cursor = event->pos();
if (last_active_unit!=0)
show_cursor = true;
else
show_cursor = false;
update();
int cursor_j = (event->pos().x())/inteval;
int cursor_i = (event->pos().y())/inteval;
if (cursor_j>=gamesection->size)
cursor_j = gamesection->size - 1;
if (cursor_i>=gamesection->size)
cursor_i = gamesection->size - 1;
if (gamesection->playarea[cursor_i][cursor_j].color == (-1)){
last_active_unit = 0;
}
else{
if (gamesection->if_color_connected(gamesection->playarea[cursor_i][cursor_j].color)){
qDebug()<<"Broken!";
QSound::play(":/sound/sound/broken.wav");
}
last_active_unit = &(gamesection->playarea[cursor_i][cursor_j]);
if (last_active_unit->if_fixed){
gamesection->fixed_point_series[last_active_unit->color][0]->clear_succ();
gamesection->fixed_point_series[last_active_unit->color][1]->clear_succ();
}
else{
int tempcolor = last_active_unit->color;
last_active_unit->clear_succ();
last_active_unit->color = tempcolor;
}
}
}
else{
last_active_unit = 0;
}
}
示例10: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Q_INIT_RESOURCE(QtOME);
MainWindow w;
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/splash"));
Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->show();splash->showMessage(QObject::tr("Setting up the main window..."), topRight, Qt::black);
w.setSplash(splash);
//QObject::connect(w.action_Quit, SIGNAL(triggered()), MainWindow, SLOT(close()));
w.showMaximized();
return a.exec();
}
示例11: Q_INIT_RESOURCE
SDLEvents::SDLEvents() {
// Initialize the GameController database with the most recent file
// from https://github.com/gabomdq/SDL_GameControllerDB
// TODO: Instead of storing the file as a ressource, have it in some
// directory so the user can modify it if needed..
Q_INIT_RESOURCE( assets ); // needed to access resources before app.exec()
QFile f( ":/assets/gamecontrollerdb.txt" );
f.open( QIODevice::ReadOnly );
SDL_SetHint( SDL_HINT_GAMECONTROLLERCONFIG, f.readAll().constData() );
event_list = new SDL_Event[10]();
this->moveToThread( &thread );
polltimer.moveToThread( &thread );
connect( &thread, SIGNAL( started() ), SLOT( threadStarted() ) );
connect( &thread, SIGNAL( finished() ), SLOT( threadFinished() ) );
thread.setObjectName( "phoenix-SDLEvents" );
thread.start( QThread::HighPriority );
}
示例12: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(qt_virt_manager);
QApplication a(argc, argv);
QString name("qt-virt-manager");
a.setOrganizationName(name);
a.setApplicationName(name);
QSettings::setDefaultFormat(QSettings::IniFormat);
QTranslator tr;
QLocale lc = QLocale();
if ( lc.language() == QLocale::Russian ) {
tr.load("qt_virt_manager_ru");
} else if ( lc.language() == QLocale::Italian ) {
tr.load("qt_virt_manager_it");
};
a.installTranslator(&tr);
MainWindow w;
w.show();
return a.exec();
}
示例13: main
int main(int argc, char *argv[])
{
VPlayApplication vplayApplication(argc, argv);
// the default mainQmlFileName is qml/main.qml - if you want to change the entry qml file, change it here before startApplication() is called
vplayApplication.setMainQmlFileName("qml/ParticleEditorMain.qml");
// this can be used if you want to hide the qml files and compile them into the binary with qt's resource system qrc
//vplayApplication.setMainQmlFileName(":/qml/ParticleEditorMain.qml");
// V-Play has 2 renderers:
// * the performance optimized CocosRenderer: this is the default renderer on all platforms and has a better performance than QmlRenderer; its only limitation is that not all QML items are fully supported, and no debug shapes of physics objects are available
// * the QmlRenderer is primarily needed for debugging of physics games on desktops
// vplayApplication.setCocosRendererEnabled(false);
vplayApplication.setQmlRendererEnabled(false);
// this must be called in each game before startApplication() is called, so the import VPlay 1.0 can be resolved
Q_INIT_RESOURCE(resources_vplay);
return vplayApplication.startApplication();
}
示例14: main
int main( int argc, char ** argv )
{
Q_INIT_RESOURCE(qikea);
QApplication a( argc, argv );
// iniitialize our root window
qikeaRoot r;
r.show();
// initialize our ikea config
// and populate our site list
qikea.init( &r );
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}
示例15: main
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(pathstroke);
QApplication app(argc, argv);
#ifdef Q_OS_SYMBIAN
bool smallScreen = true;
#else
bool smallScreen = QApplication::arguments().contains("-small-screen");
#endif
PathStrokeWidget pathStrokeWidget(smallScreen);
QStyle *arthurStyle = new ArthurStyle();
pathStrokeWidget.setStyle(arthurStyle);
QList<QWidget *> widgets = pathStrokeWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets) {
w->setStyle(arthurStyle);
w->setAttribute(Qt::WA_AcceptTouchEvents);
}