PDA

View Full Version : put a toolbox



mickey
23rd August 2006, 12:13
hi,
I desinged a toolbox and put onto a tabwidget page (here the toolbox isn't blocked in any point); I create an instance of a myWidget class in mymainform class and I put this widget on left of toolbox; the I managed layout by hand from mymainform (layout horizotal/vertical); maybe is betterfix the layout in designer putting on the left of toolbox a Qframe??? (then in mymainform I can put mywidget inside frame)....thanks

mickey
23rd August 2006, 15:33
Hi, I tried use a Qframe to put myWidget in, but the problem arise is an old problem: the "cout" print the value 101 because the first time QFrame is drawn with wrong width; only if I resize window app, frame3 take correct value:700; So myWidget4 is drawn in a small square instead of all frame3 dimensions; how do I avoid this? thanks


//myMainform constructor
myWidget4 = new MyWidget(frame3, "Advance", myWidget1);
myWidget4->setGeometry(frame3->x(), frame3->y(), frame3->width(), frame3>height());
cout << "frame widget() " << frame3->width() << endl;

wysota
24th August 2006, 18:05
Why don't you use layouts instead of setting the geometry manually yourself?

mickey
25th August 2006, 17:20
hi,
my aim was avoid to do it manually. But I had a toolbox designed from designer and a mywidgetX instance create in mymainform constructor. So I coudn't set layout from designer because how could I set layout (with myWidgetX+toolbox)from designer if in designer I had created mywidgetX in myMainform? But I wanted a way to fix the toolbox in designer. So I inserted the frame3 and I create layout with frame3+toolbox; then I tried a way to put mywidgetX inside frame3 (will it possible?): I didn't find it. Actually I solve with this:


lay2 = new QHBoxLayout(frame3,0,1);
lay2->addWidget(myWidgetX,1,0);

It work and I think it's ok....right?

wysota
27th August 2006, 15:35
It's fine. Alternatively you could use a custom widget (either a fake or a real one) to insert your designer made widget into another form in designer.