Results 1 to 8 of 8

Thread: QPushButton Click not working in GUI

  1. #1
    Join Date
    Jul 2015
    Posts
    11
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows Android

    Question QPushButton Click not working in GUI

    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

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,695
    Thanks
    259
    Thanked 753 Times in 743 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    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?

  3. #3
    Join Date
    Jul 2015
    Posts
    11
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    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.
    Last edited by alistair; 10th July 2015 at 06:46.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,695
    Thanks
    259
    Thanked 753 Times in 743 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    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.

  5. #5
    Join Date
    Jul 2015
    Posts
    11
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    It's actually happening with another button which is declared in the private slots. Can you send me another telepathic message please?

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,695
    Thanks
    259
    Thanked 753 Times in 743 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    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.

  7. The following user says thank you to d_stranz for this useful post:

    alistair (14th July 2015)

  8. #7
    Join Date
    Jul 2015
    Posts
    11
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    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

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,695
    Thanks
    259
    Thanked 753 Times in 743 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QPushButton Click not working in GUI

    That telepathy does the trick
    Yeah, but it really drains the batteries.

Similar Threads

  1. Using double click in QPushButton
    By nikbits in forum Newbie
    Replies: 1
    Last Post: 16th September 2011, 12:28
  2. QPushButton click
    By qutron in forum Newbie
    Replies: 2
    Last Post: 29th November 2010, 15:47
  3. Replies: 7
    Last Post: 26th August 2009, 08:21
  4. QPushButton deleting itself on click
    By Cruz in forum Qt Programming
    Replies: 4
    Last Post: 23rd January 2009, 10:18
  5. QPushButton on Shift+Click?
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 9th September 2008, 11:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.