This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/DoricPanel.cpp

23 lines
680 B
C++
Raw Normal View History

2021-02-04 16:59:58 +08:00
#include "DoricPanel.h"
2021-02-09 17:42:11 +08:00
#include "shader/DoricRootNode.h"
2021-02-04 16:59:58 +08:00
2021-06-09 16:46:33 +08:00
DoricPanel::DoricPanel(QQmlApplicationEngine *qmlEngine,
QQuickItem *quickItem) {
2021-02-23 14:28:08 +08:00
mQmlEngine = qmlEngine;
mQuickItem = quickItem;
}
2021-02-04 16:59:58 +08:00
2021-06-09 16:46:33 +08:00
DoricPanel::~DoricPanel() { delete mContext; }
2021-04-09 16:39:43 +08:00
2021-02-04 16:59:58 +08:00
void DoricPanel::config(QString script, QString alias, QString extra) {
DoricContext *context = DoricContext::create(script, alias, extra);
config(context);
}
void DoricPanel::config(DoricContext *context) {
this->mContext = context;
2021-02-23 14:28:08 +08:00
this->mContext->setQmlEngine(mQmlEngine);
2021-02-19 19:01:31 +08:00
this->mContext->getRootNode()->setRootView(mQuickItem);
this->mContext->build(mQuickItem->width(), mQuickItem->height());
2021-02-04 16:59:58 +08:00
}