Drawing on a widget created via QDesigner
I know how to draw a picture on a QMainWindow via QPainter:
QPainter painter(this).
But, after creating a QFrame (named frame_1) via QDesigner, how to implement the paintEvent in order to make it working with my QFrame ?
In short, I would like to point to my QFrame, not the default (this) QMainWindow.
I have not seen any code from Google or from this forum, since QDesigner is not very used.
By advance, thank you for any help.http://www.qtcentre.org/forum/images/icons/icon3.gif
Jean (a novice, of course).
Re: Drawing on a widget created via QDesigner
you can install event filter for your QFrame object and then handle its QPaintEvent.
Re: Drawing on a widget created via QDesigner
Create a QFrame subclass and promote it in designer.
Re: Drawing on a widget created via QDesigner
Thanks for these 2 answers.
My knowledge of C++ processes is still poor (I come from Delphi), but I presume that subclassing would be faster than using an eventFilter. Am I right ?
In fact, I tryed both them, without anay results.:crying:
I red the <promote> URL pointed by JPN, but I understood that promoting is only when you want to customize a widget. The widget is created within QDesigner (an .ui file) but I don't know of to double inherit a QFram object and an object still created with QDesigner.
Could be more explicit ?
Thank you by advance.
Jean.
Re: Drawing on a widget created via QDesigner
Re: Drawing on a widget created via QDesigner
Thank you !
Now, I have a little bit understand the process. And it works.
Jean.