Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

QML and C++ interaction. Need advice

$
0
0
Hello guys Again I need your help. I’m implementing some kind of multi-tab application where each tab holds an editor that in turn shows somehow a file content. The application components/layouts/etc are specified using QML, but the editor itself is written in C++. To be able to use C++ editor from QML, I’m using standard approach: qmlRegisterType<MyEditor>("Specialeditor", 1, 0, "MyEditor"); So in my QML file I can do something like that: import Specialeditor 1.0     Rectangle {     id:main ...     MyEditor {         ...     } } But now I would like to ask my editor to open a certain file (and it’s not just a file name or string based content, in my case it would by specialy styled document that I have to prepare, I mean it’s not a standard type that QML would understand). How I can ask certain editor (since I can have a lot of them) to show certain styled document (namely C++ object)? This way is not going to help as I understand: viewer.rootContext()->setContextProperty(QStringLiteral("styledDocument"), getMyStyledDocument()); Since I cannot specify certain editor instance that has to open the document. Any thoughts? Thanks a lot, Maxim

Viewing all articles
Browse latest Browse all 4972

Trending Articles