Automatic resizing scene.
--HG-- branch : develop
This commit is contained in:
parent
4b2db9a95d
commit
48d324e8c6
|
@ -78,11 +78,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
}
|
||||
ToolBarOption();
|
||||
ToolBarDraws();
|
||||
QRectF sceneRect = QRectF(0, 0, SceneSize, SceneSize);
|
||||
sceneDraw = new VMainGraphicsScene(sceneRect);
|
||||
sceneDraw = new VMainGraphicsScene();
|
||||
currentScene = sceneDraw;
|
||||
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
sceneDetails = new VMainGraphicsScene(sceneRect);
|
||||
sceneDetails = new VMainGraphicsScene();
|
||||
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
view = new VMainGraphicsView();
|
||||
ui->LayoutView->addWidget(view);
|
||||
|
@ -583,6 +582,7 @@ void MainWindow::showEvent( QShowEvent *event )
|
|||
return;
|
||||
}
|
||||
// do your init stuff here
|
||||
|
||||
MinimumScrollBar();
|
||||
|
||||
isInitialized = true;//first show windows are held
|
||||
|
@ -1014,6 +1014,10 @@ void MainWindow::ActionOpen()
|
|||
if (fileName.isEmpty() && changeInFile == false)
|
||||
{
|
||||
OpenPattern(fName);
|
||||
sceneDraw->setSceneRect(QRectF(0, 0, view->contentsRect().width()-view->contentsRect().x(),
|
||||
view->contentsRect().height()-view->contentsRect().y()));
|
||||
sceneDetails->setSceneRect(QRectF(0, 0, view->contentsRect().width()-view->contentsRect().x(),
|
||||
view->contentsRect().height()-view->contentsRect().y()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -112,6 +112,26 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
|
|||
{
|
||||
domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x())));
|
||||
domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y())));
|
||||
|
||||
QGraphicsScene *sc = this->scene();
|
||||
QRectF rect = sc->itemsBoundingRect();
|
||||
//Correct BoundingRect
|
||||
rect = QRectF(0, 0, rect.width() + rect.x(), rect.height() + rect.y());
|
||||
|
||||
QList<QGraphicsView*> list = sc->views();
|
||||
QRect rec = list[0]->contentsRect();
|
||||
//Correct contentsRect
|
||||
rec = QRect(0, 0, rec.width() - rec.x(), rec.height() - rec.y());
|
||||
|
||||
if(rec.contains(rect.toRect()))
|
||||
{
|
||||
sc->setSceneRect(rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect = rect.united(rec);
|
||||
sc->setSceneRect(rect);
|
||||
}
|
||||
//I don't now why but signal does not work.
|
||||
doc->FullUpdateTree();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user