qtremoteobjects.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2024 Ford Motor Company
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // @snippet qtro-init
  4. PySide::RemoteObjects::init(module);
  5. // @snippet qtro-init
  6. // @snippet node-acquire
  7. auto *typeObject = reinterpret_cast<PyTypeObject*>(%PYARG_1);
  8. if (!PySide::inherits(typeObject, SbkPySide6_QtRemoteObjectsTypeStructs[SBK_QRemoteObjectReplica_IDX].fullName)) {
  9. PyErr_SetString(PyExc_TypeError, "First argument must be a type deriving from QRemoteObjectReplica.");
  10. return nullptr;
  11. }
  12. static PyObject *pyConstructWithNode = Shiboken::Enum::newItem(
  13. Shiboken::Module::get(SbkPySide6_QtRemoteObjectsTypeStructs[SBK_QRemoteObjectReplica_ConstructorType_IDX]),
  14. 1 /* protected QRemoteObjectReplica::ConstructorType::ConstructWithNode */
  15. );
  16. Shiboken::AutoDecRef args;
  17. if (pyArgs[1])
  18. args.reset(PyTuple_Pack(3, %PYSELF, pyConstructWithNode, pyArgs[1]));
  19. else
  20. args.reset(PyTuple_Pack(2, %PYSELF, pyConstructWithNode));
  21. PyObject *instance = PyObject_CallObject(%PYARG_1, args.object());
  22. if (!instance)
  23. return nullptr; // Propagate the exception
  24. %PYARG_0 = instance;
  25. // @snippet node-acquire