Brush button window opens at modebutton, slider 1-50, doxygen comments

0.6.3
Nelsson Huotari 7 years ago
parent 20d1d8ac89
commit 7139889566

@ -46,10 +46,11 @@ CSVRender::BrushSizeControls::BrushSizeControls(const QString &title, QWidget *p
brushSizeSlider = new QSlider(Qt::Horizontal);
brushSizeSlider->setTickPosition(QSlider::TicksBothSides);
brushSizeSlider->setTickInterval(10);
brushSizeSlider->setRange(1, 50);
brushSizeSlider->setSingleStep(1);
brushSizeSpinBox = new QSpinBox;
brushSizeSpinBox->setRange(1, 100);
brushSizeSpinBox->setRange(1, 50);
brushSizeSpinBox->setSingleStep(1);
layoutSliderSize = new QHBoxLayout;
@ -158,6 +159,7 @@ CSVRender::TerrainTextureMode::TerrainTextureMode (WorldspaceWidget *worldspaceW
{
connect(parent, SIGNAL(passEvent(QDragEnterEvent*)), this, SLOT(handleDragEnterEvent(QDragEnterEvent*)));
connect(parent, SIGNAL(passEvent(QDropEvent*)), this, SLOT(handleDropEvent(QDropEvent*)));
connect(parent, SIGNAL(passEvent(QMouseEvent*)), this, SLOT(handleMouseEvent(QMouseEvent*)));
connect(textureBrushWindow, SIGNAL(passBrushSize(int)), this, SLOT(setBrushSize(int)));
connect(textureBrushWindow, SIGNAL(passBrushShape(int)), this, SLOT(setBrushShape(int)));
}
@ -191,9 +193,6 @@ void CSVRender::TerrainTextureMode::primaryEditPressed(const WorldspaceHitResult
void CSVRender::TerrainTextureMode::primarySelectPressed(const WorldspaceHitResult& hit)
{
QPoint position = QCursor::pos();
textureBrushWindow->move (position);
textureBrushWindow->show();
}
void CSVRender::TerrainTextureMode::secondarySelectPressed(const WorldspaceHitResult& hit)
@ -274,6 +273,20 @@ void CSVRender::TerrainTextureMode::handleDropEvent (QDropEvent *event) {
}
}
void CSVRender::TerrainTextureMode::handleMouseEvent (QMouseEvent *event)
{
if (event->button()==Qt::MidButton)
{
QPoint position = QCursor::pos();
textureBrushWindow->move (position);
textureBrushWindow->show();
}
if (event->button()==Qt::LeftButton) PushButton::mouseReleaseEvent (event);
}
void CSVRender::TerrainTextureMode::handlePrimarySelectOnModeButton () {
}
void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitResult& hit)
{
mCellId = getWorldspaceWidget().getCellId (hit.worldPos);

@ -31,6 +31,8 @@ namespace CSVWidget
namespace CSVRender
{
/// \brief Layout-box for some brush button settings
class BrushSizeControls : public QGroupBox
{
Q_OBJECT
@ -44,6 +46,7 @@ namespace CSVRender
QHBoxLayout *layoutSliderSize;
};
/// \brief Brush settings window
class TextureBrushWindow : public QFrame
{
Q_OBJECT
@ -82,27 +85,41 @@ namespace CSVRender
public:
/// \brief Editmode for terrain texture grid
TerrainTextureMode(WorldspaceWidget*, QWidget* parent = nullptr);
/// \brief Create single command for one-click texture editing
void primaryEditPressed (const WorldspaceHitResult& hit);
/// \brief Open brush settings window
void primarySelectPressed(const WorldspaceHitResult&);
void secondarySelectPressed(const WorldspaceHitResult&);
void activate(CSVWidget::SceneToolbar*);
void deactivate(CSVWidget::SceneToolbar*);
/// \brief Start texture editing command macro
virtual bool primaryEditStartDrag (const QPoint& pos);
virtual bool secondaryEditStartDrag (const QPoint& pos);
virtual bool primarySelectStartDrag (const QPoint& pos);
virtual bool secondarySelectStartDrag (const QPoint& pos);
/// \brief Handle texture edit behavior during dragging
virtual void drag (const QPoint& pos, int diffX, int diffY, double speedFactor);
/// \brief End texture editing command macro
virtual void dragCompleted(const QPoint& pos);
virtual void dragAborted();
virtual void dragWheel (int diff, double speedFactor);
virtual void dragMoveEvent (QDragMoveEvent *event);
/// \brief Handle brush mechanics, maths regarding worldspace hit etc.
void editTerrainTextureGrid (const WorldspaceHitResult& hit);
/// \brief Push texture edits to command macro
void pushEditToCommand (CSMWorld::LandTexturesColumn::DataType& newLandGrid, CSMDoc::Document& document,
CSMWorld::IdTable& landTable, std::string cellId);
@ -123,6 +140,8 @@ namespace CSVRender
public slots:
void handleDragEnterEvent (QDragEnterEvent *event);
void handleDropEvent(QDropEvent *event);
void handleMouseEvent (QMouseEvent *event);
void handlePrimarySelectOnModeButton();
void setBrushSize(int brushSize);
void setBrushShape(int brushShape);

@ -134,6 +134,16 @@ void CSVWidget::SceneToolMode::setButton (const std::string& id)
}
}
void CSVWidget::SceneToolMode::mouseReleaseEvent (QMouseEvent *event)
{
if (event->button()==Qt::MidButton && getCurrentId() == "terrain-texture") emit passEvent(event);
if (getType()==Type_TopAction && event->button()==Qt::RightButton)
showPanel (parentWidget()->mapToGlobal (pos()));
else
PushButton::mouseReleaseEvent (event);
}
bool CSVWidget::SceneToolMode::event(QEvent* event)
{
if (event->type() == QEvent::ToolTip)

@ -44,6 +44,8 @@ namespace CSVWidget
void setButton (std::map<ModeButton *, std::string>::iterator iter);
void mouseReleaseEvent (QMouseEvent *event);
protected:
bool event(QEvent* event);
@ -74,6 +76,7 @@ namespace CSVWidget
signals:
void modeChanged (const std::string& id);
void passEvent (QMouseEvent *event);
void passEvent (QDragEnterEvent *event);
void passEvent (QDropEvent *event);

Loading…
Cancel
Save