Ratheendrans
25th August 2010, 15:38
Hi want to add a new Q_PROPERY into my subclass and use this in my application.
I tried the following test programe.
Scenario 1:
1. created the following class as a subclass of QPushButton.
class eSSlButton:public QPushButton
{
Q_OBJECT
// Q_PROPERTY(char val READ getVal)
public:
eSSlButton(QWidget * parent = 0);
~eSSlButton();
void keyPressEvent( QKeyEvent *e );
};
definition for the above class
eSSlButton::eSSlButton(QWidget * parent):QPushButton(parent)
{
}
void eSSlButton::keyPressEvent( QKeyEvent *e )
{
printf("In side dbasbd %c %x\n",QObject::property("val").toChar(),e->key());
}
eSSlButton::~eSSlButton()
{
}
2. Now added the properties 'val' as char type from property window of Qt Designer.
3. Now when I run the executable it gives a segmentation fault.
Kindly let me know how to set the dynamic property for the subclass with the help of QT Designer.
Thanks in Advance
I tried the following test programe.
Scenario 1:
1. created the following class as a subclass of QPushButton.
class eSSlButton:public QPushButton
{
Q_OBJECT
// Q_PROPERTY(char val READ getVal)
public:
eSSlButton(QWidget * parent = 0);
~eSSlButton();
void keyPressEvent( QKeyEvent *e );
};
definition for the above class
eSSlButton::eSSlButton(QWidget * parent):QPushButton(parent)
{
}
void eSSlButton::keyPressEvent( QKeyEvent *e )
{
printf("In side dbasbd %c %x\n",QObject::property("val").toChar(),e->key());
}
eSSlButton::~eSSlButton()
{
}
2. Now added the properties 'val' as char type from property window of Qt Designer.
3. Now when I run the executable it gives a segmentation fault.
Kindly let me know how to set the dynamic property for the subclass with the help of QT Designer.
Thanks in Advance