I have subclassed QComboBox to customize it for special needs. The subclass is used to promote QComboBoxes in a ui file from QtDesigner. Everything works except that when I put a break point in a slot, the program does not stop at the breakpoint. I do however know that it is being called from the result it generates. I checked other slots in my program and they work fine with breakpoints. Doing a clean and rebuild all did not fix it. What could be causing this and is there anything I can do about it? The slot in question is the only one in the subclass and is called "do_indexChanged()". You can find the slot on line 37 of the class header below and the signal-slot connection on line 10 of the class source file.

CLASS HEADER:

Qt Code:
  1. #ifndef WVQCOMBOBOX_H
  2. #define WVQCOMBOBOX_H
  3.  
  4. #include <QWidget>
  5. #include <QObject>
  6. #include <QComboBox>
  7. #include <QVariant>
  8.  
  9.  
  10.  
  11. class wvQComboBox : public QComboBox
  12. {
  13. Q_OBJECT
  14. //Q_PROPERTY(bool writeEnable READ writeEnable WRITE setWriteEnable)
  15. public:
  16. explicit wvQComboBox(QWidget *parent = 0);
  17. bool writeEnable() {
  18. return this->property("writeEnable").toBool();
  19. }
  20. void setWriteEnable(const bool & writeEnable){
  21. this->setProperty("writeEnable",writeEnable);
  22. }
  23.  
  24. bool newValReady() {
  25. return this->property("newValReady").toBool();
  26. }
  27. void setNewValReady(const bool & newValReady){
  28. this->setProperty("newValReady",newValReady);
  29. }
  30. QString getNewVal();
  31. int getNewValIndex();
  32.  
  33.  
  34.  
  35. int oldVal; //comboBox Index before user edit began
  36. private slots:
  37. void do_indexChanged(){
  38. this->setWriteEnable(true);
  39. if(oldVal!=currentIndex()){
  40. this->setNewValReady(true);
  41. oldVal=currentIndex();
  42. }
  43. }
  44.  
  45. protected:
  46. void focusInEvent ( QFocusEvent * event );
  47. //void focusOutEvent ( QFocusEvent * event );//dont need because of currentIndexChanged(int)
  48. };
  49.  
  50. #endif // WVQCOMBOBOX_H
To copy to clipboard, switch view to plain text mode 


CLASS SOURCE
Qt Code:
  1. #include "wvqcombobox.h"
  2.  
  3. wvQComboBox::wvQComboBox(QWidget *parent) :
  4. QComboBox(parent)
  5. {
  6. this->setWriteEnable(true);
  7. this->setNewValReady(false);
  8. oldVal=this->currentIndex();
  9.  
  10. connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(do_indexChanged()));
  11. }
  12.  
  13. void wvQComboBox::focusInEvent ( QFocusEvent * event ) {
  14. this->setWriteEnable(false);
  15. oldVal=this->currentIndex();
  16. }
  17.  
  18.  
  19. QString wvQComboBox::getNewVal(){
  20. setNewValReady(false);
  21. return this->currentText();
  22. }
  23.  
  24. int wvQComboBox::getNewValIndex(){
  25. setNewValReady(false);
  26. return this->currentIndex();
  27. }
To copy to clipboard, switch view to plain text mode