Here is small test app, try if you can use this class in python interpreter, and in regular build:
// Test.h
#include <QtGui>
#include <QDebug>
Q_OBJECT
public:
setObjectName("test");
btn->setObjectName("button");
connect(btn,SIGNAL(clicked()), this, SLOT(test()));
this->dumpObjectInfo();
}
~Test(){
delete btn;
}
public slots:
void test(){
qDebug() << "clicked";
}
};
// Test.h
#include <QtGui>
#include <QDebug>
class Test : public QObject{
Q_OBJECT
public:
Test( QObject * parent = NULL ) : QObject(parent){
setObjectName("test");
btn = new QPushButton();
btn->setObjectName("button");
connect(btn,SIGNAL(clicked()), this, SLOT(test()));
this->dumpObjectInfo();
}
~Test(){
delete btn;
}
QPushButton * btn;
public slots:
void test(){
qDebug() << "clicked";
}
};
To copy to clipboard, switch view to plain text mode
// main.cpp
#include <QApplication>
#include "Test.h"
int main( int argc, char ** argv ){
Test t; t.btn->show();
return app.exec();
}
// main.cpp
#include <QApplication>
#include "Test.h"
int main( int argc, char ** argv ){
QApplication app(argc,argv);
Test t; t.btn->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
// Test.pro
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
SOURCES += main.cpp
HEADERS += Test.h
// Test.pro
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
SOURCES += main.cpp
HEADERS += Test.h
To copy to clipboard, switch view to plain text mode
Here is the output for dumpObjectInfo for this class:
OBJECT Test::test
SIGNALS OUT
<None>
SIGNALS IN
<-- QPushButton::button clicked()
As you can see, the button is connected with "clicked()" signal.
Try it and post your results, from python-interpreter, and "normal" application.
Bookmarks