Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: Signal-slots connection problem.

  1. #21
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Signal-slots connection problem.

    Thanks jpn
    In the earlier version of the program I used the button group so I am familiar with it.

    I was able to put the buttons in a "group box" in designer, but it took up more screen height then with individual buttons and the 12 signal-slot are no problem.

    Thanks anyway

  2. #22
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Signal-slots connection problem.

    I'm starting to get the feeling that we are not understanding each other. We are talking about different things here.

    In Qt3 QButtonGroup is a widget. In Qt4 it's not a widget nor nothing visible. It's just a concept of grouping any set of buttons together as a functionality. The buttons can even have different parents, and it has nothing to do with how the buttons are actually laid out.

    The QButtonGroup example of mine was for Qt4. I wasn't talking about layouting or organizing the buttons in a form. I was talking about how to avoid those bunch of slots. It can be done with a single slot as the example was meant to present.
    J-P Nurmi

  3. #23
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Signal-slots connection problem.

    Maybe we are. I was unable to find "button group" in your post. The only thing besides the text was two ?? in the upper left corner of the screen.

    I'm a perverse old f... and not always wise, but you gave me good advise and some good information (can't use button groups in designer)

    As an 80 old engineer my main thrust is setting up a standard user interface suitable for a wide range of programs where a new user, who knows his/her field, can learn to use it in a day or so. I would like to have all screen functions in the designer or not use the designer at all.

    Thanks again, I really appreciate your help.

  4. #24
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Signal-slots connection problem.

    This is the "example" I have been referring to:
    Quote Originally Posted by jpn View Post
    Qt Code:
    1. QButtonGroup* grp = new QButtonGroup(this);
    2. grp->addButton(ui.pb1, 1);
    3. grp->addButton(ui.pb2, 2);
    4. ...
    5. grp->addButton(ui.pb12, 12);
    6. connect(grp, SIGNAL(buttonClicked(int)), this, SLOT(slotPb(int))
    7.  
    8. void PmForm::slotPb(int id)
    9. {
    10. ui.leZone->setText(QString("This is Pb%1").arg(id));
    11. }
    To copy to clipboard, switch view to plain text mode 
    Many people (especially the ones switching from Qt3 to Qt4) tend to criticize Qt Designer. In my humble opinion it's just a great tool for it's purpose, designing GUI layouts. I guess the main reason for not including QButtonGroup in Designer is because it's not a widget but a functionality class. The Designer is for designing layouts, you code the functionality.

    FAQ:
    Beginning with Qt4.0 Qt Designer seized to be an all-purpose development environment and became strictly a GUI Designer which can easily be incorporated into real IDEs like Visual Studio, Eclipse or KDevelop.
    According to this poll, most people on this forum still seem to be happy with and using the Designer.

    Anyway, there's a related entry in the Task Tracker: 126997 - Suggestion: QButtonGroup in Designer. Maybe in the future you can setup button groups from the Designer..

    I'd say it's not about the age but the passion. You're not too old as long as you have any personal interest into programming. Of course amnesia and such might make it harder but...
    J-P Nurmi

  5. #25
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Signal-slots connection problem.

    Philosophical reasons aside, what is the real difference betwee the 12 + lines of code to build the button group and the 12 signal-slots?

  6. #26
    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: Signal-slots connection problem.

    Quote Originally Posted by jpn View Post
    Anyway, there's a related entry in the Task Tracker: 126997 - Suggestion: QButtonGroup in Designer. Maybe in the future you can setup button groups from the Designer.
    I strongly doubt that (I haven't read the task-tracker entry though) as it will greatly limit the capabilities of the button group. Most people will not even look at the docs to see QButtonGroup is something more than what can be set from within Designer (i.e. adding buttons with different parents).

    Quote Originally Posted by impeteperry View Post
    what is the real difference betwee the 12 + lines of code to build the button group and the 12 signal-slots?
    Clarity of code, speed of execution and sanity of the person maintaining the code. And besides that such solution is less error prone.

  7. The following user says thank you to wysota for this useful post:

    impeteperry (23rd January 2007)

  8. #27
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Signal-slots connection problem.

    Hi mysota
    Understood
    thanks

Similar Threads

  1. Signal and slots
    By villy in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2007, 11:10
  2. connection problem
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 7th July 2006, 23:14
  3. Problem with signals and slots
    By conexion2000 in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2006, 11:20
  4. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 12:35
  5. Problem with Signal and Slots
    By Kapil in forum Installation and Deployment
    Replies: 2
    Last Post: 10th February 2006, 09:51

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.