Results 1 to 10 of 10

Thread: buttonGroup and spinBox

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default buttonGroup and spinBox

    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.
    Qt Code:
    1. void MainForm::lightPos(int val) {
    2. printf("lightPos\n");
    3. QButtonGroup* bgroup= (QButtonGroup*) sender();
    4. if (bgroup == this->buttonGroup0)
    5. printf("0 buttton group\n");
    6. }
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    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: buttonGroup and spinBox

    Can we see the connect statement?

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: buttonGroup and spinBox

    I connect from designer:
    Attached Images Attached Images
    Regards

  4. #4
    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: buttonGroup and spinBox

    Are you sure the signal gets emitted? Do you get any warnings on the console during run time?

  5. #5
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: buttonGroup and spinBox

    nothing warning from console. Could the problem is the labels inside the button group (toghter the spinboxes)?
    Regards

  6. #6
    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: buttonGroup and spinBox

    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).

  7. #7
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: buttonGroup and spinBox

    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
    Qt Code:
    1. connect(buttonGroupE, SIGNAL(clicked(int)), this, SLOT (activeOption(int) ));
    To copy to clipboard, switch view to plain text mode 
    and this works!! What Am I wronging??
    Regards

  8. #8
    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: buttonGroup and spinBox

    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.

  9. #9
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: buttonGroup and spinBox

    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.....
    Regards

  10. #10
    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: buttonGroup and spinBox

    I already told you why:

    Quote Originally Posted by wysota
    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).

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.