How to interface Qt Quick UI code with Qt creator pluing?
Hello;
I'm trying to build a plugin for Qt Creator as described in [1] http://doc.qt.digia.com/qtcreator-ex...st-plugin.html.
The plugin should use Qt Quick QML.
I wonder how to insert this code from the main() function of a destktop Qt Quick app:
Code:
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine("main.qml");
QObject *root
= engine.
rootObjects().
at(0);
QQuickWindow *window =
qobject_cast<QQuickWindow*>(root);
if (!window) {
qFatal("Error: No window found!");
}
window->show();
return app.exec();
into the basic template plugin generated by Qt Creator.
How to interface with:
Code:
void ExamplePlugin::triggerAction()
{
QMessageBox::information(Core
::ICore::instance()->mainWindow
(),
tr("Action triggered"),
tr("This is an action from Example."));
}
Should my code for the Qt Creator plugin acts as a library of the template plugin?
Thank you for any reply.
Re: How to interface Qt Quick UI code with Qt creator pluing?
What have you tried already?
You obviously don't need the QGuiApplication, that is already handled by Creator itself.
You will want to keep the engine object alive, so you probably want it as a member of your plugin class.
Creator calls the initialize() method of all plugins after they have been loaded, so that sounds like a good place to load the QML.
Cheers,
_
How to inject Qt Quick QML into Qt Widget based desktop app;
Hello
I'm writing a desktop Qt Widget app for Windows. I want to do part of the UI in Qt Quick QML, hence I need to inject Qt Quick UI components
into my existing Widget UI code.
1) How to add one QQuickView on top of Core::ICore::instance()->mainWindow()?
From Core::ICore::instance()->mainWindow()
to
QQuickView
2) How to add one QQuickWindow on top of Core::ICore::instance()->mainWindow()? is this possible?
From Core::ICore::instance()->mainWindow()
to
QQuickWindow
Thank for any help.
Re: How to inject Qt Quick QML into Qt Widget based desktop app;
you can use a QML file as source,like the picture source
Re: How to inject Qt Quick QML into Qt Widget based desktop app;
If you want to add your QtQuick view into a widget layout, you need to wrap it into a QWidget first and then add this
Code:
// view constructed somewhere
QQuickView *view ....
// create wrapper widget
// add widget as any other widget
layout->addWidget(viewContainer)
With Qt 5.3 there will also be another alternative: QQuickWidget
Cheers,
_