I draw a polygon int the paintEvent of class A,and create class B based on A.
Now I want to fill the polygon of A in the paintEvent of B,how to do?
I draw a polygon int the paintEvent of class A,and create class B based on A.
Now I want to fill the polygon of A in the paintEvent of B,how to do?
Provide a virtual method in A that is called during paint event of A and reimplement that method in B.
Thk u for your answer.But My problem is still exists.
Now I paste my code on the page,
Qt Code:
//.h { Public }; class B:public A { public }; /*.cpp*/ A::A(); { /*Here,Draw a Polygon,but not filled.*/ } { } { painter.SetBrush(Qt::BrushStyle::SolidPattern); A::paintEvent(e); }To copy to clipboard, switch view to plain text mode
Why?
Last edited by weixj2003ld; 9th August 2011 at 15:22. Reason: sorry
Why what? This is not what I told you to do...
Qt Code:
//.h { public: protected: }; class B:public A { public: protected: p->setBrush(...); } }; /*.cpp*/ A::A(); { setupPainter(&p); p.draw.... } { }To copy to clipboard, switch view to plain text mode
Bookmarks