Results 1 to 2 of 2

Thread: Show or Hide GroupBox on same button click

  1. #1
    Join Date
    Sep 2019
    Qt products

    Default Show or Hide GroupBox on same button click

    Hi user!
    i have a question.

    i am developing a software. For my question i have uploaded a picture. I want that when i click on the setup button the group box should be hidden and when i press setup button again then group box should be visible and so on, the same like Qt widget box.

    i am Writing my code like this:

    def show_hide_box(self):
    visible = True
    if self.pushButton.clicked:
    if visible == True:

    when i click the setup button the group box become hidden button when i click it the button again its does't work.

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 750 Times in 740 Posts
    Qt products
    Windows Android

    Default Re: Show or Hide GroupBox on same button click

    "self.pushButton.clicked" is a signal, not a status variable. This code probably doesn't even run.

    If you want to be notified when the user clicks one of the buttons, then you need to define a slot and connect it to the pushbutton's clicked() signal. In that slot, you check the value of your "visible" variable and show or hide the group box as appropriate. You don't actually need this variable - you can simply check to see if the group box is visible (groupBox_2.isVisible()).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 10
    Last Post: 20th April 2015, 23:24
  2. Replies: 2
    Last Post: 11th May 2012, 11:38
  3. How to show and hide Button when i created.
    By vudvpro in forum Qt Programming
    Replies: 4
    Last Post: 25th March 2011, 10:51
  4. Hide/show the Cancel button in a QProgressDialog
    By Vankata in forum Qt Programming
    Replies: 9
    Last Post: 24th February 2011, 21:43
  5. Show new window on button click
    By jojanpm in forum Newbie
    Replies: 1
    Last Post: 29th November 2010, 13:51


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.