[Qt-interest] Size of QGraphicsScene content
Istvan Buki
buki.istvan at gmail.com
Fri Nov 13 14:09:06 CET 2009
Hi,
I'm trying to determine of much space is taken by the items added to a
QGraphicsScene and could not find a solution.
Here is a piece of code showing what I'm trying to achieve:
QGraphicsScene scene( 0, 0, 300, 300);
QGraphicsWidget *form = new QGraphicsWidget;
form->setGeometry( 0, 0, d.300, 300 ) ;
form->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ;
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
form->setLayout(layout);
scene.addItem(form);
for ( int row = 0; row < some_value; ++row )
{
// Create some item to add to the layout
item = ...
layout->addItem( item, row, column);
}
If I add to much rows to the grid layout, at some point it will overflow the
space available on the widget.
The number of rows is not known at compile time but I would like to know
when adding one more item will cause an overflow because there is not enough
space on the main widget.
Any idea how to achieve that?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091113/4eb755d4/attachment.html
More information about the Qt-interest-old
mailing list