Hi.

I have a new class called Piece, tried to inherit QLabel or QPushButton, everything is good, but once I try to set a parent (QWidget *container) its says

error: "void QWidget::setParent(QWidget*)' is inaccessible
void setParent(QWidget *parent);
^."

After see that QLabel wasn't working, tried with QPushButton and happened the same thing.

My Example Class:

Qt Code:
  1. #ifndef PIECE_H
  2. #define PIECE_H
  3. #include <QPushButton>
  4. #include <QMouseEvent>
  5.  
  6. class Piece : QPushButton{
  7. Q_OBJECT
  8. public:
  9. Piece();
  10.  
  11.  
  12. };
  13. #endif // PIECE_H
To copy to clipboard, switch view to plain text mode