QPushButton not appearing on scene [SOLVED]
When I try to add a QPushButton to the screen after a bool is declared true, it doesn't show up where it is supposed to. Here is the code. To be clear, I am adding the button from a non-constructor function, in case it is relevant. All pointers have been declared in the header file (not a typo), and will post if necessary, just don't want to make you look through all the code if not necessary. The scene is declared in the constructor from that same class.
Thank you for your help!
, it doesn't show up it is supposed to
So like it do not show at all or show in wrong position ?
Maybe you need to call ->show() on it ?
@mrjj Even after using show(); (which I forgot to include...) it is still not there when the crash bool is set to true. If you have more time and are willing to look through all the code for the project, it is right here on GitHub. The relevant class is Game (its where the button is). Still have to push all the changes, should be up withing a couple of minutes. It would rock too if you could tell me how to make the text (which is found in that same class) follow the QGraphicsView instead of the object, as when you start the game it does not appear until the plane is at a certain position. If you run the program yourself you will see what I mean.
Hi way cool code :)
Your setGeometry is just off
if I say
replay = new QPushButton("Replay", this);
//replay->setGeometry(QRect(QPoint(4500, 400), QSize(100,50)));
It comes in top, left corner. so my guess the 4500 is way to much ?
yep if I change it to 450, its on screen. :)
you did not have a
@mrjj Thank you so much, for some reason I always forget I need to use the show() function...
Thank you for the help, and if you have any more suggestions please do comment or drop a line on my GitHub page. This is just my iniciation project, will be moving on to something larger soon. Thanks again!