Convert small PyQt script to Qt C++
-
@JonB aaand i gave up :/ i bet there is a ton of errors but...
Header -> https://pastebin.com/UdDHhpBZ
CPP -> https://pastebin.com/Eezyiqcg -
@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
? -
@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 :-)
-
@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... -
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.
-
@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
-
Can you share the errors you got ?
-
@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.
-
@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 😜 -
@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'
-
@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.