Mantid
Loading...
Searching...
No Matches
Sip.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8#include <QtGlobal>
9#include <sip.h>
10
15const sipAPIDef *sipAPI() {
16 static const sipAPIDef *sip_API = nullptr;
17 if (sip_API)
18 return sip_API;
19
20 // Some configs have a private sip module inside PyQt. Try this first
21#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
22 sip_API = (const sipAPIDef *)PyCapsule_Import("PyQt5.sip._C_API", 0);
23#else
24#error "Unknown sip module for Qt >= 6"
25#endif
26 // Try plain sip module
27 if (!sip_API) {
28 PyErr_Clear();
29 sip_API = (const sipAPIDef *)PyCapsule_Import("sip._C_API", 0);
30 }
31
32 assert(sip_API);
33 return sip_API;
34}
35} // namespace MantidQt::Widgets::Common::Python::Detail
EXPORT_OPT_MANTIDQT_COMMON const sipAPIDef * sipAPI()
Definition: Sip.cpp:15