[Qt-interest] Adding a paint event to a Designer widget

Andreas Pakulat apaku at gmx.de
Wed Dec 24 13:41:11 CET 2008


On 24.12.08 20:16:03, Phil wrote:
> On Tuesday 23 December 2008 21:45:50 Andreas Pakulat wrote:
> >
> > No it doesn't. Right-click on an existing widget in designer and choose
> > "promote to custom widget", that will allow to choose a name and header
> > file. So all you need to have is the header for the custom class available
> > when compiling the generated ui_foo.h file.
> >
> 
> Thank you for your time Andreas, I have always received excellent advice from 
> you.
> 
> Now that I have promoted the frame widget it is no longer displayed on the 
> main window. I think I understand why but I haven't been able to make the 
> frame display from my frame class.
> 
> The following compiles without error and the paint event is called so I think 
> I must be close to the answer.
> 
> #include "myframe.h"
> #include <QtDebug>
> 
> MyFrame::MyFrame(QWidget *parent)
>  : QFrame(parent)
> {
> /*
>   The following has been copied from ui_MainWindow.h.
>   Do I need something like this here?

No, that stuff simply belongs into the ui_MainWindow.h

I can't see any obvious error in the code you posted, so maybe post the
complete example so somebody else can try it out...

Andreas

-- 
A long-forgotten loved one will appear soon.

Buy the negatives at any price.



More information about the Qt-interest-old mailing list