Remove scrollArea surrounding graphicsView_Map
This commit is contained in:
parent
5247dd18c0
commit
ef9c4c73c3
3 changed files with 25 additions and 138 deletions
|
@ -350,129 +350,37 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<widget class="GraphicsView" name="graphicsView_Map">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
<property name="dragMode">
|
||||
<enum>QGraphicsView::NoDrag</enum>
|
||||
</property>
|
||||
<property name="transformationAnchor">
|
||||
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||
</property>
|
||||
<property name="resizeAnchor">
|
||||
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>543</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>166</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>166</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>166</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="GraphicsView" name="graphicsView_Map">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
<property name="dragMode">
|
||||
<enum>QGraphicsView::NoDrag</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>166</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -898,33 +898,13 @@ void Editor::scaleMapView(int s) {
|
|||
if ((scale_exp + s) <= 5 && (scale_exp + s) >= -2) // sane limits
|
||||
{
|
||||
if (s == 0)
|
||||
s = -scale_exp;
|
||||
|
||||
scale_exp += s;
|
||||
|
||||
double base = scale_base;
|
||||
double exp = scale_exp;
|
||||
double sfactor = pow(base, s);
|
||||
|
||||
const auto mapAnchor = ui->graphicsView_Map->transformationAnchor();
|
||||
const auto connectionsAnchor = ui->graphicsView_Connections->transformationAnchor();
|
||||
ui->graphicsView_Map->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
ui->graphicsView_Connections->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
scale_exp = 0;
|
||||
else
|
||||
scale_exp += s;
|
||||
|
||||
double sfactor = pow(scale_base, s);
|
||||
ui->graphicsView_Map->scale(sfactor, sfactor);
|
||||
ui->graphicsView_Connections->scale(sfactor, sfactor);
|
||||
|
||||
int width = static_cast<int>(ceil((scene->width()) * pow(base, exp))) + 2;
|
||||
int height = static_cast<int>(ceil((scene->height()) * pow(base, exp))) + 2;
|
||||
QSize viewSize = ui->scrollAreaWidgetContents_5->size();
|
||||
int minWidth = qMin(width, viewSize.width());
|
||||
int minHeight = qMin(height, viewSize.height());
|
||||
|
||||
ui->graphicsView_Map->setFixedSize(minWidth, minHeight);
|
||||
ui->graphicsView_Connections->setFixedSize(minWidth, minHeight);
|
||||
|
||||
ui->graphicsView_Map->setTransformationAnchor(mapAnchor);
|
||||
ui->graphicsView_Connections->setTransformationAnchor(connectionsAnchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -563,7 +563,6 @@ void MainWindow::refreshMapScene()
|
|||
|
||||
ui->graphicsView_Map->setScene(editor->scene);
|
||||
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
||||
ui->graphicsView_Map->setFixedSize(width, height);
|
||||
ui->graphicsView_Map->editor = editor;
|
||||
|
||||
ui->graphicsView_Connections->setScene(editor->scene);
|
||||
|
|
Loading…
Reference in a new issue