Results 1 to 4 of 4

Thread: Signals and Slots questions

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Signals and Slots questions

    1) I have 2 classes, first is MyForm, and second classTwo. MyForm have private object of type classTwo named objTwo - Is that a good idea? or better to create both of it in main.c as coexistent?

    2) In MyForm constructor I try to connect SIGNAL from MyForm to SLOT from classTwo - it's not working, why?
    Qt Code:
    1. connect(widget.buttonX, SIGNAL(clicked()), objTwo, SLOT(slotX(widget.edit->text())));
    To copy to clipboard, switch view to plain text mode 

    As a workaround I declared new SLOT in MyForm which call objTwo.slotX() - this way it works, but Im sure this is bad practice, or isn't it?

    The real problem comes when I want to connect SIGNAL from classTwo to MyForm class (in MyForm constructor). The only way I see is to cross include class headers, but I do want to make it properly, so obviously i miss something, as cross including is bad practice?

    I need to send something to classTwo from MyForm and then wait for signal to read answer back.

    Please help.
    Last edited by Janek; 29th December 2009 at 19:02.

Similar Threads

  1. Signals and Slots Problem
    By GenericProdigy in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2009, 09:06
  2. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  3. Problem with SpinBox signals and slots
    By ramstormrage in forum Newbie
    Replies: 4
    Last Post: 2nd May 2008, 01:45
  4. signals and slots in plugins
    By anderl in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2007, 13:57
  5. Signals and Slots question
    By Thoosle in forum Qt Programming
    Replies: 5
    Last Post: 5th December 2006, 00:24

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
  •  
Qt is a trademark of The Qt Company.