Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. register c++ class in pyqt6
Qt 6.11 is out! See what's new in the release blog

register c++ class in pyqt6

Scheduled Pinned Locked Moved Unsolved Qt for Python
16 Posts 5 Posters 2.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    What kind of C++ class ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    Q 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      What kind of C++ class ?

      Q Offline
      Q Offline
      qAminzzz
      wrote on last edited by
      #3

      @SGaist header and source class (.h) (.c++)

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        How you handle the separation of declaration and implementation is not the question here.

        The question is: what kind of class do you want to implement in C++ and then use with Python ?
        What should it do ? Why does it need to be implemented in C++ ? etc.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply
        0
        • SGaistS SGaist

          How you handle the separation of declaration and implementation is not the question here.

          The question is: what kind of class do you want to implement in C++ and then use with Python ?
          What should it do ? Why does it need to be implemented in C++ ? etc.

          Q Offline
          Q Offline
          qAminzzz
          wrote on last edited by qAminzzz
          #5

          @SGaist said in register c++ class in pyqt6:

          How you handle the separation of declaration and implementation is not the question here.
          The question is: what kind of class do you want to implement in C++ and then use with Python ?
          What should it do ? Why does it need to be implemented in C++ ? etc.

          oh ok, sorry
          i wanna use QSetting and QDebug class to save somethings with QSetting

          JonBJ 1 Reply Last reply
          0
          • Q qAminzzz

            @SGaist said in register c++ class in pyqt6:

            How you handle the separation of declaration and implementation is not the question here.
            The question is: what kind of class do you want to implement in C++ and then use with Python ?
            What should it do ? Why does it need to be implemented in C++ ? etc.

            oh ok, sorry
            i wanna use QSetting and QDebug class to save somethings with QSetting

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #6

            @qAminzzz
            Why go into C++ when these are supported from Python/PyQt?? We are trying to save you lots of headache when it's not apparent you ever need to leave Python to do whatever you want. It's an awful lot simpler to stick in one language....

            Q 1 Reply Last reply
            1
            • JonBJ JonB

              @qAminzzz
              Why go into C++ when these are supported from Python/PyQt?? We are trying to save you lots of headache when it's not apparent you ever need to leave Python to do whatever you want. It's an awful lot simpler to stick in one language....

              Q Offline
              Q Offline
              qAminzzz
              wrote on last edited by qAminzzz
              #7

              @JonB thanks for your answer. yes i know, but i'm on frontend and frontend and backend should be separate this is more beautiful (;

              jsulmJ 1 Reply Last reply
              0
              • Q qAminzzz

                @JonB thanks for your answer. yes i know, but i'm on frontend and frontend and backend should be separate this is more beautiful (;

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @qAminzzz Not sure what this has to do with front-end/back-end?
                Can you explain why you want to write C++ class for something you already have in PyQt (QSettings)?
                Do you mean you want to use this C++ class in front-end and back-end and one of them is pure C++?
                Writing such a class only makes sense if you're doing more than just reading/writing settings (for that you can use QSettings directly).

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                Q 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @qAminzzz Not sure what this has to do with front-end/back-end?
                  Can you explain why you want to write C++ class for something you already have in PyQt (QSettings)?
                  Do you mean you want to use this C++ class in front-end and back-end and one of them is pure C++?
                  Writing such a class only makes sense if you're doing more than just reading/writing settings (for that you can use QSettings directly).

                  Q Offline
                  Q Offline
                  qAminzzz
                  wrote on last edited by
                  #9

                  @jsulm actually i am not allowed to use pyqt for frontend. can't to create and use c++ class in pyqt?

                  jsulmJ 1 Reply Last reply
                  0
                  • Q qAminzzz

                    @jsulm actually i am not allowed to use pyqt for frontend. can't to create and use c++ class in pyqt?

                    jsulmJ Online
                    jsulmJ Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @qAminzzz said in register c++ class in pyqt6:

                    can't to create and use c++ class in pyqt?

                    Of course you can.
                    My question was: do you really need a C++ class for reading/writing settings if there is already QSettings Qt (C++) class which can be used in C++ and Python code?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Q 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @qAminzzz said in register c++ class in pyqt6:

                      can't to create and use c++ class in pyqt?

                      Of course you can.
                      My question was: do you really need a C++ class for reading/writing settings if there is already QSettings Qt (C++) class which can be used in C++ and Python code?

                      Q Offline
                      Q Offline
                      qAminzzz
                      wrote on last edited by qAminzzz
                      #11

                      @jsulm yes i really need, actually may you think that not needed but i like to frontend and backend be really separate, even if be just something simple (:
                      thank you for you answers
                      and sorry if my language is bad

                      jsulmJ SGaistS 2 Replies Last reply
                      0
                      • Q qAminzzz

                        @jsulm yes i really need, actually may you think that not needed but i like to frontend and backend be really separate, even if be just something simple (:
                        thank you for you answers
                        and sorry if my language is bad

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @qAminzzz said in register c++ class in pyqt6:

                        but i like to frontend and backend be really separate

                        I did not say anything about the need to separate frontend and backend.
                        All I said is that there is QSettings class which can be used in Python AND C++...

                        If you want/need to write a C++ class and also use it in Python then this is what you need to read: https://docs.python.org/3/extending/extending.html

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        Q 1 Reply Last reply
                        2
                        • Q qAminzzz

                          @jsulm yes i really need, actually may you think that not needed but i like to frontend and backend be really separate, even if be just something simple (:
                          thank you for you answers
                          and sorry if my language is bad

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          @qAminzzz You keep talking about backend and front end however Python can be used for both just like C++ can also be used for both.

                          Please explain your application architecture.

                          As @jsulm already wrote, writing C++ for the sake of writing C++ and then having to create Python bindings does not make much sense unless you are really adding something new.

                          The set of classes you described you want to use are already available for using in Python.

                          Hence: provide more information about your use case, application, architecture.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1
                          • M Offline
                            M Offline
                            madik
                            wrote on last edited by
                            #14

                            Здраствуйте уменя вот такое проблема как можна решить !рр.png

                            jsulmJ 1 Reply Last reply
                            0
                            • M madik

                              Здраствуйте уменя вот такое проблема как можна решить !рр.png

                              jsulmJ Online
                              jsulmJ Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by jsulm
                              #15

                              @madik said in register c++ class in pyqt6:

                              Здраствуйте уменя вот такое проблема как можна решить !

                              Please English :-)
                              There is dedicated forum where you can ask questions in Russian: https://forum.qt.io/category/27/russian
                              Also, please open your own topic!

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @qAminzzz said in register c++ class in pyqt6:

                                but i like to frontend and backend be really separate

                                I did not say anything about the need to separate frontend and backend.
                                All I said is that there is QSettings class which can be used in Python AND C++...

                                If you want/need to write a C++ class and also use it in Python then this is what you need to read: https://docs.python.org/3/extending/extending.html

                                Q Offline
                                Q Offline
                                qAminzzz
                                wrote on last edited by qAminzzz
                                #16

                                @jsulm thanks for answer. actually it is not good to make a c++ class for this topic, in last i made a pyqt class and i use from that class for frontend. i learned somethings and thanks (:

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved