Hello everybody,
I tried to make a little Wrapper-Class for the QPushButton, where I need to gather the Signal clicked() from the Button and rout it to a new written slot called "DoCommand()".


But this slot is never called by the Button's clicked() signal.
The compiler, linker run well. The Application itself runs "well", so without this functionality I told^^

Here is the Headerfile:
Qt Code:
  1. #pragma once
  2.  
  3. #include <QtGui\qpushbutton.h>
  4.  
  5.  
  6.  
  7. class MenuButton : QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. MenuButton(std::string &title);
  12. ~MenuButton()
  13. {
  14. //delete pButton;
  15. }
  16.  
  17. std::string command;
  18.  
  19. QPushButton *pButton;
  20.  
  21. public slots:
  22. void DoCommand(void);
  23. };
To copy to clipboard, switch view to plain text mode 
And here the soure file:
Qt Code:
  1. #include "MenuButton.h"
  2. #include "../Kernel/ActionHandler.h"
  3.  
  4.  
  5. MenuButton::MenuButton(std::string &title) : QObject()
  6. {
  7. pButton = new QPushButton(title.c_str());
  8. pButton->setFixedSize(80, 45);
  9. //QAction *action = new QAction(title.c_str(), this);
  10. //action->connect(action, SIGNAL(triggered), this, SLOT(Clicked()));
  11. //pButton->addAction(action);
  12. bool success = QObject::connect(pButton, SIGNAL(clicked()), this, SLOT(DoCommand()));
  13. Q_UNUSED(success);
  14. Q_ASSERT(success);
  15. }
  16.  
  17.  
  18. void MenuButton::DoCommand(void)
  19. {
  20. LocalActionHandler->DoScript(command);
  21. LocalActionHandler->DoScript(QString("print \"DoCommand was called\""));
  22. }
To copy to clipboard, switch view to plain text mode 
Ehm, I forgott to say: success is always true in this case.

When I used an other slot from an other class' instance, for testing, everything worked well.


Does someone know what could be wrong ?
Maybe I made an stupid mistake anywhere..

Thanks a lot,


Matthias