本文整理汇总了C++中QmlDocument::hasErrors方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlDocument::hasErrors方法的具体用法?C++ QmlDocument::hasErrors怎么用?C++ QmlDocument::hasErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QmlDocument
的用法示例。
在下文中一共展示了QmlDocument::hasErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTranslator
StarshipSettingsApp::StarshipSettingsApp()
{
// Set the application organization and name, which is used by QSettings
// when saving values to the persistent store.
QCoreApplication::setOrganizationName("Example");
QCoreApplication::setApplicationName("Starship Settings");
// Localization: Make the initial call to set up the initial application language and
// connect to the LocaleHandlers systemLanguaged change signal, this will
// tell the application when it is time to load a new set of language strings.
mTranslator = new QTranslator(this);
mLocaleHandler = new LocaleHandler(this);
onSystemLanguageChanged();
bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged()));
Q_ASSERT(connectResult);
Q_UNUSED(connectResult);
// Then we load the application.
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
qml->setContextProperty("_starshipApp", this);
if (!qml->hasErrors()) {
AbstractPane *appPane = qml->createRootObject<AbstractPane>();
if (appPane) {
Application::instance()->setScene(appPane);
}
}
}
示例2: createCitiesPage
void WeatherGuesserApp::createCitiesPage()
{
QmlDocument *qml = QmlDocument::create().load("ContinentCitiesPage.qml");
if (!qml->hasErrors()) {
mContinentCitiesPage = qml->createRootNode<Page>();
if (mContinentCitiesPage) {
// Set up a cities model for the page, this model will load different cities depending
// on which continent is selected.
ListView *citiesList = mContinentCitiesPage->findChild<ListView*>("citiesList");
CityModel *cityModel = new CityModel(QStringList() << "name", "continents_connection",
this);
citiesList->setDataModel(cityModel);
// Connect to the continents page custom signal.
Page *continents = mNavigation->findChild<Page*>("continents");
connect(continents, SIGNAL(showContinentCities(QString)), cityModel,
SLOT(onChangeContinent(QString)));
qml->documentContext()->setContextProperty("_navigation", mNavigation);
}
}
}
示例3:
BucketListApp::BucketListApp()
{
// Set the application organization and name, which is used by QSettings
// when saving values to the persistent store.
QCoreApplication::setOrganizationName("Example");
QCoreApplication::setApplicationName("Bucket List Settings");
// The model for populating the bucket list is registered, so that it and all its
// properties can be accessed directly from QML. This is done before creating the
// QmlDocument below so that it is available when the corresponding QML component
// is needed (see main.qml).
qmlRegisterType<BucketModel>("com.bucketlist.bucketdata", 1, 0, "BucketModel");
// The application settings object used to store the BBM connection state
qmlRegisterType<BucketSettings>("com.bucketlist.bucketdata", 1, 0, "BucketSettings");
// The BBM manager that can connect the application to BBM and update the BBM status message
qmlRegisterType<BucketBBMManager>("com.bucketlist.bucketbbm", 1, 0, "BucketBBMManager");
// Create a QMLDocument and load it, using build patterns.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
if (!qml->hasErrors()) {
AbstractPane *appPage = qml->createRootObject<AbstractPane>();
if (appPage) {
// Set the main scene to the application Page.
Application::instance()->setScene(appPage);
}
}
}
示例4: QTranslator
WeatherGuesserApp::WeatherGuesserApp()
{
// Register QML types, so they can be used in QML.
qmlRegisterType<SqlHeaderDataQueryEx>("bb.cascades.datamanager", 1, 2, "SqlHeaderDataQueryEx");
qmlRegisterType<PullToRefresh>("com.weather", 1, 0, "PullToRefresh");
qmlRegisterType<CityDataSource>("com.weather", 1, 0, "CityDataSource");
qmlRegisterType<LoadModelDecorator>("com.weather", 1, 0, "LoadModelDecorator");
qmlRegisterType<WeatherDataSource>("com.weather", 1, 0, "WeatherDataSource");
qmlRegisterUncreatableType<WeatherError>("com.weather", 1, 0, "WeatherError", "Uncreatable type");
// Prepare localization. Connect to the LocaleHandlers systemLanguaged change signal, this will
// tell the application when it is time to load a new set of language strings.
mTranslator = new QTranslator(this);
mLocaleHandler = new LocaleHandler(this);
onSystemLanguageChanged();
bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged()));
Q_ASSERT(connectResult);
Q_UNUSED(connectResult);
// Create a QMLDocument and load it, using build patterns.
QmlDocument *qmlDocument = QmlDocument::create("asset:///main.qml").parent(this);
if (!qmlDocument->hasErrors()) {
// Make the settings object available to QML
qmlDocument->setContextProperty("_appSettings", new AppSettings(this));
// The application navigationPane is created from QML.
AbstractPane *appPane = qmlDocument->createRootObject<AbstractPane>();
if (appPane) {
// Set the main application scene to NavigationPane.
Application::instance()->setScene(appPane);
}
}
}
示例5: start
HelloForeignWindowApp::HelloForeignWindowApp()
{
mTvOn = false;
mTvInitialized = false;
// Here we create a QMLDocument and load the main UI QML file.
QmlDocument *qml = QmlDocument::create().load("helloforeignwindow.qml");
if (!qml->hasErrors()) {
// Set a context property for the QML to the application object, so that we
// can call invokable functions in the app from QML.
qml->setContextProperty("foreignWindowApp", this);
// The application Page is created from QML.
mAppPage = qml->createRootNode<Page>();
if (mAppPage) {
Application::setScene(mAppPage);
// Start the thread in which we render to the custom window.
start();
}
}
}
示例6: createWeatherPage
void WeatherGuesserApp::createWeatherPage()
{
QmlDocument *qml = QmlDocument::create().load("WeatherPage.qml");
if (!qml->hasErrors()) {
mWeatherPage = qml->createRootNode<Page>();
if (mWeatherPage) {
// Set up a weather model the list, the model will load weather data
ListView *weatherList = mWeatherPage->findChild<ListView*>("weatherList");
WeatherModel *weatherModel = new WeatherModel(this);
weatherList->setDataModel(weatherModel);
// Connect the weather model to page signals that updates city for which model should be shown.
connect(mContinentCitiesPage, SIGNAL(showWeather(QString)), weatherModel,
SLOT(onUpdateWeatherCity(QString)));
Page *favorites = mNavigation->findChild<Page*>("favorites");
connect(favorites, SIGNAL(showWeather(QString)), weatherModel,
SLOT(onUpdateWeatherCity(QString)));
qml->documentContext()->setContextProperty("_navigation", mNavigation);
}
}
}
示例7:
millionSec::millionSec()
{
// Obtain a QMLDocument and load it into the qml variable, using build patterns.
QmlDocument *qml = QmlDocument::create("asset:///second.qml");
qml->setParent(this);
NavigationPane *nav = qml->createRootObject<NavigationPane>();
// If the QML document is valid, we process it.
if (!qml->hasErrors()) {
// Create the application Page from QMLDocument.
//Page *appPage = qml->createRootObject<Page>();
if (nav) {
// Set the main scene for the application to the Page.
Application::instance()->setScene(nav);
DropDown *day = DropDown::create();
int date = day->selectedIndex();
DropDown *month = DropDown::create();
month->add(Option::create().text("Jan"));
month->add(Option::create().text("Feb"));
}
}
}
示例8: SIGNAL
PhotoBomberApp::PhotoBomberApp()
{
// We need to register the QML types in the multimedia-library,
// otherwise we will get an error from the QML.
qmlRegisterType < Camera > ("bb.cascades.multimedia", 1, 0, "Camera");
// Create a QMLDocument and load it, using build patterns
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
qml->setContextProperty("photoBomber", this);
if (!qml->hasErrors()) {
// The application Page is created from QML.
Page *appPage = qml->createRootObject<Page>();
if (appPage) {
// Set the application scene and connect the camera's shutterFired signal to our slot function
Application::instance()->setScene(appPage);
Camera *camera = appPage->findChild<Camera*>("myCamera");
QObject::connect(camera, SIGNAL(shutterFired()), this, SLOT(onShutterFired()));
camera->open(CameraUnit::Front);
}
}
}
示例9: initForeignWindow
HelloForeignWindowApp::HelloForeignWindowApp()
{
mTvOn = false;
mTvInitialized = false;
// Create a QML document and load the main UI QML file, using build patterns.
QmlDocument *qml = QmlDocument::create("asset:///helloforeignwindow.qml");
if (!qml->hasErrors()) {
// Set the context property we want to use from inside the QML document. Functions exposed
// via Q_INVOKABLE will be found with this property and the name of the function.
qml->setContextProperty("foreignWindowApp", this);
// The application Page is created from QML.
mAppPage = qml->createRootObject<Page>();
if (mAppPage) {
Application::instance()->setScene(mAppPage);
// Initialize the foreign window.
initForeignWindow();
// Start the thread in which we render to the custom window.
start();
}
}
}
示例10: QObject
StarshipSettingsApp::StarshipSettingsApp(QObject *parent) : QObject(parent)
{
// Localization: Make the initial call to set up the initial application language and
// connect to the LocaleHandlers systemLanguaged change signal, this will
// tell the application when it is time to load a new set of language strings.
mTranslator = new QTranslator(this);
mLocaleHandler = new LocaleHandler(this);
onSystemLanguageChanged();
bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged()));
Q_ASSERT(connectResult);
Q_UNUSED(connectResult);
// Then we load the application.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
if (!qml->hasErrors()) {
// Make the application settings object available to QML, all application wide
// settings are managed via properties in this object.
qml->setContextProperty("appSettings", new AppSettings(this));
AbstractPane *appPane = qml->createRootObject<AbstractPane>();
if (appPane) {
Application::instance()->setScene(appPane);
}
}
}
示例11: setNumMoves
KakelApp::KakelApp()
{
// Create and Load the QMLDocument, using build patterns.
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
if (!qml->hasErrors()) {
setNumMoves(0);
mNumTiles = 4;
// Set the context property we want to use from inside the QML file. Functions exposed
// via Q_INVOKABLE will be found with the property and the name of the function.
qml->setContextProperty("kakel", this);
// The application Page is created from the QML file.
mAppPage = qml->createRootObject<Page>();
findPlayAreaAndInitialize(mAppPage);
if (mAppPage) {
// Finally the main scene for the application is set to the Page.
Application::instance()->setScene(mAppPage);
}
}
}
示例12: loadQMLScene
bool QuotesApp::loadQMLScene()
{
// Here we create a QML object and load it, we are using build patterns.
QmlDocument *qmlDocument = QmlDocument::create().load("main.qml");
if (!qmlDocument->hasErrors()) {
// In order to call invokable function in this object it is set as a context property.
qmlDocument->setContextProperty("_quoteApp", this);
// The root Container is created from QML.
mNav = qmlDocument->createRootNode<NavigationPane>();
if (mNav) {
// The list containing a bunch of people that have expressed clever things
// when it comes to programming is set up.
mListView = setUpQuotesList();
// Load the document for the Quotes page where content will be presented.
QmlDocument *contentQML = QmlDocument::create().load("QuotePage/QuotePage.qml");
if (!contentQML->hasErrors()) {
// Get the document context, it is used to bind a property for the ContentPane.
// and make the navigation pane and application available for QML.
mQmlContext = contentQML->documentContext();
mQmlContext->setContextProperty("_navPane", mNav);
mQmlContext->setContextProperty("_quoteApp", this);
// Initialization of the bound context properties of the content to empty strings.
clearContentPaneData();
mContentPage = contentQML->createRootNode<Page>();
// Finally the main scene for the application is set to this Control.
Application::setScene(mNav);
return true;
}
}
}
return false;
}
示例13: ChannelCreate
RetroArch::RetroArch()
{
qmlRegisterType<bb::cascades::pickers::FilePicker>("bb.cascades.pickers", 1, 0, "FilePicker");
qmlRegisterUncreatableType<bb::cascades::pickers::FileType>("bb.cascades.pickers", 1, 0, "FileType", "");
// Create channel to signal threads on
chid = ChannelCreate(0);
coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0);
bool res = connect(
OrientationSupport::instance(), SIGNAL(rotationCompleted()),
this, SLOT(onRotationCompleted()));
rarch_main_clear_state();
strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path));
config_load();
strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro));
coreSelectedIndex = -1;
//Stop config overwritting values
g_extern.block_config_read = true;
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
if (!qml->hasErrors())
{
qml->setContextProperty("RetroArch", this);
AbstractPane *mAppPane = qml->createRootObject<AbstractPane>();
if (mAppPane)
{
//Get core DropDown reference to populate it in C++
coreSelection = mAppPane->findChild<DropDown*>("dropdown_core");
connect(coreSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onCoreSelected(QVariant)));
findCores();
Application::instance()->setScene(mAppPane);
screen_create_context(&screen_ctx, 0);
input_qnx.init();
buttonMap = new ButtonMap(screen_ctx, (const char*)Application::instance()->mainWindow()->groupId().toAscii().constData(), coid);
deviceSelection = mAppPane->findChild<DropDown*>("dropdown_devices");
connect(deviceSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onDeviceSelected(QVariant)));
findDevices();
//Setup the datamodel for button mapping.
mAppPane->findChild<ListView*>("buttonMapList")->setDataModel(buttonMap->buttonDataModel);
// Start the thread in which we render to the custom window.
start();
}
}
}
示例14: QObject
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
QObject(app)
{
// prepare the localization
m_pTranslator = new QTranslator(this);
m_pLocaleHandler = new LocaleHandler(this);
bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
// This is only available in Debug builds
Q_ASSERT(res);
// Since the variable is not used in the app, this is added to avoid a
// compiler warning
Q_UNUSED(res);
// initial load
onSystemLanguageChanged();
// Create scene document from main.qml asset, the parent is set
// to ensure the document gets destroyed properly at shut down.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("_app", this);
// Create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// Set created root object as the application scene
app->setScene(root);
// This is what was added as Active Frame initial setup
QmlDocument *qmlCover = QmlDocument::create("asset:///cover/AppCover.qml").parent(this);
if (!qmlCover->hasErrors()) {
// Create the QML Container from using the QMLDocument.
Container *coverContainer = qmlCover->createRootObject<Container>();
// Create a SceneCover and set the application cover
SceneCover *sceneCover = SceneCover::create().content(coverContainer);
Application::instance()->setCover(sceneCover);
m_coverLabel = sceneCover->findChild<Label*>("m_coverLabel");
}
// *************
// Initiate this variable
iterator = 0;
// Sets a 2 second timer
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimerForActiveFrame()));
timer->start(2000);
// Call the Active Frame updater function right away
onTimerForActiveFrame();
}
示例15: addApplicationCover
void RundGangApp::addApplicationCover() {
// Create the Application Cover document from its QML file.
QmlDocument *qmlCover = QmlDocument::create("asset:///Common/AppCover.qml").parent(this);
if (!qmlCover->hasErrors()) {
// Create the QML Container from using the QMLDocument.
Container *coverContainer = qmlCover->createRootObject<Container>();
// Create a SceneCover and set the application cover
SceneCover *sceneCover = SceneCover::create().content(coverContainer);
Application::instance()->setCover(sceneCover);
}
}