Results 1 to 6 of 6

Thread: QGroupBox problem: child controls not clickable

  1. #1
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default QGroupBox problem: child controls not clickable

    Hi all,

    I'm using Qt5 static build from sources on Windows XP. The QT Creator is 3.2.1.

    I have added button on main window. Then i add QGroupBox around it.
    The group box is enabled initially and not checkable.
    I can't click it with the mouse. Only with the keyboard when button has focus.

    I made the GroupBox to split the button in the middle.
    The part which is covered with group box is not clickable.
    There is enable attribute in .ui file.
    The .h file contains the following:

    Qt Code:
    1. groupBox = new QGroupBox(centralwidget);
    2. groupBox->setObjectName(QStringLiteral("groupBox"));
    3. groupBox->setEnabled(true);
    4. groupBox->setGeometry(QRect(50, 10, 271, 111));
    5. groupBox->setMouseTracking(false);
    6. groupBox->setFocusPolicy(Qt::NoFocus);
    7. groupBox->setAcceptDrops(false);
    8. groupBox->setFlat(false);
    9. groupBox->setCheckable(false);
    10. groupBox->setChecked(false);
    To copy to clipboard, switch view to plain text mode 

    Does the groupbox changes the messages to it's child controls?
    What is the problem?
    Thanks,
    Last edited by zulunation; 19th September 2014 at 11:57.

  2. #2
    Join Date
    Apr 2012
    Location
    India.
    Posts
    88
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGroupBox problem: child controls not clickable

    Make sure your Z order is correct. call function on button to bring it on top of group box.

  3. #3
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGroupBox problem: child controls not clickable

    Many thanks.

    ui.pushButton->raise(); fixed the problem

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGroupBox problem: child controls not clickable

    That sounds like you are missing a layout somewhere or one or more widgets have not been added to their parent's layout.

    Cheers,
    _

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGroupBox problem: child controls not clickable

    Quote Originally Posted by zulunation View Post
    Hi all,

    I'm using Qt5 static build from sources on Windows XP. The QT Creator is 3.2.1.

    I have added button on main window. Then i add QGroupBox around it.
    The group box is enabled initially and not checkable.
    I can't click it with the mouse. Only with the keyboard when button has focus.

    I made the GroupBox to split the button in the middle.
    The part which is covered with group box is not clickable.
    There is enable attribute in .ui file.
    The .h file contains the following:

    Qt Code:
    1. groupBox = new QGroupBox(centralwidget);
    2. groupBox->setObjectName(QStringLiteral("groupBox"));
    3. groupBox->setEnabled(true);
    4. groupBox->setGeometry(QRect(50, 10, 271, 111));
    5. groupBox->setMouseTracking(false);
    6. groupBox->setFocusPolicy(Qt::NoFocus);
    7. groupBox->setAcceptDrops(false);
    8. groupBox->setFlat(false);
    9. groupBox->setCheckable(false);
    10. groupBox->setChecked(false);
    To copy to clipboard, switch view to plain text mode 

    Does the groupbox changes the messages to it's child controls?
    What is the problem?
    Thanks,
    You should not "add groupbox around the button" but rather put the button in the groupbox (first place the groupbox in the form and then place a button inside). What you have right now is that the button and the groupbox are siblings rather than forming a parent-child relation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGroupBox problem: child controls not clickable

    wysota anda_skoa thanks,

Similar Threads

  1. Problem in accessing groupbox controls.
    By vani.pv in forum Newbie
    Replies: 2
    Last Post: 7th September 2012, 08:05
  2. Problem with styled QPushButton clickable area
    By koan in forum Qt Programming
    Replies: 4
    Last Post: 19th July 2011, 22:48
  3. QGroupBox enabling problem
    By Annihilator in forum Newbie
    Replies: 10
    Last Post: 16th April 2010, 16:58
  4. QGroupBox size problem
    By MarkoSan in forum Newbie
    Replies: 2
    Last Post: 22nd November 2009, 18:44
  5. Hiding controls changes spacing of other controls
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2007, 20:47

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.