How to have fixed size QGraphicsView & QGraphicsScene
I'm trying to have a fixed size wysiwyg editor for creating labels. Currently I am trying to implement this with a QGraphicsScene & QGraphicsView populated with QGraphicsTextItem that will take up the whole view.
The problem I am having is how in the world do I get the QGraphicsView to be the same size as the scene, I need this to be a fixed size so that I can use it to do autosizing on the text within it. There are so many different ways I have seen attempted to do this such as using contentsRect(), viewport->setFixedSize(), using setSceneRect(). I also have the border-style set to none and setFrameStyle(QFrame::NoFrame). But alas I just cannot get this to work.
Am doing something wrong or is this the wrong approach. I really don't want to have to implement a complete custom widget to do all this when most of the functionality is built into the QGraphicsTextItem.
Re: How to have fixed size QGraphicsView & QGraphicsScene
So you want to have a fixed size for the QGraphicsView and the QGraphicsScene ?
Or you want to resize the QGraphicsView and QGraphicsScene to the size of the text?
Re: How to have fixed size QGraphicsView & QGraphicsScene
A Fixed size for the QGraphicsView & QGraphicsScene. I basically want to use a view the exact same size as the scene. The fact that there even is a scene is just a fact of the way qt works, I don't care about it, I just want a fixed size widget to add QGraphicTextItems into. The Text will simply be autosized by using the size of the QRect of the view and checking the bounding rect of the font with QFontMetrics.