diff options
Diffstat (limited to 'gui/fpgaviewwidget.cc')
-rw-r--r-- | gui/fpgaviewwidget.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index e0a81486..f2929d6e 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -88,7 +88,7 @@ void FPGAViewWidget::newContext(Context *ctx) pokeRenderer(); } -QSize FPGAViewWidget::minimumSizeHint() const { return QSize(640, 480); } +QSize FPGAViewWidget::minimumSizeHint() const { return QSize(320, 200); } QSize FPGAViewWidget::sizeHint() const { return QSize(640, 480); } @@ -100,7 +100,7 @@ void FPGAViewWidget::initializeGL() initializeOpenGLFunctions(); QtImGui::initialize(this); glClearColor(colors_.background.red() / 255, colors_.background.green() / 255, colors_.background.blue() / 255, - 0.0); + 1.0); } float FPGAViewWidget::PickedElement::distance(Context *ctx, float wx, float wy) const @@ -630,12 +630,16 @@ void FPGAViewWidget::mousePressEvent(QMouseEvent *event) if (io.WantCaptureMouse) return; - if (event->buttons() & Qt::RightButton || event->buttons() & Qt::MidButton) { + bool shift = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); + bool ctrl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier); + bool btn_right = event->buttons() & Qt::RightButton; + bool btn_mid = event->buttons() & Qt::MidButton; + bool btn_left = event->buttons() & Qt::LeftButton; + + if (btn_right || btn_mid || (btn_left && shift)) { lastDragPos_ = event->pos(); } - if (event->buttons() & Qt::LeftButton) { - bool ctrl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier); - + if (btn_left && !shift) { auto world = mouseToWorldCoordinates(event->x(), event->y()); auto closestOr = pickElement(world.x(), world.y()); if (!closestOr) { @@ -667,7 +671,12 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event) if (io.WantCaptureMouse) return; - if (event->buttons() & Qt::RightButton || event->buttons() & Qt::MidButton) { + bool shift = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); + bool btn_right = event->buttons() & Qt::RightButton; + bool btn_mid = event->buttons() & Qt::MidButton; + bool btn_left = event->buttons() & Qt::LeftButton; + + if (btn_right || btn_mid || (btn_left && shift)) { const int dx = event->x() - lastDragPos_.x(); const int dy = event->y() - lastDragPos_.y(); lastDragPos_ = event->pos(); |