Hello,

I'm very confused about the fact, that if I click (left mouse button) on a pushbutton, then the function connected via SLOT to the SIGNAL of pushbuttons is executed twice. Why? I want it to be executed only one time! How to avoid this behaviour?

I have created my GUI Framework by means of Qt Designer 4.5.1 and then connect the SLOTs automatically by the command "QMetaObject::connectSlotsByName(this);"

Here is the part of cpp code:

Qt Code:
  1. #include <iostream>
  2. #include <time.h>
  3.  
  4. #include <QtUiTools>
  5. #include <QtGui>
  6.  
  7. #include "mainframe.h"
  8. #include "Vertex.h"
  9. #include "graphicscene.h"
  10.  
  11. using namespace std;
  12.  
  13. mainFrame::mainFrame(QWidget *parent)
  14. : QMainWindow(parent)
  15. {
  16. ui.setupUi(this);
  17.  
  18. ui_pushButton_START = qFindChild<QPushButton*>(this, "pushButton_START");
  19. ui_pushButton_Select = qFindChild<QPushButton*>(this, "pushButton_Select");
  20. ui_pushButton_Recombine = qFindChild<QPushButton*>(this, "pushButton_Recombine");
  21.  
  22. /*
  23. connect(ui_pushButton_START, SIGNAL(clicked()), this, SLOT(on_pushButton_Recombine_clicked()));
  24. connect(ui_pushButton_Select, SIGNAL(clicked()), this, SLOT(on_pushButton_Select_clicked()));
  25. connect(ui_pushButton_Recombine, SIGNAL(clicked()), this, SLOT(on_pushButton_Recombine_clicked()));
  26. */
  27.  
  28. QMetaObject::connectSlotsByName(this);
To copy to clipboard, switch view to plain text mode 

and here a part of header file:

Qt Code:
  1. class mainFrame : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. mainFrame(QWidget *parent = 0);
  7. ~mainFrame();
  8.  
  9.  
  10.  
  11. // here the slots are declared, which are kind of sink for connected objects
  12. private slots:
  13. void on_pushButton_Quit_clicked();
  14. void updateParameters();
  15. void on_pushButton_START_clicked();
  16. void on_pushButton_Recombine_clicked();
  17. void on_pushButton_Select_clicked();
To copy to clipboard, switch view to plain text mode 

Help me please to avoid this failure function. Thank you.

best regards,

Vitali