{
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);
}
MyMain::MyMain(QWidget *parent):QMainWindow(parent)
{
QIcon OpenIcon = this->style()->standardIcon(QStyle::SP_DirOpenIcon, 0, this);
QAction *quit = new QAction("&Quit", this);
QAction *open = new QAction("&Open", 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 = new QGraphicsScene();
scene->addText("Hello, world!",QFont("Helvetica [Cronyx]", 100));
view = new QGraphicsView(scene, this);
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);
}
To copy to clipboard, switch view to plain text mode
Bookmarks