On including a custom class widget, I'm getting the following errors. How do I fix this ?
Qt Code:
  1. C:\Qt\Qt5.0.2\5.0.2\msvc2010\include\QtCore\qdatetime.h:123: error: C2589: '(' : illegal token on right side of '::'
  2. C:\Qt\Qt5.0.2\5.0.2\msvc2010\include\QtCore\qdatetime.h:123: error: C2059: syntax error : '::'
To copy to clipboard, switch view to plain text mode 
My custom class looks like this -
Qt Code:
  1. //cbackbtnanime.h
  2. #ifndef CBACKBTNANIME_H
  3. #define CBACKBTNANIME_H
  4.  
  5. #include <QtGui>
  6. #include <QWidget>
  7. #include <QPushButton>
  8. #include <QHBoxLayout>
  9. #include <QStyleOption>
  10.  
  11. class CBackBtnAnime : public QWidget
  12. {
  13. Q_OBJECT
  14. private:
  15. QPushButton *backBtn;
  16. QHBoxLayout *hLyt;
  17. QPropertyAnimation * mAnimation;
  18.  
  19. public:
  20. explicit CBackBtnAnime(QWidget *parent = 0);
  21. protected:
  22. void paintEvent(QPaintEvent *pe)
  23. {
  24. Q_UNUSED(pe);
  25. o.initFrom(this);
  26. QPainter p(this);
  27. style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
  28. }
  29.  
  30. bool eventFilter(QObject * object, QEvent * event)
  31. {
  32. if((parent() == object) & (event->type() == QEvent::MouseMove))
  33. {
  34. QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event);
  35. if((mouseEvent->pos().x() < 50) && (mouseEvent->pos().y() < 30))
  36. {
  37. if(isHidden() && (mAnimation->state() != mAnimation->Running))
  38. {
  39. mAnimation->setStartValue(QRect(-2, 1, 0, 28));
  40. mAnimation->setEndValue(QRect(0, 1, 50, 28));
  41. disconnect(mAnimation, SIGNAL(finished()), this, SLOT(hide()));
  42. mAnimation->start();
  43. show();
  44. }
  45. }
  46. else if(mAnimation->state() != mAnimation->Running)
  47. {
  48. if(!isHidden())
  49. {
  50. mAnimation->setEndValue(QRect(-2, 1, 0, 28));
  51. mAnimation->setStartValue(QRect(0, 1, 50, 28));
  52. connect(mAnimation, SIGNAL(finished()), this, SLOT(hide()));
  53. mAnimation->start();
  54. }
  55. }
  56. }
  57.  
  58. if((event->type() == QEvent::Leave) && (mAnimation->state() != mAnimation->Running))
  59. {
  60. qDebug("Inside QEvent::Leave");
  61. if(!isHidden())
  62. {
  63. mAnimation->setEndValue(QRect(-2, 2, 0, 28));
  64. mAnimation->setStartValue(QRect(0, 2, 50, 28));
  65. connect(mAnimation, SIGNAL(finished()), this, SLOT(hide()));
  66. mAnimation->start();
  67. }
  68. }
  69.  
  70. return QWidget::eventFilter(object, event);
  71. }
  72.  
  73. signals:
  74. void backBtnClicked();
  75.  
  76. public slots:
  77.  
  78. };
  79. #endif // CBACKBTNANIME_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //cbackbtmanime.cpp
  2. #include "cbackbtnanime.h"
  3.  
  4. CBackBtnAnime::CBackBtnAnime(QWidget *parent) :
  5. QWidget(parent)
  6. {
  7. this->setMouseTracking(true);
  8. this->installEventFilter(this);
  9. this->setStyleSheet("background-color: #454545;");
  10. parent->installEventFilter(this);
  11. mAnimation = new QPropertyAnimation(this, "geometry");
  12. mAnimation->setDuration(250);
  13.  
  14. backBtn = new QPushButton(this);
  15. backBtn->setFixedSize(50, 28);
  16. backBtn->setIcon(QIcon(":/imgs/backToHome.png"));
  17. backBtn->setIconSize(QSize(50, 28));
  18. backBtn->setStyleSheet("QPushButton { background: transparent; border: 0px; border-radius: 20px; padding: 0px;}"
  19. "QPushButton:hover {background: transparent; border: 1px solid #4cd3f5;}"
  20. "QPushButton:pressed {background: transparent; border: 2px solid #4cd3f5;}"
  21. "QToolTip {background: white; color: black; }");
  22.  
  23. connect(backBtn, SIGNAL(clicked()), this, SIGNAL(backBtnClicked()));
  24.  
  25. hLyt = new QHBoxLayout();
  26. hLyt->setContentsMargins(0, 0, 0, 0);
  27. this->setLayout(hLyt);
  28. hLyt->addWidget(backBtn);
  29.  
  30. }
To copy to clipboard, switch view to plain text mode 

Kindly help me fix this issue. Thank you.