[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SIP with PyQt5 and "A More Complex C++ Example"
From:       bitmap kid <bitmap.kid () gmail ! com>
Date:       2019-03-23 12:43:13
Message-ID: CAPeH3Xz74BaNkzo3gJpZWBzQ1=hzF0vAMvzYxzBaqaG_r-mf_g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Problem solved ! Everything works fine now !

Un très grand merci !

bitmap.kid

Le sam. 23 mars 2019 Ã  13:29, Phil Thompson <phil@riverbankcomputing.com> a
écrit :

> The example is missing...
>
> %ModuleCode
> #include <hello.h>
> %End
>
> Thanks,
> Phil
>
> > On 23 Mar 2019, at 12:09 pm, bitmap kid <bitmap.kid@gmail.com> wrote:
> >
> > Oh obviously !
> >
> > hello.h ================================================
> > #ifndef HELLO_H
> > #define HELLO_H
> > #include <QLabel>
> > #include <QWidget>
> > #include <QString>
> >
> > class Hello : public QLabel {
> >     // This is needed by the Qt Meta-Object Compiler.
> >     Q_OBJECT
> >
> > public:
> >     Hello(QWidget *parent = 0);
> >
> > private:
> >     // Prevent instances from being copied.
> >     Hello(const Hello &);
> >     Hello &operator=(const Hello &);
> > };
> >
> > #if !defined(Q_OS_WIN)
> > void setDefault(const QString &def);
> > #endif
> > #endif // HELLO_H
> >
> > hello.cpp ================================================
> > #include "hello.h"
> >
> > Hello::Hello(QWidget *parent): QLabel(parent) {}
> > Hello::Hello(const Hello &other) { (void) other; }
> > Hello &Hello::operator=(const Hello &other) { (void) other; return
> *this; }
> >
> > #if !defined(Q_OS_WIN)
> > void setDefault(const QString &def) { (void) def; }
> > #endif
> >
> > hello.sip ================================================
> > // Define the SIP wrapper to the hello library.
> >
> > %Module hello
> >
> > %Import QtGui/QtGuimod.sip
> > %Import QtWidgets/QtWidgetsmod.sip
> >
> > %If (Qt_5_0_0 -)
> >
> > class Hello : public QLabel {
> >
> > %TypeHeaderCode
> > #include <hello.h>
> > %End
> >
> > public:
> >     Hello(QWidget *parent /TransferThis/ = 0);
> >
> > private:
> >     Hello(const Hello &);
> > };
> >
> > %If (!WS_WIN)
> > void setDefault(const QString &def);
> > %End
> >
> > %End
> >
> >
> >
> >
> >
> > Le sam. 23 mars 2019 Ã  13:05, Phil Thompson <phil@riverbankcomputing.com>
> a écrit :
> > On 23 Mar 2019, at 11:46 am, bitmap kid <bitmap.kid@gmail.com> wrote:
> > >
> > > Bonjour,
> > >
> > > I'm trying to make the example "A More Complex C++ Example" given in
> the documentation. But I'm having trouble with the setDefault function.
> > >
> > > Once the sources generated with the sip command, when I compile, the
> compiler says:
> > >
> > > ./siphellocmodule.cpp:438:13: error: "setDefault" was not declared in
> this scope.
> > >               setDefault (* a0);
> > >
> > > Indeed, the siphellocmodule.cpp file refers to the setDefault function
> but does not include hello.h
> > >
> > > Do you have an idea of where the problem is?
> > >
> > > Please, note :
> > > I am using PyQt5 5.12.1 and SIP 4.19.5.
> > > My project consists of hello.h, hello.cpp and hello.sip files
> > > My sip command is "sip -t WS_X11 -I /usr/share/sip/PyQt5 -c.hello.sip"
> > > It generates the following files:
> > >
> > >     sipAPIhello.h
> > >     siphelloHello.cpp
> > >     siphellocmodule.cpp
> > >
> > > And commenting the setDefault function build the project correctly.
> >
> > Difficult to say without seeing your hello.h, hello.cpp and hello.sip.
> >
> > Phil
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>Problem solved ! Everything works fine now ! \
<br></div><div><br></div><div>Un très grand merci \
!</div><div><br></div><div>bitmap.kid<br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">Le  sam. 23 mars 2019 Ã   \
13:29, Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; a \
écrit  :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The example is \
missing...<br> <br>
%ModuleCode<br>
#include &lt;hello.h&gt;<br>
%End<br>
<br>
Thanks,<br>
Phil<br>
<br>
&gt; On 23 Mar 2019, at 12:09 pm, bitmap kid &lt;<a \
href="mailto:bitmap.kid@gmail.com" target="_blank">bitmap.kid@gmail.com</a>&gt; \
wrote:<br> &gt; <br>
&gt; Oh obviously !<br>
&gt; <br>
&gt; hello.h ================================================<br>
&gt; #ifndef HELLO_H<br>
&gt; #define HELLO_H<br>
&gt; #include &lt;QLabel&gt;<br>
&gt; #include &lt;QWidget&gt;<br>
&gt; #include &lt;QString&gt;<br>
&gt; <br>
&gt; class Hello : public QLabel {<br>
&gt;        // This is needed by the Qt Meta-Object Compiler.<br>
&gt;        Q_OBJECT<br>
&gt; <br>
&gt; public:<br>
&gt;        Hello(QWidget *parent = 0);<br>
&gt; <br>
&gt; private:<br>
&gt;        // Prevent instances from being copied.<br>
&gt;        Hello(const Hello &amp;);<br>
&gt;        Hello &amp;operator=(const Hello &amp;);<br>
&gt; };<br>
&gt; <br>
&gt; #if !defined(Q_OS_WIN)<br>
&gt; void setDefault(const QString &amp;def);<br>
&gt; #endif<br>
&gt; #endif // HELLO_H<br>
&gt; <br>
&gt; hello.cpp ================================================<br>
&gt; #include &quot;hello.h&quot;<br>
&gt; <br>
&gt; Hello::Hello(QWidget *parent): QLabel(parent) {}<br>
&gt; Hello::Hello(const Hello &amp;other) { (void) other; }<br>
&gt; Hello &amp;Hello::operator=(const Hello &amp;other) { (void) other; return \
*this; }<br> &gt; <br>
&gt; #if !defined(Q_OS_WIN)<br>
&gt; void setDefault(const QString &amp;def) { (void) def; }<br>
&gt; #endif<br>
&gt; <br>
&gt; hello.sip ================================================<br>
&gt; // Define the SIP wrapper to the hello library.<br>
&gt; <br>
&gt; %Module hello<br>
&gt; <br>
&gt; %Import QtGui/QtGuimod.sip<br>
&gt; %Import QtWidgets/QtWidgetsmod.sip<br>
&gt; <br>
&gt; %If (Qt_5_0_0 -)<br>
&gt; <br>
&gt; class Hello : public QLabel {<br>
&gt; <br>
&gt; %TypeHeaderCode<br>
&gt; #include &lt;hello.h&gt;<br>
&gt; %End<br>
&gt; <br>
&gt; public:<br>
&gt;        Hello(QWidget *parent /TransferThis/ = 0);<br>
&gt; <br>
&gt; private:<br>
&gt;        Hello(const Hello &amp;);<br>
&gt; };<br>
&gt; <br>
&gt; %If (!WS_WIN)<br>
&gt; void setDefault(const QString &amp;def);<br>
&gt; %End<br>
&gt; <br>
&gt; %End<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Le sam. 23 mars 2019 Ã  13:05, Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com" \
target="_blank">phil@riverbankcomputing.com</a>&gt; a écrit :<br> &gt; On 23 Mar \
2019, at 11:46 am, bitmap kid &lt;<a href="mailto:bitmap.kid@gmail.com" \
target="_blank">bitmap.kid@gmail.com</a>&gt; wrote:<br> &gt; &gt; <br>
&gt; &gt; Bonjour,<br>
&gt; &gt; <br>
&gt; &gt; I&#39;m trying to make the example &quot;A More Complex C++ Example&quot; \
given in the documentation. But I&#39;m having trouble with the setDefault \
function.<br> &gt; &gt; <br>
&gt; &gt; Once the sources generated with the sip command, when I compile, the \
compiler says:<br> &gt; &gt; <br>
&gt; &gt; ./siphellocmodule.cpp:438:13: error: &quot;setDefault&quot; was not \
declared in this scope.<br> &gt; &gt;                       setDefault (* a0);<br>
&gt; &gt; <br>
&gt; &gt; Indeed, the siphellocmodule.cpp file refers to the setDefault function but \
does not include hello.h<br> &gt; &gt; <br>
&gt; &gt; Do you have an idea of where the problem is?<br>
&gt; &gt; <br>
&gt; &gt; Please, note :<br>
&gt; &gt; I am using PyQt5 5.12.1 and SIP 4.19.5.<br>
&gt; &gt; My project consists of hello.h, hello.cpp and hello.sip files<br>
&gt; &gt; My sip command is &quot;sip -t WS_X11 -I /usr/share/sip/PyQt5 \
-c.hello.sip&quot;<br> &gt; &gt; It generates the following files:<br>
&gt; &gt; <br>
&gt; &gt;        sipAPIhello.h<br>
&gt; &gt;        siphelloHello.cpp<br>
&gt; &gt;        siphellocmodule.cpp<br>
&gt; &gt; <br>
&gt; &gt; And commenting the setDefault function build the project correctly.<br>
&gt; <br>
&gt; Difficult to say without seeing your hello.h, hello.cpp and hello.sip.<br>
&gt; <br>
&gt; Phil<br>
<br>
</blockquote></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic