scrollbars in MaximumSize QGraphicsView
TOPIC MOVED TO QT PROGRAMMING FORUM (please respond there)
I have a problem with setting the maximumsize of a qgraphicsview.
I do not want any background canvas area to be visible in the qgraphicsview, so when the window is sized sufficiently large, it should be as in below picture (except without scrollbars.)
For smaller window sizes, the view can be smaller and scrollbars are required.
The problem is, I cannot get the scrollbars to disappear for a maxed window, where the maximum qgraphicsview size is limited to the views bounding rectangle:
http://www.qtcentre.org/forum/pictur...5&pictureid=26
Code:
{
QIcon OpenIcon
= this
->style
()->standardIcon
(QStyle::SP_DirOpenIcon,
0,
this);
QMenu *file = this
->menuBar
()->addMenu
("&File");
file->addAction(open);
file->addAction(quit);
QToolBar *toolbar
= addToolBar
("main toolbar");
QAction *open2
= toolbar
->addAction
(OpenIcon,
"Open File");
toolbar->addSeparator();
scene
->addText
("Hello, world!",
QFont("Helvetica [Cronyx]",
100));
scene->itemsBoundingRect();
view->setContentsMargins ( 0,0,0,0 );
view->setMaximumSize(view->sceneRect().width()+1,view->sceneRect().height()+1);
//view->setMaximumSize(view->maximumViewportSize()); /* also does not work*/
this->setCentralWidget(view);
this->resize(800,300);
}