-2

When i try to add a delegate file in my project, there is something wrong with my codes. I don't know why. My operations are as below. My operation

MyDelegate.h

And the tutorial is as following:

    #ifndef MYDELEGATE_H
#define MYDELEGATE_H

#include <QItemDelegate>

class MyDelegate : public QItemDelegate
{
    Q_OBJECT
public:
    explicit MyDelegate(QObject *parent = 0);

signals:

    public slots;

};

#endif // MYDELEGATE_H

What is wrong with my file setting? Why do I lose the QObject *parent

Hui Ding
  • 1
  • 1

1 Answers1

1

This is specific of Qt Creator, so use your hands and complete class yourself, it's simple.

UPD:

When you change a base class in class constructor of Qt Creator you can just write from which class you want to inherit and Qt Creator do this. But what class (file) you want to include - this is hardcoded: QObject, QWidget, QMainWindow, QDeclarativeItem, QQuickItem, QSharedData.

Shtol Krakov
  • 1,260
  • 9
  • 20
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/12493950) – Mike May 27 '16 at 12:27
  • @Mike, but this is the answer. I updated post, my apologies. – Shtol Krakov May 27 '16 at 12:41