npatil15
10th December 2019, 04:59
Hello,
I'm trying as shown below,
We already have this,
class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
{
//Standard Class
protected:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
}
class Q_WIDGETS_EXPORT QTabWidget : public QWidget
{
//Standard Class
}
Now below, I'm trying to access virtual methods from QWidget, but I'm unable to do that, may be I'm missing some simple basics behind it.
class MyWidget : public QTabWidget
{
Q_OBJECT
public:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
}
void MyWidget::focusInEvent(QFocusEvent *event)
{
qDebug()<<"focusInEvent";
QWidget::focusInEvent(event);
}
void MyWidget::focusOutEvent(QFocusEvent *event)
{
qDebug()<<"focusOutEvent";
QWidget::focusOutEvent(event);
}
I can access virtual methods from QTabWidget but not from QWidget, please give me suggestions on what I'm mistaking here?
Or its protected, that why I'm unable to access it, is there any way to access such protected methods?
Thanks :)
I'm trying as shown below,
We already have this,
class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
{
//Standard Class
protected:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
}
class Q_WIDGETS_EXPORT QTabWidget : public QWidget
{
//Standard Class
}
Now below, I'm trying to access virtual methods from QWidget, but I'm unable to do that, may be I'm missing some simple basics behind it.
class MyWidget : public QTabWidget
{
Q_OBJECT
public:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
}
void MyWidget::focusInEvent(QFocusEvent *event)
{
qDebug()<<"focusInEvent";
QWidget::focusInEvent(event);
}
void MyWidget::focusOutEvent(QFocusEvent *event)
{
qDebug()<<"focusOutEvent";
QWidget::focusOutEvent(event);
}
I can access virtual methods from QTabWidget but not from QWidget, please give me suggestions on what I'm mistaking here?
Or its protected, that why I'm unable to access it, is there any way to access such protected methods?
Thanks :)