Skip to content

Commit

Permalink
Add shortcut keys and update edit skeleton dialog when opening it
Browse files Browse the repository at this point in the history
  • Loading branch information
myurtoglu committed Dec 11, 2014
1 parent fd272e0 commit 5ae0e12
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
7 changes: 4 additions & 3 deletions glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,18 +419,19 @@ void GLWidget::mouseReleaseEvent(QMouseEvent *event) {
}


void GLWidget::wheelEvent(QWheelEvent* event)
void GLWidget::wheelEvent(QWheelEvent *event)
{
if (mMidbutton) {
return;
}

if (event->delta() > 0) {
if ((event->delta() > 0) && (event->modifiers() & Qt::ShiftModifier)) {
zoomFactor = std::max(0.f, zoomFactor*0.95f);
}
else if (event->delta() < 0) {
else if ((event->delta() < 0) && (event->modifiers() & Qt::ShiftModifier)) {
zoomFactor *= 1.05f;
}

resizeGL(this->width(), this->height());
updateGL();
}
Expand Down
14 changes: 9 additions & 5 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ void MainWindow::createConnections()
&MainWindow::openAddTetDialog);
connect(ui->pushButton_editSkeleton, &QPushButton::clicked, this,
&MainWindow::openEditSkeletonDialog);
connect(ui->pushButton_editSkeleton, &QPushButton::clicked, pEditSkeletonDialog,
&EditSkeletonDialog::updateJoints);
connect(ui->pushButton_resetSim, &QPushButton::clicked, ui->widget,
&GLWidget::resetSim);
connect(ui->pushButton_simOptions, &QPushButton::clicked, this,
Expand Down Expand Up @@ -157,31 +159,33 @@ void MainWindow::createShortcutKeys()
ui->actionOpen_All->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L));

QAction *exit = new QAction(this);
exit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));

exit->setShortcut(QKeySequence(Qt::Key_Escape));
connect(exit, SIGNAL(triggered()), this, SLOT(close()));
this->addAction(exit);

QAction *showTets = new QAction(this);
showTets->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));

connect(showTets, SIGNAL(triggered()), ui->checkBox_showTets,
SLOT(toggle()));
this->addAction(showTets);

QAction *showVerts = new QAction(this);
showVerts->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));

connect(showVerts, SIGNAL(triggered()), ui->checkBox_showVerts,
SLOT(toggle()));
this->addAction(showVerts);

QAction *showObject = new QAction(this);
showObject->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));

connect(showObject, SIGNAL(triggered()), ui->checkBox_showObject,
SLOT(toggle()));
this->addAction(showObject);

QAction *startSim = new QAction(this);
startSim->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return));
connect(startSim, SIGNAL(triggered()), ui->checkBox_simulate,
SLOT(toggle()));
this->addAction(startSim);
}


Expand Down
4 changes: 2 additions & 2 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@
</action>
<action name="actionSave_All">
<property name="text">
<string>Save All...</string>
<string>Save Sim...</string>
</property>
</action>
<action name="actionOpen_All">
<property name="text">
<string>Open All...</string>
<string>Open Sim...</string>
</property>
</action>
<action name="actionCreate_tets_from_ply">
Expand Down

0 comments on commit 5ae0e12

Please sign in to comment.