mihnen
21st August 2012, 17:22
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.
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.