Hi friends.

I've tried to write a question to the IRC but its text seems to be long so I ask here if anybody can help me with reusing QTC source code in my project. This question isn't bound directly with any QTC bug.

I'm writing a function that takes qml file path as input and should return populated QmlDesigner::Model as output. Then I use QmlDesigner::Model to work with qml document that contains domain specific info for my application.

I'm gettng a crash in QReadLocker and I've posted the question to this forum https://forum.qt.io/topic/59648/crash-in-qreadlocker .

Here's the function's source code. Please tell me if I reuse QTC source code incorrectly.

std::shared_ptr<QmlDesigner::Model> DialogFactory::populateNodeTreeFromFile(const std::string& fileName)
{
    // reading the file
    const QString qfileName = QString::fromStdString(fileName);
    QFile f(qfileName);
    if (!f.open(QFile::ReadOnly | QFile::Text))
        return nullptr;
    QTextStream in(&f);
m_rewriterView->setPlainText(in.readAll()); // m_rewriterView is created in the constructor
    // populating the model
    m_docModel->setFileUrl(QUrl::fromLocalFile(qfileName));
    m_docModel->setRewriterView(m_rewriterView);
    //--
    return m_docModel;
}

Thanks in advance.
--
        *Шмыков Дмитрий *
программист
www.nexters.com <http://www.nexters.com>
+7 985 915 0966
skype: dmitryshm1

_______________________________________________
Qt-creator mailing list
Qt-creator@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to