diff --git a/apps/opencs/view/render/terrainshapemode.cpp b/apps/opencs/view/render/terrainshapemode.cpp index 934388acf..701e704bb 100644 --- a/apps/opencs/view/render/terrainshapemode.cpp +++ b/apps/opencs/view/render/terrainshapemode.cpp @@ -45,16 +45,7 @@ CSVRender::TerrainShapeMode::TerrainShapeMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent) : EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-shape"}, Mask_Terrain | Mask_Reference, "Terrain land editing", parent), - mBrushSize(1), - mBrushShape(CSVWidget::BrushShape_Point), - mShapeBrushScenetool(nullptr), - mDragMode(InteractionType_None), - mParentNode(parentNode), - mIsEditing(false), - mTotalDiffY(0), - mShapeEditTool(ShapeEditTool_Drag), - mShapeEditToolStrength(8), - mTargetHeight(0) + mParentNode(parentNode) { } diff --git a/apps/opencs/view/render/terrainshapemode.hpp b/apps/opencs/view/render/terrainshapemode.hpp index 95ffa572e..8ee9625ff 100644 --- a/apps/opencs/view/render/terrainshapemode.hpp +++ b/apps/opencs/view/render/terrainshapemode.hpp @@ -141,20 +141,20 @@ namespace CSVRender std::string mCellId; std::string mBrushTexture; - int mBrushSize; - CSVWidget::BrushShape mBrushShape; + int mBrushSize = 1; + CSVWidget::BrushShape mBrushShape = CSVWidget::BrushShape_Point; std::vector> mCustomBrushShape; - CSVWidget::SceneToolShapeBrush *mShapeBrushScenetool; - int mDragMode; + CSVWidget::SceneToolShapeBrush *mShapeBrushScenetool = nullptr; + int mDragMode = InteractionType_None; osg::Group* mParentNode; - bool mIsEditing; + bool mIsEditing = false; std::unique_ptr mTerrainShapeSelection; - int mTotalDiffY; + int mTotalDiffY = 0; std::vector mAlteredCells; osg::Vec3d mEditingPos; - int mShapeEditTool; - int mShapeEditToolStrength; - int mTargetHeight; + int mShapeEditTool = ShapeEditTool_Drag; + int mShapeEditToolStrength = 8; + int mTargetHeight = 0; PagedWorldspaceWidget& getPagedWorldspaceWidget(); diff --git a/apps/opencs/view/widget/scenetoolshapebrush.cpp b/apps/opencs/view/widget/scenetoolshapebrush.cpp index fcafc4cf0..e4647d600 100644 --- a/apps/opencs/view/widget/scenetoolshapebrush.cpp +++ b/apps/opencs/view/widget/scenetoolshapebrush.cpp @@ -35,10 +35,7 @@ CSVWidget::ShapeBrushSizeControls::ShapeBrushSizeControls(const QString &title, QWidget *parent) - : QGroupBox(title, parent), - mLayoutSliderSize(new QHBoxLayout), - mBrushSizeSlider(new QSlider(Qt::Horizontal)), - mBrushSizeSpinBox(new QSpinBox) + : QGroupBox(title, parent) { mBrushSizeSlider->setTickPosition(QSlider::TicksBothSides); mBrushSizeSlider->setTickInterval(10); @@ -48,19 +45,18 @@ CSVWidget::ShapeBrushSizeControls::ShapeBrushSizeControls(const QString &title, mBrushSizeSpinBox->setRange(1, CSMPrefs::get()["3D Scene Editing"]["shapebrush-maximumsize"].toInt()); mBrushSizeSpinBox->setSingleStep(1); - mLayoutSliderSize->addWidget(mBrushSizeSlider); - mLayoutSliderSize->addWidget(mBrushSizeSpinBox); + QHBoxLayout *layoutSliderSize = new QHBoxLayout; + layoutSliderSize->addWidget(mBrushSizeSlider); + layoutSliderSize->addWidget(mBrushSizeSpinBox); connect(mBrushSizeSlider, SIGNAL(valueChanged(int)), mBrushSizeSpinBox, SLOT(setValue(int))); connect(mBrushSizeSpinBox, SIGNAL(valueChanged(int)), mBrushSizeSlider, SLOT(setValue(int))); - setLayout(mLayoutSliderSize); + setLayout(layoutSliderSize); } CSVWidget::ShapeBrushWindow::ShapeBrushWindow(CSMDoc::Document& document, QWidget *parent) : QFrame(parent, Qt::Popup), - mBrushShape(CSVWidget::BrushShape_Point), - mBrushSize(1), mDocument(document) { mButtonPoint = new QPushButton(QIcon (QPixmap (":scenetoolbar/brush-point")), "", this); diff --git a/apps/opencs/view/widget/scenetoolshapebrush.hpp b/apps/opencs/view/widget/scenetoolshapebrush.hpp index 19d24111d..2c027baf0 100644 --- a/apps/opencs/view/widget/scenetoolshapebrush.hpp +++ b/apps/opencs/view/widget/scenetoolshapebrush.hpp @@ -40,9 +40,8 @@ namespace CSVWidget ShapeBrushSizeControls(const QString &title, QWidget *parent); private: - QHBoxLayout *mLayoutSliderSize; - QSlider *mBrushSizeSlider; - QSpinBox *mBrushSizeSpinBox; + QSlider *mBrushSizeSlider = new QSlider(Qt::Horizontal); + QSpinBox *mBrushSizeSpinBox = new QSpinBox; friend class SceneToolShapeBrush; friend class CSVRender::TerrainShapeMode; @@ -64,8 +63,8 @@ namespace CSVWidget const QString toolTipCustom = "Paint with custom brush, defined by terrain selection"; private: - CSVWidget::BrushShape mBrushShape; - int mBrushSize; + CSVWidget::BrushShape mBrushShape = CSVWidget::BrushShape_Point; + int mBrushSize = 1; CSMDoc::Document& mDocument; QGroupBox *mHorizontalGroupBox; QComboBox *mToolSelector;