PDA

View Full Version : Inherit and Overwrite signals



shaselsc
9th October 2006, 15:24
Alright, I'm working on a Qt project using C++ compiling with mingw on a windows machine. What I'm trying to do is to create a new QListWidget that takes the signal currentItemChange and make it do something other than the default behavior. Right now I created a class that inherits QListWidget and just redeclared the signal, but it seems that is not a possibility. I get an error in the moc code file saying that it's already been declared.

Am I thinking about this right? Basically all I'm trying to do is to grab the signal and use it. Any help would be appreciated.

Thanks ahead of time.

jpn
9th October 2006, 15:39
Right now I created a class that inherits QListWidget and just redeclared the signal, but it seems that is not a possibility. I get an error in the moc code file saying that it's already been declared.
Yes, it's not possible to override signals.



Basically all I'm trying to do is to grab the signal and use it. Any help would be appreciated.

So you could just connect your custom slot (in the subclass) to the signal declared and emitted by the base class.