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/doric/widget/flex/FlexLayoutService.cpp
2021-05-20 18:27:45 +08:00

36 lines
1021 B
C++

#include "FlexLayoutService.h"
FlexLayoutService::FlexLayoutService(QObject *parent) : QObject(parent) {
config = new FlexLayoutConfig(this);
}
FlexLayoutService::~FlexLayoutService() {}
QVariant FlexLayoutService::createNode(QVariant config) {
FlexLayoutConfig *object = qvariant_cast<FlexLayoutConfig *>(config);
QVariant result;
if (object == nullptr) {
qCritical() << "FlexLayoutService createNode config not FlexLayoutConfig*";
} else {
result = QVariant::fromValue(new FlexLayout(object, this));
}
return result;
}
void FlexLayoutService::collectGarbage(QVariant rootNode) {
FlexLayout *node = qvariant_cast<FlexLayout *>(rootNode);
if (node == nullptr) {
qCritical() << "FlexLayoutService collectGarbage node to FlexLayout*";
} else {
node->deleteLater();
}
}
QVariant FlexLayoutService::createConfig() {
return QVariant::fromValue(new FlexLayoutConfig(this));
}
QVariant FlexLayoutService::createNode() {
return QVariant::fromValue(new FlexLayout(config, this));
}