[Qt-interest] QPushButton can not be connected

Matthias Pospiech matthias.pospiech at gmx.de
Sat Jul 24 19:32:36 CEST 2010


I get the error:
error: no matching function for call to 
'DialogMicosController::connect(QPushButton*&, const char*)'
note: candidates are: static bool QObject::connect(const QObject*, const 
char*, const QObject*, const char*, Qt::ConnectionType)
note:                 bool QObject::connect(const QObject*, const char*, 
const char*, Qt::ConnectionType) const

but in my code it is just a QPushButton  in the ui, which definitely 
should be derived from QObject.

The class looks like this:

---------------------->
#ifndef DIALOGMICOSCONTROLLER_H
#define DIALOGMICOSCONTROLLER_H

#include <QDialog>

namespace Ui {
    class DialogMicosController;
}

class QMicosPolluxController;

class DialogMicosController : public QDialog
{
    Q_OBJECT
public:
    DialogMicosController(QWidget *parent = 0);
    ~DialogMicosController();

private:
    void connectSignalSlots();
    void initValues();

private slots:
    void OnPushButtonCloseClicked();
    void OnControllerError(QString error);

private:
    Ui::DialogMicosController *ui;
};

#endif // DIALOGMICOSCONTROLLER_H
<----------------------

as one can see it is only derived once by QDialog from a QObject.

the connect itself looks like this:
---------------------->
DialogMicosController::DialogMicosController(QWidget *parent)
    :   QDialog(parent)
    ,   ui(new Ui::DialogMicosController)
    ,   controller(new QMicosPolluxController)
{
    ui->setupUi(this);
    initValues();
    connectSignalSlots();
}

void DialogMicosController::connectSignalSlots()
{
    connect(controller, SIGNAL(errorOccurred(QString)), this, 
SLOT(OnControllerError(QString)));
    connect(ui->pushButtonClose, SIGNAL(clicked())), this, 
SLOT(OnPushButtonCloseClicked());
}
<----------------------

What am I doing wrong?

Matthias



More information about the Qt-interest-old mailing list