breakpoint inside QComboBox subclass not working
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:
Code:
#ifndef WVQCOMBOBOX_H
#define WVQCOMBOBOX_H
#include <QWidget>
#include <QObject>
#include <QComboBox>
#include <QVariant>
{
Q_OBJECT
//Q_PROPERTY(bool writeEnable READ writeEnable WRITE setWriteEnable)
public:
explicit wvQComboBox
(QWidget *parent
= 0);
bool writeEnable() {
return this->property("writeEnable").toBool();
}
void setWriteEnable(const bool & writeEnable){
this->setProperty("writeEnable",writeEnable);
}
bool newValReady() {
return this->property("newValReady").toBool();
}
void setNewValReady(const bool & newValReady){
this->setProperty("newValReady",newValReady);
}
int getNewValIndex();
int oldVal; //comboBox Index before user edit began
private slots:
void do_indexChanged(){
this->setWriteEnable(true);
if(oldVal!=currentIndex()){
this->setNewValReady(true);
oldVal=currentIndex();
}
}
protected:
//void focusOutEvent ( QFocusEvent * event );//dont need because of currentIndexChanged(int)
};
#endif // WVQCOMBOBOX_H
CLASS SOURCE
Code:
#include "wvqcombobox.h"
wvQComboBox
::wvQComboBox(QWidget *parent
) :{
this->setWriteEnable(true);
this->setNewValReady(false);
oldVal=this->currentIndex();
connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(do_indexChanged()));
}
void wvQComboBox
::focusInEvent ( QFocusEvent * event
) { this->setWriteEnable(false);
oldVal=this->currentIndex();
}
setNewValReady(false);
return this->currentText();
}
int wvQComboBox::getNewValIndex(){
setNewValReady(false);
return this->currentIndex();
}
Re: breakpoint inside QComboBox subclass not working
Are you sure the connect returns true? If I remember correctly, signals and slots have to have the same parameter lists.
Re: breakpoint inside QComboBox subclass not working
Quote:
Originally Posted by
steno
Are you sure the connect returns true? If I remember correctly, signals and slots have to have the same parameter lists.
yes I have tried with the same signature and it gives the same result. Also I am 100% sure the connect returns true.
Re: breakpoint inside QComboBox subclass not working
Which line in the slot are you marking with the breakpoint?
Re: breakpoint inside QComboBox subclass not working
Quote:
Originally Posted by
ChrisW67
Which line in the slot are you marking with the breakpoint?
I actually marked them all.
Re: breakpoint inside QComboBox subclass not working
Long shot here... have you tried moving the do_indexChanged() implementation in to the cpp file rather than the header?
Re: breakpoint inside QComboBox subclass not working
Quote:
Originally Posted by
ChrisW67
Long shot here... have you tried moving the do_indexChanged() implementation in to the cpp file rather than the header?
it worked thanks!