PDA

View Full Version : QGroupBox problem: child controls not clickable



zulunation
19th September 2014, 12:52
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:



groupBox = new QGroupBox(centralwidget);
groupBox->setObjectName(QStringLiteral("groupBox"));
groupBox->setEnabled(true);
groupBox->setGeometry(QRect(50, 10, 271, 111));
groupBox->setMouseTracking(false);
groupBox->setFocusPolicy(Qt::NoFocus);
groupBox->setAcceptDrops(false);
groupBox->setFlat(false);
groupBox->setCheckable(false);
groupBox->setChecked(false);


Does the groupbox changes the messages to it's child controls?
What is the problem?
Thanks,

Rajesh.Rathod
19th September 2014, 13:25
Make sure your Z order is correct. call function on button to bring it on top of group box.

zulunation
19th September 2014, 14:04
Many thanks.

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

anda_skoa
19th September 2014, 14:29
That sounds like you are missing a layout somewhere or one or more widgets have not been added to their parent's layout.

Cheers,
_

wysota
19th September 2014, 16:19
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:



groupBox = new QGroupBox(centralwidget);
groupBox->setObjectName(QStringLiteral("groupBox"));
groupBox->setEnabled(true);
groupBox->setGeometry(QRect(50, 10, 271, 111));
groupBox->setMouseTracking(false);
groupBox->setFocusPolicy(Qt::NoFocus);
groupBox->setAcceptDrops(false);
groupBox->setFlat(false);
groupBox->setCheckable(false);
groupBox->setChecked(false);


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.

zulunation
19th September 2014, 18:46
wysota anda_skoa thanks,