[PyQt] How can I export a utility function using SIP?

Frost Ming frost.ming at asml.com
Fri Apr 15 04:48:42 BST 2016


I am working on exporting the API from C++ to python to test Qt GUI.
In the .sip file, I use fake class definition. Symbols definitions are got from GUI after it is launched so I don't have to export all the dependent libraries. But it doesn't work for utility functions which does not rely on any classes.  Exporting flow are successful but when import the exported module, it says cannot find symbols definition.
Here is what the sip file like:

// not a module, must be included in another sip file
// Utility funtions to handle chartplot object
namespace lib {
namespace infra {
namespace chartplot {

// Lines between %TypeHeaderCode...%End are Fake definitions.
%TypeHeaderCode
namespace lib {
namespace infra {
namespace chartplot {
class ChartPanelBase;
int getXCoor(lib::infra::chartplot::ChartPanelBase* chartPanel, double v);
int getYCoor(lib::infra::chartplot::ChartPanelBase* chartPanel, double v);
double getXValue(lib::infra::chartplot::ChartPanelBase* chartPanel, int xCoor);
double getYValue(lib::infra::chartplot::ChartPanelBase* chartPanel, int yCoor);

} // namespace chartplot
} // namespace infra
} // namespace lib
%End

int getXCoor(lib::infra::chartplot::ChartPanelBase* chartPanel, double v);
int getYCoor(lib::infra::chartplot::ChartPanelBase* chartPanel, double v);
double getXValue(lib::infra::chartplot::ChartPanelBase* chartPanel, int xCoor);
double getYValue(lib::infra::chartplot::ChartPanelBase* chartPanel, int yCoor);

}; // namespace chartplot
}; // namespace infra
}; // namespace lib


Any help?

Best Regards,
Frost Ming

-- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. Unless explicitly stated otherwise in the body of this communication or the attachment thereto (if any), the information is provided on an AS-IS basis without any express or implied warranties or liabilities. To the extent you are relying on this information, you are doing so at your own risk. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. The sender nor the company/group of companies he or she represents shall be liable for the proper and complete transmission of the information contained in this communication, or for any delay in its receipt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160415/749c82db/attachment-0001.html>


More information about the PyQt mailing list