sebastian.f
24th June 2009, 15:30
Hello,
I have a form with a few widgets.
When a button is pressed the form calls a function, that is pretty much it. However, whenever I click the button the on_clicked slot is called twice.
I know this is the case because in trying to track down the source of the problem of multiple messages from my little program I put a break point on the function inside the on_clicked slot, and sure enough, I click the button and it is reached twice in quick succession.
#include "generatedfiles/ui_form.h"
void send_msg(char* );
void reconnect();
class formui : public QWidget, public Ui::Form
{
Q_OBJECT
public:
formui(QWidget* parent = 0) : QWidget(parent) {
setupUi(this);
QMetaObject::connectSlotsByName(this);
}
public slots:
void on_pushButton_clicked()
{
send_msg( lineEdit->toPlainText().toUtf8().data() );
}
void on_pushButton_2_clicked()
{
reconnect();
}
};
That above is from my forms header file, that really is it! How can it be going wrong? :(
PS. It seems both the buttons slots are called twice.
I have a form with a few widgets.
When a button is pressed the form calls a function, that is pretty much it. However, whenever I click the button the on_clicked slot is called twice.
I know this is the case because in trying to track down the source of the problem of multiple messages from my little program I put a break point on the function inside the on_clicked slot, and sure enough, I click the button and it is reached twice in quick succession.
#include "generatedfiles/ui_form.h"
void send_msg(char* );
void reconnect();
class formui : public QWidget, public Ui::Form
{
Q_OBJECT
public:
formui(QWidget* parent = 0) : QWidget(parent) {
setupUi(this);
QMetaObject::connectSlotsByName(this);
}
public slots:
void on_pushButton_clicked()
{
send_msg( lineEdit->toPlainText().toUtf8().data() );
}
void on_pushButton_2_clicked()
{
reconnect();
}
};
That above is from my forms header file, that really is it! How can it be going wrong? :(
PS. It seems both the buttons slots are called twice.