1

So i'm try to create my own custom interactor style inheriting from the vtkInteractorStyleSwitch.

This issue im having is that im trying to disable the "q" shortcut for closing the vtk window.

As far as i understand all i need to do is implement my own OnChar() method and not call the derived classes on char when q is pressed. However this doesn't work somehow the command to close the window is still being run when q is pressed.

for the record i am seeing my debug statement "Q PRESS" when i press q. i cant seem to figure out who is calling the command to close the window which i assume is somewhere in on the the derived classes.

class PlaneInteractorStyle : public vtkInteractorStyleSwitch {
public:
    static PlaneInteractorStyle*
    New();
    vtkTypeMacro(PlaneInteractorStyle, vtkInteractorStyleSwitch);

    virtual void
    OnChar() override
    {
        // Get the key press
        vtkRenderWindowInteractor* rwi = this->Interactor;
        std::string key = rwi->GetKeySym();
        std::cout << "KEYY: " << key << "\n";

        if (key == "q") {
            // do nothing
            std::cout << "Q PRESS\n";
        }
    }
};
vtkStandardNewMacro(PlaneInteractorStyle);
drescherjm
  • 10,365
  • 5
  • 44
  • 64

0 Answers0