QScrollView* sv = new QScrollView( this ); sv->resizeContents( 1000, 1000 ); for ( int i=0; i < 10; i++ ) { QLabel* child = new QLabel( QString("CHILD%1").arg(i), sv->viewport() ); sv->addChild(child, 100, 100*i + 50 ); }
QScrollView* sv = new QScrollView( this ); QVBox* vbox = new QVBox( sv->viewport() ); sv->addChild(vbox); for ( int i=0; i < 100; i++ ) QLabel* child = new QLabel( QString("CHILD%1").arg(i), vbox );
...... self._main = QVBoxLayout(self,7,5) self._main.addSpacing(8) self._scroll = QScrollView(self) self._scroll.setHScrollBarMode(QScrollView.AlwaysOff) self._scroll.setVScrollBarMode(QScrollView.Auto) self._main.addWidget(self._scroll) for each in self._scroll.viewport().children(): if not isinstance(each,QGridLayout): self._scroll.viewport().removeChild(each) # calculating number of rows and cols for certain object props = SomeObject.properties() r,c= dcops.utils.getProductComponents(len(props)) self._grid = QGridLayout(self._scroll.viewport(),r,c,5,5) self._grid.setAutoAdd(True) for prop in props: w = TProperty(self._scroll.viewport(),'',prop.title(),property_type_map[prop.type()],prop.value()) w.show() self._scroll.addChild(w) self._scroll.resizeContents(self._grid.sizeHint().width(),self._grid.sizeHint().height())....