| | |
| | | CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), context(nullptr) { |
| | | } |
| | | |
| | | CoreWindowAgentPrivate::~CoreWindowAgentPrivate() { |
| | | if (context) { |
| | | delete context; |
| | | context = nullptr; |
| | | } |
| | | } |
| | | CoreWindowAgentPrivate::~CoreWindowAgentPrivate() = default; |
| | | |
| | | void CoreWindowAgentPrivate::init() { |
| | | } |
| | | |
| | | bool CoreWindowAgentPrivate::setup(const QObject *host, const WindowItemDelegate *delegate) { |
| | | auto ctx = |
| | | AbstractWindowContext *CoreWindowAgentPrivate::createContext() const { |
| | | return |
| | | #ifdef Q_OS_WINDOWS |
| | | new Win32WindowContext(host, delegate) |
| | | new Win32WindowContext() |
| | | #else |
| | | new QtWindowContext(host, window, delegate) |
| | | new QtWindowContext() |
| | | #endif |
| | | ; |
| | | if (!ctx->setup()) { |
| | | delete ctx; |
| | | ctx = nullptr; |
| | | ; |
| | | } |
| | | |
| | | |
| | | bool CoreWindowAgentPrivate::setup(QObject *host, WindowItemDelegate *delegate) { |
| | | std::unique_ptr<AbstractWindowContext> ctx(createContext()); |
| | | if (!ctx->setup(host, delegate)) { |
| | | return false; |
| | | } |
| | | context = ctx; |
| | | context = std::move(ctx); |
| | | return true; |
| | | } |
| | | |