coin3d / quarter

Coin GUI binding for Qt
BSD 3-Clause "New" or "Revised" License
39 stars 28 forks source link

Fixed bug in InteractionMode and improved it #65

Closed githubuser0xFFFF closed 5 months ago

githubuser0xFFFF commented 5 months ago

When using the the InteractionMode, whe noticed the following problem / bug:

The problem is the following code in setOn():

  if (on) {
    this->altkeydown = true;
    this->prevnavstate = eventmanager->getNavigationState();
    this->prevcursor = this->quarterwidget->cursor();
    this->quarterwidget->setCursor(this->quarterwidget->stateCursor("interact"));
    eventmanager->setNavigationState(SoEventManager::NO_NAVIGATION);
  } else {
    this->altkeydown = false;
    this->quarterwidget->setCursor(this->prevcursor);
    eventmanager->setNavigationState(this->prevnavstate);
  }

To reproduce this, do the following steps:

The event manager will remain in NO_NAVIGATION state.

To fix this I use different variables to track the on, altkey and interactive state. After the change, the ALT key works as a toggle switch. If it is pressed, then the other mode is activated. That means, if the widget is in navigation mode, ALT activates the interactive mode as long as pressed and if the widget is in interactive mode, pressing the ALT key temporary activates the navigation mode.

VolkerEnderlein commented 5 months ago

Thank your for your contribution to Coin/quarter development it is highly appreciated.