// QTBUG-17324
void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin()
{
    QDeclarativeEngine engine;
    engine.addImportPath(importsDirectory());

    {
    QDeclarativeComponent component(&engine, testFileUrl("importsMixedQmlCppPlugin.qml"));

    QObject *o = component.create();
    QVERIFY2(o, msgComponentError(component, &engine).constData());
    QCOMPARE(o->property("test").toBool(), true);
    delete o;
    }

    {
    QDeclarativeComponent component(&engine, testFileUrl("importsMixedQmlCppPlugin.2.qml"));

    QObject *o = component.create();
    QVERIFY(o != 0);
    QCOMPARE(o->property("test").toBool(), true);
    QCOMPARE(o->property("test2").toBool(), true);
    delete o;
    }


}
// QTBUG-17324
void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin()
{
    QDeclarativeEngine engine;
    engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));

    {
    QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.qml"));

    QObject *o = component.create();
    QVERIFY(o != 0);
    QCOMPARE(o->property("test").toBool(), true);
    delete o;
    }

    {
    QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.2.qml"));

    QObject *o = component.create();
    QVERIFY(o != 0);
    QCOMPARE(o->property("test").toBool(), true);
    QCOMPARE(o->property("test2").toBool(), true);
    delete o;
    }


}
예제 #3
0
void TestSimpleQmlLoad::loadAlias2()
{
    QQmlEngine *engine = new QQmlEngine;
    const QString TEST_FILE(":/testqml/testalias2.qml");
    QQmlComponent* component = load(engine, TEST_FILE);
    QVERIFY(component);

    QObject *myObject = component->create();
    QVERIFY(myObject != NULL);
    QVariant v = myObject->property("color");
    QVERIFY(!v.isNull());
    qWarning() << v.toString();
    QVERIFY(v.toString() == "#333333");

    QObject *r1 = myObject->findChild<QObject*>("r1");
    r1->setProperty("color", "#999999");

    v = myObject->property("color");
    QVERIFY(v.toString() == "#999999");

    QObject *r0 = myObject->findChild<QObject*>("r0");
    QVERIFY(r0->property("color").toString() == "#999999");

    delete component;
    delete engine;
}
예제 #4
0
void ProjectOperationHandler::createProject()
{
    QObject* rootObject = m_engine->rootObjects().first();
    QObject* createProjectSlide = rootObject->findChild<QObject*>("createProjectMainIdName");
    m_createProjectForm = rootObject->findChild<QObject*>("createProjectForm");

    createProjectSlide->setProperty("visible", true);
    createProjectSlide->setProperty("y", 56.0f);

    QObject* form = m_createProjectForm->findChild<QObject*>("projectNameInput");
    m_projectName = form->property("text").toString();
    form = m_createProjectForm->findChild<QObject*>("projectLocationInput");
    m_projectLocation = form->property("text").toString();

    form = rootObject->findChild<QObject*>("goDark", Qt::FindChildrenRecursively);
    form->setProperty("running", true);
    form = rootObject->findChild<QObject*>("goOpenDark", Qt::FindChildrenRecursively);
    form->setProperty("running", true);

    form = rootObject->findChild<QObject*>("goDarkMouseArea", Qt::FindChildrenRecursively);
    form->setProperty("enabled", false);
    form = rootObject->findChild<QObject*>("goOpenDarkMouseArea", Qt::FindChildrenRecursively);
    form->setProperty("enabled", false);

}
예제 #5
0
void TestSimpleQmlLoad::compileAndLoadSignal2()
{
    const QString TEST_FILE(":/testqml/testsignal2.qml");

    QQmlEngine *engine = new QQmlEngine;
    QQmlComponent* component = compileAndLoad(engine, TEST_FILE);
    QVERIFY(component);

    SignalTester st;

    engine->rootContext()->setContextProperty("st", &st);

    QObject *myObject = component->create();
    QVERIFY(myObject != NULL);

    QVariant var = myObject->property("sigReceived");
    QVERIFY(!var.isNull());
    QVERIFY(var.toBool() == false);

    st.sendSig();
    var = myObject->property("sigReceived");
    QVERIFY(!var.isNull());
    QVERIFY(var.toBool() == true);

    delete component;
    delete engine;
}
예제 #6
0
void tst_QQuickGraphicsInfo::testProperties()
{
    QQuickView view;
    view.setSource(QUrl("data/basic.qml"));

    view.show();
    QVERIFY(QTest::qWaitForWindowExposed(&view));

    QSignalSpy spy(&view, SIGNAL(sceneGraphInitialized()));
    spy.wait();

    QObject* obj = view.rootObject();
    QVERIFY(obj);

    QSGRendererInterface *rif = view.rendererInterface();
    const int expectedAPI = rif ? rif->graphicsApi() : QSGRendererInterface::Unknown;

    QCOMPARE(obj->property("api").toInt(), expectedAPI);

#if QT_CONFIG(opengl)
    if (expectedAPI == QSGRendererInterface::OpenGL) {
        QCOMPARE(obj->property("shaderType").toInt(), int(QSGRendererInterface::GLSL));
        QVERIFY(view.openglContext());
        QSurfaceFormat format = view.openglContext()->format();
        QCOMPARE(obj->property("majorVersion").toInt(), format.majorVersion());
        QCOMPARE(obj->property("minorVersion").toInt(), format.minorVersion());
        QCOMPARE(obj->property("profile").toInt(), static_cast<int>(format.profile()));
        QCOMPARE(obj->property("renderableType").toInt(), static_cast<int>(format.renderableType()));
    }
#endif
}
예제 #7
0
void ProjectOperationHandler::createClicked()
{
    if(m_projectName != "" && m_projectLocation != "")
    {
        QObject* rootObject = m_engine->rootObjects().first();
        QObject* form = rootObject->findChild<QObject*>("goLight", Qt::FindChildrenRecursively);
        form->setProperty("running", true);
        form = rootObject->findChild<QObject*>("goOpenLight", Qt::FindChildrenRecursively);
        form->setProperty("running", true);

        form = rootObject->findChild<QObject*>("goDarkMouseArea", Qt::FindChildrenRecursively);
        form->setProperty("enabled", true);
        form = rootObject->findChild<QObject*>("goOpenDarkMouseArea", Qt::FindChildrenRecursively);
        form->setProperty("enabled", true);

        form = m_createProjectForm->findChild<QObject*>("projectNameInput");
        m_projectName = form->property("text").toString();
        form = m_createProjectForm->findChild<QObject*>("projectLocationInput");
        m_projectLocation = form->property("text").toString();

        qDebug() << m_projectName << m_projectLocation;

        emit createProject(m_projectName, m_projectLocation);
    }
}
예제 #8
0
Telescope::Telescope(const QObject& other)
	: m_name(other.property("name").toString())
	, m_diameter(other.property("diameter").toDouble())
	, m_focalLength(other.property("focalLength").toDouble())
	, m_hFlipped(other.property("hFlipped").toBool())
	, m_vFlipped(other.property("vFlipped").toBool())
{
}
예제 #9
0
QVariantList AppEntry::actions() const
{
    QVariantList actionList;

    actionList << Kicker::jumpListActions(m_service);
    if (!actionList.isEmpty()) {
        actionList << Kicker::createSeparatorActionItem();
    }

    QObject *appletInterface = m_owner->rootModel()->property("appletInterface").value<QObject *>();

    const bool systemImmutable = appletInterface->property("immutability").toInt() == Plasma::Types::SystemImmutable;

    const QVariantList &addLauncherActions = Kicker::createAddLauncherActionList(appletInterface, m_service);
    if (!systemImmutable && !addLauncherActions.isEmpty()) {
        actionList << addLauncherActions
                   << Kicker::createSeparatorActionItem();
    }

    const QVariantList &recentDocuments = Kicker::recentDocumentActions(m_service);
    if (!recentDocuments.isEmpty()) {
        actionList << recentDocuments << Kicker::createSeparatorActionItem();
    }

    // Don't allow adding launchers, editing, hiding, or uninstalling applications
    // when system is immutable.
    if (systemImmutable) {
        return actionList;
    }

    if (m_menuEntryEditor->canEdit(m_service->entryPath())) {
        actionList << Kicker::createSeparatorActionItem();

        QVariantMap editAction = Kicker::createActionItem(i18n("Edit Application..."), "editApplication");
        editAction["icon"] = "kmenuedit"; // TODO: Using the KMenuEdit icon might be misleading.
        actionList << editAction;
    }

#ifdef HAVE_APPSTREAMQT
    if (m_service->isApplication()) {
        actionList << appstreamActions(m_service);
    }
#endif

    QQmlPropertyMap *appletConfig = qobject_cast<QQmlPropertyMap *>(appletInterface->property("configuration").value<QObject *>());

    if (appletConfig && appletConfig->contains("hiddenApplications") && qobject_cast<AppsModel *>(m_owner)) {
        const QStringList &hiddenApps = appletConfig->value("hiddenApplications").toStringList();

        if (!hiddenApps.contains(m_service->menuId())) {
            actionList << Kicker::createActionItem(i18n("Hide Application"), "hideApplication");
        }
    }

    return actionList;
}
예제 #10
0
void PluginContext::initFromEngine(QQmlEngine *engine){
    QObject* livecv = engine->rootContext()->contextProperty("livecv").value<QObject*>();
    if ( !livecv )
        THROW_EXCEPTION(lv::Exception, "Failed to load livecv context property.", 0);

    m_engine   = qobject_cast<lv::Engine*>(livecv->property("engine").value<QObject*>());
    m_settings = qobject_cast<lv::Settings*>(livecv->property("settings").value<QObject*>());
    if ( !m_engine || !m_settings )
        THROW_EXCEPTION(lv::Exception, "Failed to load properties from context", 0);
}
예제 #11
0
CCD::CCD(const QObject& other)
	: m_name(other.property("name").toString())
	, m_resolutionX(other.property("resolutionX").toInt())
	, m_resolutionY(other.property("resolutionY").toInt())
	, m_chipWidth(other.property("chipWidth").toFloat())
	, m_chipHeight(other.property("chipHeight").toFloat())
	, m_pixelWidth(other.property("pixelWidth").toFloat())
	, m_pixelHeight(other.property("pixelHeight").toFloat())
{
}
예제 #12
0
파일: local.cpp 프로젝트: dlonie/molequeue
void QueueLocal::jobStarted()
{
  QObject *theSender = QObject::sender();
  if (theSender) {
    qDebug() << "The job was successfully started:"
             << theSender->property("JOB_ID");
    int id = theSender->property("JOB_ID").toInt();
    m_jobs[id]->setStatus(Job::RUNNING);
    emit(jobStateChanged(0));
  }
}
void tst_qqmlvaluetypeproviders::qtquickValueTypes()
{
    QQmlEngine e;
    QQmlComponent component(&e, testFileUrl("qtquickValueTypes.qml"));
    QVERIFY(!component.isError());
    QVERIFY(component.errors().isEmpty());
    QObject *object = component.create();
    QVERIFY(object != 0);
    QVERIFY(object->property("qtqmlTypeSuccess").toBool());
    QVERIFY(object->property("qtquickTypeSuccess").toBool());
    delete object;
}
void tst_qqmlvaluetypeproviders::invokableFunctions()
{
    QQmlEngine e;
    QQmlComponent component(&e, testFileUrl("invokableFunctions.qml"));
    QVERIFY(!component.isError());
    QVERIFY(component.errors().isEmpty());
    QObject *object = component.create();
    QVERIFY(object != 0);
    QVERIFY(object->property("complete").toBool());
    QVERIFY(object->property("success").toBool());
    delete object;
}
예제 #15
0
bool  MainWindow::connectC()
{

    QObject* textinput = Root->findChild<QObject*>("textinput");
    QString str;

    str=(textinput->property("text")).toString();
    socket->connectToHost(str, 4200);
    textinput=Root->findChild<QObject*>("textinput2");
    str=(textinput->property("text")).toString();
    socket->write(QString("/me:" + str + "\n").toUtf8());
    return true;
}
void tst_qdeclarativelistreference::variantToList()
{
    QDeclarativeEngine engine;
    QDeclarativeComponent component(&engine, TEST_FILE("variantToList.qml"));

    QObject *o = component.create();
    QVERIFY(o);

    QVERIFY(o->property("value").userType() == qMetaTypeId<QDeclarativeListReference>());
    QCOMPARE(o->property("test").toInt(), 1);

    delete o;
}
예제 #17
0
void tst_qqmllistreference::variantToList()
{
    QQmlEngine engine;
    QQmlComponent component(&engine, testFileUrl("variantToList.qml"));

    QObject *o = component.create();
    QVERIFY(o);

    QVERIFY(o->property("value").userType() == qMetaTypeId<QQmlListReference>());
    QCOMPARE(o->property("test").toInt(), 1);

    delete o;
}
예제 #18
0
void Hint::slotValueDestroyed()
{
    QObject * o = sender();
    QString key = o->property("hint_key").toString();
    if(!o->property("hint_owner").isNull())
    {
        QPair<quintptr,QString> pk(o->property("hint_owner").value<quintptr>(), key);
        m_privateData.remove(pk);
    }
    else
    {
        m_data.remove(key);
    }
}
예제 #19
0
void PropertyItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
    QStyleOptionViewItem option = opt;

    PropertyItem *property = static_cast<PropertyItem*>(index.internalPointer());

    if (property && property->isSeparator()) {
        QColor color = option.palette.color(QPalette::BrightText);
        QObject* par = parent();
        if (par) {
            QVariant value = par->property("groupTextColor");
            if (value.canConvert<QColor>())
                color = value.value<QColor>();
        }
        option.palette.setColor(QPalette::Text, color);
        option.font.setBold(true);
        option.state &= ~QStyle::State_Selected;
    }

    if (index.column() == 1) {
        option.state &= ~QStyle::State_Selected;
    }

    option.state &= ~QStyle::State_HasFocus;

    if (property && property->isSeparator()) {
        QBrush brush = option.palette.dark();
        QObject* par = parent();
        if (par) {
            QVariant value = par->property("groupBackground");
            if (value.canConvert<QBrush>())
                brush = value.value<QBrush>();
        }
        painter->fillRect(option.rect, brush);
    }

    QPen savedPen = painter->pen();

    QItemDelegate::paint(painter, option, index);

    QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt, qobject_cast<QWidget*>(parent())));
    painter->setPen(QPen(color));
    if (index.column() == 1 || !(property && property->isSeparator())) {
        int right = (option.direction == Qt::LeftToRight) ? option.rect.right() : option.rect.left();
        painter->drawLine(right, option.rect.y(), right, option.rect.bottom());
    }
    painter->drawLine(option.rect.x(), option.rect.bottom(),
            option.rect.right(), option.rect.bottom());
    painter->setPen(savedPen);
}
void tst_qdeclarativeengine::clearComponentCache()
{
    QDeclarativeEngine engine;

    // Create original qml file
    {
        QFile file("temp.qml");
        QVERIFY(file.open(QIODevice::WriteOnly));
        file.write("import QtQuick 1.0\nQtObject {\nproperty int test: 10\n}\n");
        file.close();
    }

    // Test "test" property
    {
        QDeclarativeComponent component(&engine, "temp.qml");
        QObject *obj = component.create();
        QVERIFY(obj != 0);
        QCOMPARE(obj->property("test").toInt(), 10);
        delete obj;
    }

    // Modify qml file
    {
        QFile file("temp.qml");
        QVERIFY(file.open(QIODevice::WriteOnly));
        file.write("import QtQuick 1.0\nQtObject {\nproperty int test: 11\n}\n");
        file.close();
    }

    // Test cache hit
    {
        QDeclarativeComponent component(&engine, "temp.qml");
        QObject *obj = component.create();
        QVERIFY(obj != 0);
        QCOMPARE(obj->property("test").toInt(), 10);
        delete obj;
    }

    // Clear cache
    engine.clearComponentCache();

    // Test cache refresh
    {
        QDeclarativeComponent component(&engine, "temp.qml");
        QObject *obj = component.create();
        QVERIFY(obj != 0);
        QCOMPARE(obj->property("test").toInt(), 11);
        delete obj;
    }
}
예제 #21
0
파일: local.cpp 프로젝트: dlonie/molequeue
void QueueLocal::jobFinished()
{
  QObject *theSender = QObject::sender();
  if (theSender) {
    qDebug() << "The job was successfully finished:"
             << theSender->property("JOB_ID");
    int id = theSender->property("JOB_ID").toInt();
    m_jobs[id]->setStatus(Job::COMPLETE);
    emit(jobStateChanged(0));
    // Submit the next job if there is one
    ++m_currentJob;
    if (m_currentJob < m_jobs.size())
      runProgram(m_currentJob);
  }
}
예제 #22
0
void EngineTest::engineErrorHandlerTest(){
    Engine* engine = new Engine(new QQmlEngine);

    bool isWarning = false;
    bool isError   = false;
    QObject::connect(engine, &Engine::applicationWarning, [&isWarning, this](QJSValue){
        isWarning = true;
    });
    QObject::connect(engine, &Engine::applicationError, [&isError, this](QJSValue){
        isError = true;
    });

    QObject livecvStub;
    livecvStub.setProperty("engine", QVariant::fromValue(engine));

    engine->engine()->rootContext()->setContextProperty("engine", engine);
    engine->engine()->rootContext()->setContextProperty("livecv", &livecvStub);
    QObject* obj = engine->createObject(
        "import QtQuick 2.3\n import base 1.0\n "
        "Item{\n"
            "id: root;\n"
            "property string errorMessage: 'empty';\n"
            "property string warningMessage: 'empty';\n"
            "ErrorHandler{\n"
                "onError:   root.errorMessage   = e.message;\n"
                "onWarning: root.warningMessage = e.message;\n"
            "}\n"
            "EngineTestStub{\n"
                "Component.onCompleted: {\n"
                    "throwJsWarning();"
                    "throwJsError();"
                "}\n"
            "}\n"
        "}\n",
        0,
        QUrl::fromLocalFile("enginetest.qml")
    );

    QVERIFY(obj != 0);

    QCoreApplication::processEvents();

    QVERIFY(!isWarning);
    QVERIFY(!isError);

    QCOMPARE(obj->property("errorMessage").toString(),   QString("JSTest"));
    QCOMPARE(obj->property("warningMessage").toString(), QString("JSTest"));
}
void EntityTreeModelFactory::collectionsFetched(const Akonadi::Collection::List& list)
{
  QObject *job = sender();
  if (!job)
    return;
  QString wantedRemoteId = job->property(WANTED_REMOTE_ID).toString();
  if (!wantedRemoteId.isEmpty())
  {
    foreach(const Collection &col, list)
    {
      if (col.remoteId() == wantedRemoteId)
      {
        ChangeRecorder *changeRecorder = new ChangeRecorder(this);
        changeRecorder->setCollectionMonitored(col, true);
        changeRecorder->fetchCollection(true);
        changeRecorder->setAllMonitored(true);
        changeRecorder->itemFetchScope().fetchFullPayload();

        EntityTreeModel *etm = getModel(changeRecorder, parent());

        emit modelCreated(etm);
        return;
      }
    }
    return;
  }
예제 #24
0
void QmlCameraSource::start()
{
    if (view == nullptr)
    {
        qWarning() << "No view. Cannot find QML Camera";
        return;
    }
    
    QObject *qmlCamera = view->rootObject()->findChild<QObject*>("qrCameraQML");
    
    if (qmlCamera == nullptr)
    {
        qWarning() << "Cannot find QML camera object";
        return;
    }
    
    camera = qvariant_cast<QCamera*>(qmlCamera->property("mediaObject"));
    
    if (camera == nullptr)
    {
        qWarning() << "Cannot retrieve camera from qml object";
        return;
    }
    
    LOG_INFO() << camera->supportedViewfinderResolutions();
    LOG_INFO() << camera->viewfinderSettings().resolution();
    connect(&probe,SIGNAL(videoFrameProbed(QVideoFrame)),this,SLOT(onFrame(QVideoFrame)));
    probe.setSource(camera);
    connect(view, SIGNAL(closing(QQuickCloseEvent)), qApp, SLOT(quit()));
}
예제 #25
0
void QuickFluxUnitTests::actionCreator_genKeyTable()
{
    QQmlApplicationEngine engine;
    engine.addImportPath("qrc:///");

    QFActionCreator* actionCreator = qobject_cast<QFActionCreator*>(QFAppDispatcher::singletonObject(&engine, "QuickFluxTests" , 1,0,"AppActions"));

    QVERIFY(actionCreator);

    QString content = actionCreator->genKeyTable();

    QString output = QString(SRCDIR) + "/QuickFluxTests/AppActionsKeyTable.qml";

    QFile file(output);

    QVERIFY(file.open(QIODevice::WriteOnly));

    file.write(content.toLocal8Bit());
    file.close();

    QObject* keyTable = QFAppDispatcher::singletonObject(&engine, "QuickFluxTests",1,0,"AppActionsKeyTable");

    QVERIFY(keyTable);
    QVERIFY(keyTable->property("test1").toString() == "test1");
    QVERIFY(keyTable->property("test2").toString() == "test2");
}
예제 #26
0
void BOpenSaveEditorModulePrivate::resetFileHistoryMenuToolTip()
{
    if (mnuFileHistory.isNull())
        return;
    QObject *s = sender();
    mnuFileHistory->setToolTip(s ? s->property("beqt/file_name").toString() : QString());
}
예제 #27
0
JSValue QtField::valueFromInstance(ExecState* exec, const Instance* inst) const
{
    const QtInstance* instance = static_cast<const QtInstance*>(inst);
    QObject* obj = instance->getObject();

    if (obj) {
        QVariant val;
        if (m_type == MetaProperty) {
            if (m_property.isReadable())
                val = m_property.read(obj);
            else
                return jsUndefined();
        } else if (m_type == ChildObject)
            val = QVariant::fromValue((QObject*) m_childObject.data());
#ifndef QT_NO_PROPERTIES
        else if (m_type == DynamicProperty)
            val = obj->property(m_dynamicProperty);
#endif
        JSValueRef exception = 0;
        JSValueRef jsValue = convertQVariantToValue(toRef(exec), inst->rootObject(), val, &exception);
        if (exception)
            return exec->vm().throwException(exec, toJS(exec, exception));
        return toJS(exec, jsValue);
    }
    QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name()));
    return exec->vm().throwException(exec, createError(exec, msg.toLatin1().constData()));
}
예제 #28
0
QObject *QFAppDispatcher::singletonObject(QQmlEngine *engine, QString package, int versionMajor, int versionMinor, QString typeName)
{
    QString pattern  = "import QtQuick 2.0\nimport %1 %2.%3;QtObject { property var object : %4 }";

    QString qml = pattern.arg(package).arg(versionMajor).arg(versionMinor).arg(typeName);

    QObject* holder = 0;

    QQmlComponent comp (engine);
    comp.setData(qml.toUtf8(),QUrl());
    holder = comp.create();

    if (!holder) {
        qWarning() << QString("QuickFlux: Failed to gain singleton object: %1").arg(typeName);
        qWarning() << QString("Error: ") << comp.errorString();
        return 0;
    }

    QObject*object = holder->property("object").value<QObject*>();
    holder->deleteLater();

    if (!object) {
        qWarning() << QString("QuickFlux: Failed to gain singleton object: %1").arg(typeName);
        qWarning() << QString("Error: Unknown");
    }

    return object;
}
예제 #29
0
void Duck::handleGamePause() {
    QObject *game = this->parent();
    QObject *animation = this->findChild<QObject*>("jumpAnimation");

    if(game->property("paused")==QVariant(true)) {
        p_canJump = false;

        if(animation->property("running")==QVariant(true) && animation->property("over")==QVariant(true))
            QMetaObject::invokeMethod(animation, "stop");
    }

    else
        p_canJump = true;

    emit canJumpChanged();
}
예제 #30
0
void TestSimpleQmlLoad::loadSignal1()
{
    QQmlEngine *engine = new QQmlEngine;
    const QString TEST_FILE(":/testqml/testsignal1.qml");
    QQmlComponent* component = load(engine, TEST_FILE);
    QVERIFY(component);
    SignalTester st;

    QObject *myObject = component->create();
    QVERIFY(myObject != NULL);

    QVariant var = myObject->property("complete1");
    QVERIFY(!var.isNull());
    QVERIFY(var.toInt() == 12);

    QVERIFY(st.val == -1);
    QMetaObject::invokeMethod(myObject, "sendSig");
    QVERIFY(st.val == -1);

    QObject::connect(myObject, SIGNAL(sig1(int)), &st, SLOT(rcvMsg(int)));
    QMetaObject::invokeMethod(myObject, "sendSig");
    QVERIFY(st.val == 1);

    delete component;
    delete engine;
}