Embedded Qt GraphicsScene coordinates -
resolved. i'm creating fullscreen app c++ , qt. in screen l have graphicsscene (and view it) takes out section of screen. l can't figure out how coordinates right.
l want view size match size of container. l can either create view larger container there scrollbars (don't want initially) point (0,0) @ top-left corner (l want this) or view smaller point (0,0) no longer in top-left corner, there 'margins'. l want (0,0) point top-left l can programmatically draw grid.
scene = new notematrix(layoutb2); view = new qgraphicsview(scene); scene->setscenerect(0,0,view->framesize().width(), view->framesize().height()); view->fitinview(view->scenerect()); view->setalignment(qt::alignleft); scene->addrect(0, 0, scene->width(), scene->height()); //visualize boundaries qwidget *widget = new qwidget(parent); widget->setlayout(layoutb2); mainlayout->setstretchfactor(widget, 1); setcentralwidget(widget); i resolved initial problem. there nothing wrong coordinates. need set alignment whichever side l wish, in scenario left.
if want fit scene in qgraphicsview
view->setscene(yourscene); view->setscenerect(0,0,view->framesize().width(),view->framesize().height()); use setting scene rect..if set rect width , height less or eaual of views..no scroll bars displayed else will.
Comments
Post a Comment