View Full Version : buttonGroup and spinBox
mickey
20th May 2006, 15:01
Hi I connected bouttongroup0 (signal pressed (int)) to SLOT below. But the slot isn't called. In buttonGroup0 I inserted 3label an 3 spinbox and I arargnge them in a layout..
I'd like my slot recognze the buttonGruoupX from where the is started the change of value spinbox...thnaks.
void MainForm::lightPos(int val) {
printf("lightPos\n");
QButtonGroup* bgroup= (QButtonGroup*) sender();
if (bgroup == this->buttonGroup0)
printf("0 buttton group\n");
}
wysota
20th May 2006, 15:10
Can we see the connect statement?
mickey
20th May 2006, 17:09
I connect from designer:
wysota
20th May 2006, 17:14
Are you sure the signal gets emitted? Do you get any warnings on the console during run time?
mickey
20th May 2006, 17:17
nothing warning from console. Could the problem is the labels inside the button group (toghter the spinboxes)?
wysota
20th May 2006, 20:14
Hmm... clicking labels or spinboxes won't trigger the signal. It only works for buttons, because only QButtons (and its subclasses) can be associated with a button group (as the name suggests).
mickey
21st May 2006, 16:13
I dont' undertand: tried to do the same with another groupButton but doesn't work. It works if I connect each spinBoxes...
In myMainForm I coded (by hand) the same that I'd like now make from designer so
connect(buttonGroupE, SIGNAL(clicked(int)), this, SLOT (activeOption(int) ));
and this works!! What Am I wronging??
wysota
21st May 2006, 16:25
Compile your app in debug mode and check whether you get any warnings in the console (remember about CONFIG+=console if you need it) about those connect statements during runtime.
mickey
21st May 2006, 17:24
I'll trying this. But I inserted a button in side buttongroup together spinBox; if I click on pushButton the SLOT is called!!!WHile the spinboxes don't call the SLOT.....
wysota
21st May 2006, 17:50
I already told you why:
Hmm... clicking labels or spinboxes won't trigger the signal. It only works for buttons, because only QButtons (and its subclasses) can be associated with a button group (as the name suggests).
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.