[PyQt] 回复: about the sip wrappers

燕子 xiaoyan0325 at tom.com
Tue Aug 24 09:22:07 BST 2010


Thank you .I got it.
 
 
------------------ 原始邮件 ------------------
发件人: "Phil Thompson"<phil at riverbankcomputing.com>;
发送时间: 2010年8月23日(星期一) 下午5:06
收件人: "燕子"<xiaoyan0325 at tom.com>;
主题: Re: [PyQt] about the sip wrappers

 
On Mon, 23 Aug 2010 11:30:55 +0800, "燕子" <xiaoyan0325 at tom.com> wrote:
> Dear sir.
>  my head file is </:includetail>
>  myqtlibtest.h:</:includetail>
>  #ifndef MYQTLIBTEST_H
> #define MYQTLIBTEST_H</:includetail>
>  #include "myqtlibtest_global.h"
> //#include <windows.h>
> #include <qstring.h>
> #include <qdebug.h>
> #include "test.h"</:includetail>
>  class MYQTLIBTEST_EXPORT myqtlibtest
> {
> public:
>  myqtlibtest();
>  ~myqtlibtest(); </:includetail>
>   void show();
>  int testshow();</:includetail>
>  private:
>  Test *testpointer;</:includetail>
>  };
> MYQTLIBTEST_EXPORT int myshow(int aa);</:includetail>
>  #endif // MYQTLIBTEST_H</:includetail>
>  my sip wrappers is</:includetail>
>  myqtlibtest.sip:</:includetail>
>  %Module myqtlibtest 0</:includetail>
>  
> %Import QtCore/QtCoremod.sip
> %Import QtGui/QtGuimod.sip
>  class  myqtlibtest
> {
>  %TypeHeaderCode
>  #include "myqtlibtest.h"
>  %End
>  public:
>  myqtlibtest();
>  ~myqtlibtest();
>        void show();
>        int testshow();
>   private:
>  Test *testpointer;
> };
> int myshow(int aa);
>   
>  when I run the command of "sip -I ..\sip\PyQt4\ -t Qt_4_5_3  -t WS_WIN
>  myqtlibtest.sip
> "
>   
>   the error is "sip:myqtlibtest.sip :23:Class variables must be in the
>   public section." but I still need the private variable "Test
>   *testpointer"
>   
>  what can I do?

If you need the variable in your C++ code then just omit it from the .sip
file. If you need it from you Python code then you can't and need to change
the C++ to make it public.

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100824/add464cb/attachment.html>


More information about the PyQt mailing list