Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Convert small PyQt script to Qt C++
Forum Updated to NodeBB v4.3 + New Features

Convert small PyQt script to Qt C++

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 5 Posters 5.6k Views 1 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.
  • K Kris Revi

    @JonB sadly i am giving up :/ when i ran this it gave me a shit load of errors (i know that 1 error can cause other things to error out aswell) but i couldn't figure out the error anyway so

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

    @Kris-Revi said in Convert small PyQt script to Qt C++:

    i know that 1 error can cause other things to error out aswell

    That's why you should always fix the first error first :-)

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

    K 1 Reply Last reply
    1
    • jsulmJ jsulm

      @Kris-Revi said in Convert small PyQt script to Qt C++:

      i know that 1 error can cause other things to error out aswell

      That's why you should always fix the first error first :-)

      K Offline
      K Offline
      Kris Revi
      wrote on last edited by
      #13

      @jsulm i coded everything needed (the cpp and h i linked) befor testing so :/

      jsulmJ 1 Reply Last reply
      0
      • JonBJ JonB

        @Kris-Revi
        From a glance, it seems to me you are doing well. I hope you don't mean you are giving up having got this far? I can't spare much time, but do you want me to tell you the C++ for the couple of bits I see commented out in your .cpp?

        K Offline
        K Offline
        Kris Revi
        wrote on last edited by
        #14

        @JonB said in Convert small PyQt script to Qt C++:

        but do you want me to tell you the C++ for the couple of bits I see commented out in your .cpp?

        i bet it wouldn't fix it anyway :/

        JonBJ 1 Reply Last reply
        0
        • K Kris Revi

          @JonB said in Convert small PyQt script to Qt C++:

          but do you want me to tell you the C++ for the couple of bits I see commented out in your .cpp?

          i bet it wouldn't fix it anyway :/

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

          @Kris-Revi
          It would not fix errors, no! I'm not clear whether you are saying your "errors" are at compile/link time, or at runtime....

          K 1 Reply Last reply
          0
          • K Kris Revi

            @jsulm i coded everything needed (the cpp and h i linked) befor testing so :/

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #16

            @Kris-Revi said in Convert small PyQt script to Qt C++:

            i coded everything needed (the cpp and h i linked) befor testing so :/

            I don't know what you mean here.
            You wrote that you get errors when building the code, right?
            So, start with the first error...

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

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

              Hi,

              One issue in your code is in your constructor, you are checking if the vector is empty but you have the logic reversed. You do something with it when it's actually empty.

              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
              • JonBJ JonB

                @Kris-Revi
                It would not fix errors, no! I'm not clear whether you are saying your "errors" are at compile/link time, or at runtime....

                K Offline
                K Offline
                Kris Revi
                wrote on last edited by
                #18

                @JonB said in Convert small PyQt script to Qt C++:

                @Kris-Revi
                It would not fix errors, no! I'm not clear whether you are saying your "errors" are at compile/link time, or at runtime....

                @ compile

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

                  Can you share the errors you got ?

                  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
                  0
                  • K Kris Revi

                    @JonB said in Convert small PyQt script to Qt C++:

                    @Kris-Revi
                    It would not fix errors, no! I'm not clear whether you are saying your "errors" are at compile/link time, or at runtime....

                    @ compile

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

                    @Kris-Revi
                    Then, if you can't figure it, show us the first line at fault and what the error message is, if you'd like help... :)

                    BTW, it won't affect your compile behaviour, but you absolutely need to heed @SGaist's earlier observation for your run-time behaviour. Plus, I didn't follow the logic for the consequence, but you still have the commented-out initialization of the array when it's empty to deal with.

                    1 Reply Last reply
                    0
                    • K Kris Revi

                      @JonB aaand i gave up :/ i bet there is a ton of errors but...

                      Header -> https://pastebin.com/UdDHhpBZ
                      CPP -> https://pastebin.com/Eezyiqcg

                      J.HilkJ Online
                      J.HilkJ Online
                      J.Hilk
                      Moderators
                      wrote on last edited by J.Hilk
                      #21

                      @Kris-Revi
                      Merry Christmas!

                      https://github.com/DeiVadder/QWidgetGradient.git


                      After some testing, the functionality is kind of strange, not sure if thats intended behavior, or if I made a bug 🤔
                      For you to find out I guess 😜


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      K 1 Reply Last reply
                      2
                      • J.HilkJ J.Hilk

                        @Kris-Revi
                        Merry Christmas!

                        https://github.com/DeiVadder/QWidgetGradient.git


                        After some testing, the functionality is kind of strange, not sure if thats intended behavior, or if I made a bug 🤔
                        For you to find out I guess 😜

                        K Offline
                        K Offline
                        Kris Revi
                        wrote on last edited by
                        #22

                        @J-Hilk wow, thank you sooo much! christmas came early!! <3

                        i get these errors in the Header file alone

                        G:\QT GUI\TesterGradient\gradient.h:31: error: C2429: attribute 'nodiscard' requires compiler flag '/std:c++17'
                        G:\QT GUI\TesterGradient\gradient.cpp:3: error: C2653: 'gradient': is not a class or namespace name
                        G:\QT GUI\TesterGradient\gradient.cpp:4: error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
                        G:\QT GUI\TesterGradient\gradient.cpp:6: warning: C4508: 'gradient': function should return a value; 'void' return type assumed
                        g:\qt gui\build-testergradient-desktop_qt_5_15_1_msvc2019_32bit-debug\debug\..\..\TesterGradient\gradient.h:31: error: C2429: attribute 'nodiscard' requires compiler flag '/std:c++17'
                        
                        J.HilkJ 1 Reply Last reply
                        0
                        • K Kris Revi

                          @J-Hilk wow, thank you sooo much! christmas came early!! <3

                          i get these errors in the Header file alone

                          G:\QT GUI\TesterGradient\gradient.h:31: error: C2429: attribute 'nodiscard' requires compiler flag '/std:c++17'
                          G:\QT GUI\TesterGradient\gradient.cpp:3: error: C2653: 'gradient': is not a class or namespace name
                          G:\QT GUI\TesterGradient\gradient.cpp:4: error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
                          G:\QT GUI\TesterGradient\gradient.cpp:6: warning: C4508: 'gradient': function should return a value; 'void' return type assumed
                          g:\qt gui\build-testergradient-desktop_qt_5_15_1_msvc2019_32bit-debug\debug\..\..\TesterGradient\gradient.h:31: error: C2429: attribute 'nodiscard' requires compiler flag '/std:c++17'
                          
                          J.HilkJ Online
                          J.HilkJ Online
                          J.Hilk
                          Moderators
                          wrote on last edited by J.Hilk
                          #23

                          @Kris-Revi well, it compiles for me :P

                          remove the [[nodiscard]] attribute, its not needed, and if your compiler is not c++17 capable, no need to have it there


                          Edit: check the repo, I updated it, inclusive a bugfix I found.


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          1 Reply Last reply
                          1

                          • Login

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