mtsgui: conveniently switch between tabs using Alt+Left and Alt+Right
parent
8bbb097936
commit
155cb3b83a
|
@ -492,8 +492,16 @@ void GLWidget::keyPressEvent(QKeyEvent *event) {
|
||||||
case Qt::Key_PageUp: m_context->movementScale *= 2; break;
|
case Qt::Key_PageUp: m_context->movementScale *= 2; break;
|
||||||
case Qt::Key_PageDown: m_context->movementScale /= 2; break;
|
case Qt::Key_PageDown: m_context->movementScale /= 2; break;
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
|
if (event->modifiers() & Qt::AltModifier) {
|
||||||
|
emit switchTab(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_leftKeyDown = true; break;
|
m_leftKeyDown = true; break;
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
|
if (event->modifiers() & Qt::AltModifier) {
|
||||||
|
emit switchTab(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_rightKeyDown = true; break;
|
m_rightKeyDown = true; break;
|
||||||
case Qt::Key_Up:
|
case Qt::Key_Up:
|
||||||
m_upKeyDown = true; break;
|
m_upKeyDown = true; break;
|
||||||
|
@ -520,7 +528,7 @@ void GLWidget::keyPressEvent(QKeyEvent *event) {
|
||||||
if (m_context->selectionMode == EScene) {
|
if (m_context->selectionMode == EScene) {
|
||||||
m_context->selectionMode = ENothing;
|
m_context->selectionMode = ENothing;
|
||||||
m_aabb.reset();
|
m_aabb.reset();
|
||||||
} else {
|
} else if (m_context->scene) {
|
||||||
m_context->selectionMode = EScene;
|
m_context->selectionMode = EScene;
|
||||||
m_aabb = m_context->scene->getKDTree()->getAABB();
|
m_aabb = m_context->scene->getKDTree()->getAABB();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ signals:
|
||||||
void loadFileRequest(const QString &fileName);
|
void loadFileRequest(const QString &fileName);
|
||||||
void crop(int type, int x, int y, int width, int height);
|
void crop(int type, int x, int y, int width, int height);
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
void switchTab(int rel);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void timerImpulse();
|
void timerImpulse();
|
||||||
|
|
|
@ -169,6 +169,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(ui->glView, SIGNAL(statusMessage(const QString &)), this, SLOT(onStatusMessage(const QString &)),
|
connect(ui->glView, SIGNAL(statusMessage(const QString &)), this, SLOT(onStatusMessage(const QString &)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(ui->glView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
|
connect(ui->glView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
|
||||||
|
connect(ui->glView, SIGNAL(switchTab(int)), this, SLOT(onSwitchTab(int)));
|
||||||
|
|
||||||
/* Load defaults from app settings file */
|
/* Load defaults from app settings file */
|
||||||
ui->glView->setInvertMouse(settings.value("invertMouse", false).toBool());
|
ui->glView->setInvertMouse(settings.value("invertMouse", false).toBool());
|
||||||
|
@ -500,6 +501,12 @@ void MainWindow::on_actionFocusSelected_triggered() {
|
||||||
ui->glView->keyPressEvent(&event);
|
ui->glView->keyPressEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSwitchTab(int rel) {
|
||||||
|
int index = ui->tabBar->currentIndex() + rel;
|
||||||
|
if (index >= 0 && index < ui->tabBar->count())
|
||||||
|
ui->tabBar->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFocusAll_triggered() {
|
void MainWindow::on_actionFocusAll_triggered() {
|
||||||
QKeyEvent event(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier);
|
QKeyEvent event(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier);
|
||||||
ui->glView->keyPressEvent(&event);
|
ui->glView->keyPressEvent(&event);
|
||||||
|
|
|
@ -202,6 +202,7 @@ private slots:
|
||||||
void on_glView_crop(int type, int x=0, int y=0,
|
void on_glView_crop(int type, int x=0, int y=0,
|
||||||
int width=0, int height=0);
|
int width=0, int height=0);
|
||||||
void onSelectionChanged();
|
void onSelectionChanged();
|
||||||
|
void onSwitchTab(int rel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void exportImage(const QString &fileName);
|
void exportImage(const QString &fileName);
|
||||||
|
|
Loading…
Reference in New Issue