Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path Editor Layout #169

Merged
merged 9 commits into from
Sep 3, 2020
13 changes: 5 additions & 8 deletions Editors/PathEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ PathEditor::PathEditor(MessageModel* model, QWidget* parent) : BaseEditor(model,
_ui->pathPreviewBackground->SetAssetView(_ui->roomView);

// Prefer resizing the path view over the points editor
_ui->splitter->setStretchFactor(0, 0);
_ui->splitter->setStretchFactor(1, 1);

_ui->mainToolBar->setStyleSheet("QToolBar{spacing:8px;}");
_ui->contentSplitter->setStretchFactor(0, 0);
_ui->contentSplitter->setStretchFactor(1, 1);

QLabel* xSnapLabel(new QLabel(tr("X Snap"), this));
_ui->mainToolBar->addWidget(xSnapLabel);
Expand Down Expand Up @@ -199,8 +197,7 @@ void PathEditor::MousePressed(Qt::MouseButton button) {
}
}
// No point found. Add one and select it
InsertPoint(_pointsModel->rowCount(), _ui->roomView->mousePos.x(), _ui->roomView->mousePos.y(),
_ui->speedSpinBox->value());
InsertPoint(_pointsModel->rowCount(), _ui->roomView->mousePos.x(), _ui->roomView->mousePos.y(), 100);
}
}

Expand All @@ -224,13 +221,13 @@ void PathEditor::UpdateSelection(const QItemSelection& /*selected*/, const QItem
}

void PathEditor::on_addPointButton_pressed() {
InsertPoint(_pointsModel->rowCount(), _ui->xSpinBox->value(), _ui->yspinBox->value(), _ui->speedSpinBox->value());
InsertPoint(_pointsModel->rowCount(), 0, 0, 100);
}

void PathEditor::on_insertPointButton_pressed() {
int insertIndex = _ui->pointsTableView->selectionModel()->currentIndex().row();
if (insertIndex < 0) insertIndex = 0;
InsertPoint(insertIndex, _ui->xSpinBox->value(), _ui->yspinBox->value(), _ui->speedSpinBox->value());
InsertPoint(insertIndex, 0, 0, 100);
}

void PathEditor::on_deletePointButton_pressed() {
Expand Down
Loading