Issues with getter and setter methods
-
@ddryomyss said in Issues with getter and setter methods:
void MainWindow::mousePressEvent(QMouseEvent *mpe)
{
paintScene ps;ps is local to that function. Hence it's going to be empty and also destroyed a the end of the function.
-
The issue is your understanding of the variable scope. As I already said, you create a function local object of the type paintScene. You are getting the correct value since it's initialised to false.
You should be using your class instance of paintScene.
-
@SGaist and so? I don't really get, why ps.get() do not return to the value of start_pt.
If I will describe get() function like that:
bool paintScene::get() { return true; }
numeration will work. Where is the problem?
@ddryomyss you didn't read up on your basics, like I suggested in your other thread!
What you did, is:
You're in your house, and you create a box there. The box was empty, so you placed a banana in it.
Then you went to your garden shed and leave your box behind. But now you're missing your box! So you create an other a box there, the same way you did in your house. Its also empty, but you're now wondering why there's no banana in!
-
@ddryomyss you didn't read up on your basics, like I suggested in your other thread!
What you did, is:
You're in your house, and you create a box there. The box was empty, so you placed a banana in it.
Then you went to your garden shed and leave your box behind. But now you're missing your box! So you create an other a box there, the same way you did in your house. Its also empty, but you're now wondering why there's no banana in!
-
@ddryomyss you didn't read up on your basics, like I suggested in your other thread!
What you did, is:
You're in your house, and you create a box there. The box was empty, so you placed a banana in it.
Then you went to your garden shed and leave your box behind. But now you're missing your box! So you create an other a box there, the same way you did in your house. Its also empty, but you're now wondering why there's no banana in!
-
@ddryomyss you didn't read up on your basics, like I suggested in your other thread!
What you did, is:
You're in your house, and you create a box there. The box was empty, so you placed a banana in it.
Then you went to your garden shed and leave your box behind. But now you're missing your box! So you create an other a box there, the same way you did in your house. Its also empty, but you're now wondering why there's no banana in!
@J-Hilk I know that I am weak with basics. I was kind of forced to jump right into practice, so now it hurts badly a lot of times (lack of basic knowledge, I mean). Maybe you have any recommendations on sources of info? Something like a clear study plan (maybe a book, or course of lectures). Or maybe there was a post here on this topic? I'll be grateful to hear any recommendations from you (:
-
If I may be so bold as to suddenly insert myself...
@ddryomyss It is refreshing and heartening to see you acknowledge your weaknesses. That takes a certain courage, and I commend you!
My workplace study-group (all full-time professional software and firmware engineers) recently brainstormed a book list. We found there was great overlap when we each listed the books that had had the biggest influence on each of us.
I'll paste a relevant excerpt here.
I'd like to explicitly note: some of the books from 10+ years ago are still extremely relevant! Don't automatically discount any of these due to publication date alone.
For the C++ language specifically, please choose from this other list: https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
For widely-applicable software craft advice:
(2004) Head First Design Patterns
(2004) An Introduction to GCC <--- excellent for understanding how code turns into libraries and executables (whether or not you use GCC. the principles hold even on Windows in Visual Studio)
(2005) Effective C++ (definitely get the 3rd edition)
(2008) Clean Code
(2009) The Passionate Programmer
(2014) Effective Modern C++
-
The simplest explanation of scope I've seen for students is that a set of { ... } curly braces in C++ are like Las Vegas. What happens in curly braces stays in curly braces!
-
@J-Hilk I know that I am weak with basics. I was kind of forced to jump right into practice, so now it hurts badly a lot of times (lack of basic knowledge, I mean). Maybe you have any recommendations on sources of info? Something like a clear study plan (maybe a book, or course of lectures). Or maybe there was a post here on this topic? I'll be grateful to hear any recommendations from you (:
@ddryomyss said in Issues with getter and setter methods:
@J-Hilk I know that I am weak with basics. I was kind of forced to jump right into practice, so now it hurts badly a lot of times (lack of basic knowledge, I mean).
Don't worry, I started in a very similar fashion myself, I can relate.
As long as you're hopeful, polite and most importantly willing to improve yourself, I'm sure no-one here will refuse to aide you!Maybe you have any recommendations on sources of info? Something like a clear study plan (maybe a book, or course of lectures). Or maybe there was a post here on this topic? I'll be grateful to hear any recommendations from you (:
Well, I can only tell you from my personal experience.
I learn the more from videos than from books. So I've a couple of YT channels, that I follow that over the years published a hand full of tutorials:I can recommend the following:
The Cherno:
https://www.youtube.com/c/TheChernoProjecthe's a previous (c++)Game Developer and has a playlist about the basics (still ongoing) an OpenGL tutorial playlist and a GameEngine developer playlist.
So it varies between beginner level entry and advanced, pick your poison carefullyVoidRealms:
https://www.youtube.com/user/VoidRealmsHe's also a (somewhat) active forum member, he was one of my first Qt related sources for me.
Also has introductions to C++ and other Languages, and last I heard he has udemy courses to offer (never checked them out myself!)Cᐩᐩ Weekly:
https://www.youtube.com/user/lefticus1For more advanced stuff and oddities in c++, :D
-
If I may be so bold as to suddenly insert myself...
@ddryomyss It is refreshing and heartening to see you acknowledge your weaknesses. That takes a certain courage, and I commend you!
My workplace study-group (all full-time professional software and firmware engineers) recently brainstormed a book list. We found there was great overlap when we each listed the books that had had the biggest influence on each of us.
I'll paste a relevant excerpt here.
I'd like to explicitly note: some of the books from 10+ years ago are still extremely relevant! Don't automatically discount any of these due to publication date alone.
For the C++ language specifically, please choose from this other list: https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
For widely-applicable software craft advice:
(2004) Head First Design Patterns
(2004) An Introduction to GCC <--- excellent for understanding how code turns into libraries and executables (whether or not you use GCC. the principles hold even on Windows in Visual Studio)
(2005) Effective C++ (definitely get the 3rd edition)
(2008) Clean Code
(2009) The Passionate Programmer
(2014) Effective Modern C++
@KH-219Design @J-Hilk I'm truly amazed by your willingness to share your experience with me! I'll try to make maximum use of your recommendations as soon as I can, huuuge thank you (: