PDA

View Full Version : Inherit size from ancestor Widget/QFrame



SenSej
25th September 2008, 23:45
Hello there,

my_mainwindow got an inserted QFrame as placeholder to display some pictures.
For testing purpose i modified the 40000 Chip example to display the chips in the QGraphicsview whithin my QFrame.

I have no layout or other "widgets" between QFrame and "view", as the QGraphicsView is called in the example.

The Chips are shown in the QFrame. The QGraphicsView is hang up at pos 0/0, but it is bigger than the QFrame. So i cant´s see the button and left side from the QGraphicsView.

How can i tell the View, to inherit the size of the QFrame. Even if the QFrame get streched by streching the mainwindow? I just want to fit the View in the QFrame.

Do this belongs to the viewport of the QGraphicView?
Is there a chapter in http://doc.trolltech.com/4.4 talking about this size/resizing issue?

Hint are totally welcome.
Thanx in advance

spirit
26th September 2008, 07:22
I don't exactly understand why you can't put your QGraphicsView in a layout and set it in QFrame?

SenSej
26th September 2008, 10:54
Hurray - Thanks a lot!

After using is like this:


QFormLayout *layout = new QFormLayout( my_QFrame );
Display *display = new Display( my_QFrame ); //Display-class populates QGraphicsSceen, set up QGraphicsView and the slider/srollbar stuff
layout->addWidget(display);
displayWidget->setLayout(layout);

i can see the whole sceen.

But there is the next problem - As you know from the 40K Chip example there are scroll bars and zoom/rotate slider next to the scene. I can see them *NOW* but they are disabled and grey shadowed.
Some ideas?

spirit
26th September 2008, 11:11
maybe these widgets have isDisbaled() == true?

SenSej
26th September 2008, 11:55
Nice guess.

If there is an enabled slider included in the inserted parts, why should it get disbaled just by inserted it?