Results 1 to 11 of 11

Thread: Signals and Slots across different classes (Qt5 Version)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Signals and Slots across different classes (Qt5 Version)

    Quote Originally Posted by Ion View Post
    Ah thanks didn't see that. Ok implemented that however the same error is also occurring for Setvalue.
    Same mistake again. Parentheses.

    Cheers,
    _

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,318
    Thanks
    315
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Signals and Slots across different classes (Qt5 Version)

    Same mistake again. Parentheses.
    Yes, sorry. I haven't switched over to the Qt 5 style of connect(), so I goofed on the syntax. Should have been obvious C++ that the expression for the address of a member function doesn't contain parentheses.

    connect(counting, &counter::Increment_Count(10), ui->progressBar, &QProgressBar::setValue());
    In any case, even if you used the old SIGNAL() and SLOT() syntax for the connect() statement, you can't pass in a value as you apparently are trying to do here. The macros are simply the signature of the method with only the parameter types, no variable names or values. The return value is assumed to be void and is ignored anyway. So the equivalent SIGNAL / SLOT version of your connect() should be:

    Qt Code:
    1. connect(counting, SIGNAL( Increment_Count(int) ), ui->progressBar,SLOT( setValue(int) ));
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2014
    Posts
    11
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Signals and Slots across different classes (Qt5 Version)

    Ok brill thanks guys, yea I am very new to signal and slots so this was a bit of a crash course for me, so didn't want to bother learning the old method. Thanks guys

Similar Threads

  1. Replies: 2
    Last Post: 18th April 2013, 12:15
  2. Replies: 2
    Last Post: 29th June 2012, 09:32
  3. Accessing slots of other classes
    By papillon in forum Qt Programming
    Replies: 1
    Last Post: 14th January 2011, 06:24
  4. Signals/slots between classes
    By been_1990 in forum Qt Programming
    Replies: 19
    Last Post: 27th November 2009, 13:04
  5. Signals and Slots between 2 classes
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 31st March 2006, 00:34

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.