PDA

View Full Version : can't create slot



jthacker
20th March 2010, 08:54
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::procFinished()'
error: collect2: ld returned 1 exit status



class MainWindow : public QMainWindow {
Q_OBJECT

public:

MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void procFinished();

protected:
void changeEvent(QEvent *e);

void showDate();
void showTime();
void timerEvent( QTimerEvent *e );

private:
void run(const char* cmd);

Ui::MainWindow *ui;


QProcess *proc;

private slots:

void on_pushButton_clicked();
void on_listWidget_clicked(QModelIndex index);

};



can anybody help me?


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

wysota
20th March 2010, 09:05
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...

Lykurg
20th March 2010, 09:05
rerun qmake and all should be fine. (In the menu clear all etc.)

jthacker
20th March 2010, 09:09
hi Lykurg
still error what to do?

jthacker
20th March 2010, 09:13
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.

wysota
20th March 2010, 12:06
But did you implement the slot?

squidge
20th March 2010, 16:31
Slots require code in both the .h and .cpp files. Paste the code you placed into the .cpp file.