yoyega
23rd November 2009, 12:33
Hi all,
I am designing a dialog for which I need a label that changes some of its properties (color, text, etc...) according to some events. So I am subclassing QLabel in a class called VerdLabel to code the paintEvent function properly. The problem is that when I try to integrate this new class in QtCreator by promoting it from QLabel to VerdLabel the following error appears when compiling the code:
Ui_pruebas01Class::setupUi(QDialog*)’:
ui_pruebas01.h:105: error: no matching function for call to ‘VerdLabel::VerdLabel(QDialog*&)’
I am trying to use the following test code for the constructor:
VerdLabel::VerdLabel()
{
this->setText( "verdura" );
}
It looks like the 'Ui_pruebas01Class::setupUi(QDialog*)' is looking for a VerdLabel(QDialog*&) for the VerdLabel class but the constructor is defined as VerdLabel(), so I changed the code to:
VerdLabel::VerdLabel(QDialog *parent)
:QDialog(parent)
{
Q_D(QLabel);
d->init();
this->setText( "verdura" );
}
but in this case, the following error appears:
verdlabel.cpp: In constructor ‘VerdLabel::VerdLabel(QDialog*)’:
verdlabel.cpp:4: error: the type ‘QDialog’ is not a direct base of ‘VerdLabel’
So I don't know how to solve this, so if anybody can help me I would really appreciate it.
Thanks,
yoyega
I am designing a dialog for which I need a label that changes some of its properties (color, text, etc...) according to some events. So I am subclassing QLabel in a class called VerdLabel to code the paintEvent function properly. The problem is that when I try to integrate this new class in QtCreator by promoting it from QLabel to VerdLabel the following error appears when compiling the code:
Ui_pruebas01Class::setupUi(QDialog*)’:
ui_pruebas01.h:105: error: no matching function for call to ‘VerdLabel::VerdLabel(QDialog*&)’
I am trying to use the following test code for the constructor:
VerdLabel::VerdLabel()
{
this->setText( "verdura" );
}
It looks like the 'Ui_pruebas01Class::setupUi(QDialog*)' is looking for a VerdLabel(QDialog*&) for the VerdLabel class but the constructor is defined as VerdLabel(), so I changed the code to:
VerdLabel::VerdLabel(QDialog *parent)
:QDialog(parent)
{
Q_D(QLabel);
d->init();
this->setText( "verdura" );
}
but in this case, the following error appears:
verdlabel.cpp: In constructor ‘VerdLabel::VerdLabel(QDialog*)’:
verdlabel.cpp:4: error: the type ‘QDialog’ is not a direct base of ‘VerdLabel’
So I don't know how to solve this, so if anybody can help me I would really appreciate it.
Thanks,
yoyega