qt 槽函数

来源:百度知道 编辑:UC知道 时间:2024/06/08 11:45:22
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QWidget>
namespace Ui
{
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

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

private:
Ui::MainWindow *ui;
private slots:
void on_comboBox_currentIndexChanged(const QString & text);
};

#endif // MAINWINDOW_H
不能定义

错误提示
C:/Documents and Settings/ys/My Documents/cssss/debug/moc_mainwindow.cpp:67: undefined reference to `MainWindow::on_comboBox_currentIndexChanged(QString const&)'
:-1: error: collect2: ld returned 1 exit status

很简单
你的头文件里有on_comboBox_currentIndexChanged(QString const&)的定义

但是你的C文件里没有对应的实现

所以链接的时候错了

没有include comboBox的头文件?
忘记差不多了。-_-~