Results 1 to 7 of 7

Thread: Passing an integer to a slot

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Passing an integer to a slot

    Hello, all;

    Does anyone know the best way to pass an integer to a slot? I'm currently having trouble doing so and am receiving a “no such slot” message when I run my program.
    It compiles and runs fine if I don't try to pass anything to it (i.e. declare it “void”), and even compiles when I do; it's only upon execution that I get the error message. Here are the relevant code snippets I'm using for the signal connection and slot in the .cpp file:

    Qt Code:
    1. int currentFreq1 = frequency_ch1_SB->value();
    2.  
    3. qDebug() << currentFreq1 << " Frequency value to pass to Start IO #1\n";
    4.  
    5. connect( taStartPB, SIGNAL( clicked() ), this, SLOT( startIO(currentFreq1) ));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void ConfigurationPage::startIO(int currentFreq1)
    2. {
    3. ...
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    ...and in the .h file, the slot is defined this way:

    Qt Code:
    1. class ConfigurationPage : public QWidget
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. ConfigurationPage(QWidget *parent = 0);
    7.  
    8. private slots:
    9. void startIO(int);
    10.  
    11. };
    To copy to clipboard, switch view to plain text mode 

    The specific error message I'm getting is: “No such slot ConfigurationPage::startIO(currentFreq1) in toneaud_pages.cpp:348
    ”. If anyone has any suggestions, I'd certainly appreciate it.

    Thanks,

    Allan
    Last edited by bizmopeen; 27th October 2009 at 22:03.

Similar Threads

  1. Passing values to custom 'slot' functions (pyqt)
    By Richie in forum Qt Programming
    Replies: 2
    Last Post: 7th September 2009, 07:05
  2. Replies: 12
    Last Post: 18th September 2008, 15:04
  3. passing arguments in SLOT
    By eleanor in forum Qt Programming
    Replies: 3
    Last Post: 3rd July 2008, 21:55
  4. Problem When Creating my own Slot
    By Fatla in forum Qt Programming
    Replies: 12
    Last Post: 6th June 2008, 14:44

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.