1. 程式人生 > >Qt中虛擬函式不能例項化解決

Qt中虛擬函式不能例項化解決

voiddrawComplexControl(ComplexControlcontrol,
constQStyleOptionComplex*option,
QPainter*painter,constQWidget*widget=0)const=0;

error: C2259: “CustomStyle”: 不能例項化抽象類

由於下列成員:

“void CustomStyle::drawComplexControl(QStyle::ComplexControl,const QStyleOptionComplex *,QPainter *,const QWidget *) const”: 是抽象的

宣告如下:

voiddrawComplexControl(ComplexControlcontrol,
constQStyleOptionComplex*option,
QPainter*painter,constQWidget*widget=0)const;