Results 1 to 4 of 4

Thread: Signal parameter - needed?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Location
    Auckland, NZ
    Posts
    121
    Thanks
    9
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Signal parameter - needed?

    I have the signals from a pushButton and a checkBox both connected to the same slot:

    connect(pushButton_redraw_dist_plots, SIGNAL(clicked()), this, SLOT(drawDistPlots()));
    connect(cbox_USE_LOGNORMAL_DIST, SIGNAL(stateChanged()), this, SLOT(drawDistPlots()));

    The pushButton signal does invoke drawDistPlots(), but the checkBox signal does not. I know that clicked() takes a bool argument, and stateChanged() takes an int argument, but I'm not sure if the arguments are needed. From what I observe, it seems that the clicked() signal functions without the argument, but apparently the stateChanged() signal does not. This seems odd. I am omitting the arguments because I don't know how to make drawDistPlots() take either a bool or an int argument. Is there a way to do what I want?

    Thanks
    Gib

    Edit:
    I decided to try making drawDistPlots() take a dummy int argument, then use these connect statements:

    connect(pushButton_redraw_dist_plots, SIGNAL(clicked(bool)), this, SLOT(drawDistPlots(int)));
    connect(cbox_USE_LOGNORMAL_DIST, SIGNAL(stateChanged(int)), this, SLOT(drawDistPlots(int)));

    This compiles (to my surprise), but the pushButton signal is not received.
    Last edited by gib; 18th October 2018 at 02:34.

Similar Threads

  1. Slot - Signal with parameter
    By Lodhart in forum Newbie
    Replies: 8
    Last Post: 10th April 2013, 10:08
  2. A Signal with Parameter from Qt C++ to QML
    By reinki0013 in forum Qt Quick
    Replies: 1
    Last Post: 8th November 2011, 13:12
  3. Replies: 3
    Last Post: 26th August 2011, 07:17
  4. Struggling with signal which has a default parameter.
    By JPNaude in forum Qt Programming
    Replies: 21
    Last Post: 21st January 2011, 08:40
  5. Replies: 2
    Last Post: 6th July 2009, 12:53

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.