Q_D 매크로를 사용하여 파생 클래스에서 d- 포인터를 사용하고 싶습니다.qt 개인 클래스에서 불완전한 형식을 잘못 사용했습니다.
class DIGIKAM_EXPORT GraphicsDImgView : public QGraphicsView
{
Q_OBJECT
public:
class GraphicsDImgViewPrivate;
protected:
GraphicsDImgViewPrivate* const d_ptr;
protected:
Q_DECLARE_PRIVATE(GraphicsDImgView)
};
내 GraphicsDImgViewPrivate 클래스 : 여기
내 부모 클래스입니다class GraphicsDImgView::GraphicsDImgViewPrivate
{
public:
GraphicsDImgViewPrivate()
{
scene = 0;
item = 0;
layout = 0;
cornerButton = 0;
panIconPopup = 0;
movingInProgress = false;
showText = true;
}
QGraphicsScene* scene;
GraphicsDImgItem* item;
SinglePhotoPreviewLayout* layout;
QToolButton* cornerButton;
KPopupFrame* panIconPopup;
QPoint mousePressPos;
QPoint panningScrollPos;
bool movingInProgress;
bool showText;
};
GraphicsDImgView::GraphicsDImgView(QWidget* const parent)
: QGraphicsView(parent), d_ptr(new GraphicsDImgViewPrivate)
{
Q_D(GraphicsDImgView);
d->scene = new QGraphicsScene(this);
d->scene->setItemIndexMethod(QGraphicsScene::NoIndex);
setScene(d->scene);
d->layout = new SinglePhotoPreviewLayout(this);
d->layout->setGraphicsView(this);
}
과 에서 나는 D-포인터를 사용하고자하는 나는 방법을 쓰기 클래스를 파생 GraphicsDImg보기 :
bool ImageRegionWidget::movingInProgress()
{
Q_D(GraphicsDImgView);
return d->movingInProgress;
}
howev 어 빌드 나에게
graphicsdimgview.h:128:11: error: forward declaration of ‘class GraphicsDImgView::GraphicsDImgViewPrivate’
In member function ‘bool Digikam::ImageRegionWidget::movingInProgress()’:...path.... error: invalid use of incomplete type ‘class GraphicsDImgView::GraphicsDImgViewPrivate’
및
나는 내가 잘못 어디로 갔는지 그래서 나도 몰라 정확히 문서를 다음에 다음과 같은 오류 메시지를 제공합니다. 어쩌면 내가 부주의한지도 모르겠다. 제 실수를 지적하겠습니다. 감사합니다 :)
, 전체 코드를 보여주십시오. 'GraphicsDImgViewPrivate'의 선언과 포함 순서에 오류가있는 것으로 보입니다. 또한 ... 당신을위한 "속성"은 무엇입니까? –
죄송합니다. 나는 그들을 바로 잡을 것입니다 ... – wceo