Results 1 to 7 of 7

Thread: can't create slot

  1. #1
    Join Date
    Mar 2010
    Location
    Ahmedabad, Gujarat
    Posts
    35
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default can't create slot

    hi guys,

    i'm working on a program in this i have ui form.
    on the form i have created 9 app icons using list widget.
    now i want to create a public slot in class QMainWindow
    but when i wite the prototype of slot and build the project it gives me error
    public slot:
    void procFinished();

    undefined reference to `MainWindow:rocFinished()'
    error: collect2: ld returned 1 exit status

    Qt Code:
    1. class MainWindow : public QMainWindow {
    2. Q_OBJECT
    3.  
    4. public:
    5.  
    6. MainWindow(QWidget *parent = 0);
    7. ~MainWindow();
    8. public slots:
    9. void procFinished();
    10.  
    11. protected:
    12. void changeEvent(QEvent *e);
    13.  
    14. void showDate();
    15. void showTime();
    16. void timerEvent( QTimerEvent *e );
    17.  
    18. private:
    19. void run(const char* cmd);
    20.  
    21. Ui::MainWindow *ui;
    22.  
    23.  
    24. QProcess *proc;
    25.  
    26. private slots:
    27.  
    28. void on_pushButton_clicked();
    29. void on_listWidget_clicked(QModelIndex index);
    30.  
    31. };
    To copy to clipboard, switch view to plain text mode 

    can anybody help me?


    note: i'm using Qt Creator 1.3.1 based on Qt 4.6.2

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: can't create slot

    You probably forgot to implement the slot. Maybe you wanted it to be a signal and not a slot? The name seems to suggest so...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: can't create slot

    rerun qmake and all should be fine. (In the menu clear all etc.)

  4. #4
    Join Date
    Mar 2010
    Location
    Ahmedabad, Gujarat
    Posts
    35
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: can't create slot

    hi Lykurg
    still error what to do?
    Last edited by jthacker; 20th March 2010 at 09:17.

  5. #5
    Join Date
    Mar 2010
    Location
    Ahmedabad, Gujarat
    Posts
    35
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: can't create slot

    hi Wysota

    ya name seems like a signal

    but i have created a process using QProcess object and when it finishes i want to call this slot.
    without wriiten anything in public slot:
    it works fine but when i write void procFinished(); in public slot:
    it is giving error that i mentioned.
    Last edited by jthacker; 20th March 2010 at 09:17.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: can't create slot

    But did you implement the slot?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can't create slot

    Slots require code in both the .h and .cpp files. Paste the code you placed into the .cpp file.

Similar Threads

  1. Replies: 1
    Last Post: 22nd January 2010, 11:22
  2. create a custom slot, hints?
    By pledians in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2008, 14:26
  3. How to create Custom Slot upon widgets
    By ashukla in forum Qt Programming
    Replies: 6
    Last Post: 8th September 2007, 14:07
  4. how to create new slot
    By nimmyj in forum Qt Tools
    Replies: 2
    Last Post: 15th December 2006, 10:54
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 20:46

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.