PDA

View Full Version : QPushButton Click not working in GUI



alistair
10th July 2015, 00:06
Hi all,

I have created a simple checklist app that uses two buttons 'back' and 'next' to navigate a checklist. I know how to operate the QPushButton widgets and have coded them correctly as all of my checklists work fine. Although for one checklist which has identical coding and layout etc. to the rest, the buttons do not respond to clicks when the GUI is running on both android and PC. I have made sure they are all declared properly, etc. I have also checked whether the buttons were 'underneath' a layout. I have spent hours on this and simply cannot think of anything else that could go wrong as it only occurs on one checklist.

Any help would be greatly appreciated, thank you for your time :)

d_stranz
10th July 2015, 04:19
I guess we should all get out our crystal balls and try to guess along with you, since you haven't given us anything except a verbal description of the problem. I mean really, do you think we're clairvoyant?

alistair
10th July 2015, 04:35
Ahhh lol. In the header file there is the 'public:' and 'private:' section. I put the button functions in the 'private': area when I should have made a 'private slots:' area and put them there.

d_stranz
10th July 2015, 23:06
Amazing, that's exactly what my Ouija board spelled out: "p-r-i-v-a-t-e- -s-l-o-t-s". So you must have received my telepathic message.

alistair
12th July 2015, 23:38
It's actually happening with another button which is declared in the private slots. Can you send me another telepathic message please?

d_stranz
13th July 2015, 17:42
My crystal ball tells me that you have probably defined the variable for the button twice - once in the private section of the class, and again in the constructor, or that you've mistyped the name of the signal or slot in the connect statement.

alistair
14th July 2015, 02:14
Thank you for your help! It turned out that it was getting passed a variable that isn't initialised straight away which caused the button to become completely non-reactive. I just re-declared the variable inside the button function and it's all good. That telepathy does the trick ;)

d_stranz
14th July 2015, 15:51
That telepathy does the trick

Yeah, but it really drains the batteries.