PDA

View Full Version : Adding MyWidget to .ui from design



jeff28
16th August 2012, 16:36
So I am trying to make a SVGViewer. I have DisplayWidget and window classes (both with .h and .cpp files). Also a main method. What I would like to do is that add my DisplayWidget to my Window but from .ui files Design part. Can somebody help me please?( The similar example is here: http://doc.qt.nokia.com/4.7-snapshot/painting-svggenerator.html) If you look here you will see that window.h does not contain a DisplayWidget variable but in the window.cpp file it uses the displayWidget variable to update both background and shape. When I write the same thing I get the error of : displayWidget is not declared in the scope (for update Background and Shape)

Added after 30 minutes:

I tried to promote the widget but I cant click on the Promote button.

yeye_olive
16th August 2012, 17:12
You need to add a plain QWidget to your UI in Designer and promote it to DisplayWidget. See here (http://doc.qt.nokia.com/4.8/designer-using-custom-widgets.html) for details.

jeff28
17th August 2012, 08:48
Thank you very much you just made my day