0

I have designed a QWidget based QtDesigner ui form. Lets call it Form1. I added few pushbuttons and labels in it. Now I designed another QWidget based qt ui designer form.Lets call it Form2. I have a QFrame in Form 2 in which I would like to load Form1.

I did some reading and I found that I could right click on QFrame and choose promote to. I put the base class as QFrame. Promoted class name as Form1. Header file as form1.h.

I get errors now saying:

Form1 has no member named 'setFrameShape'
Form1 has no member named 'setFrameShadow'

I changed the base class as QWidget. And it still did not load the Form1 in the QFrame of Form2

Any help is appreciated.

EDIT:

I used base class as QFrame and I commented out following lines in the ui_form2.h and it worked frame->setFrameShape() and frame->setFrameShadow() and it worked.

If there is better way to do it kindly let me know

László Papp
  • 51,870
  • 39
  • 111
  • 135
gfernandes
  • 1,156
  • 3
  • 12
  • 29

1 Answers1

0

Promoting a widget in designer is just a way of saying "I know this looks like <Standard Widget>, but when you generate code I actually want you to create a <More Specialized Widget> here instead." The widget you promote (and the base class for promotion) need to be of a type that is an ancestor of the type you are promoting to.

In your specific case, the base for your promoted widget should be QWidget (instead of QFrame), because that is the type of Form1. You should put a plain QWidget inside your frame and promote that widget instead of the frame.

Steve S
  • 5,256
  • 1
  • 29
  • 26
  • @Giz: I'm not sure what you mean. Promoting a widget in Designer is just telling it how to generate code. When you're creating widgets in code, you're already in control of the code. – Steve S Nov 22 '13 at 15:02
  • I design my ui in qt designer. I right click and use promote to option. Is the same thing possible through code? I did not see any promote to function when i did ui->widget-> This is just for knowledge. Your answer above solved my issue – gfernandes Nov 25 '13 at 12:30