Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Override PCLVisualizerInteractorStyle mouse click
Forum Updated to NodeBB v4.3 + New Features

Override PCLVisualizerInteractorStyle mouse click

Scheduled Pinned Locked Moved Unsolved General and Desktop
vtkpclinteractive guistyle
4 Posts 2 Posters 799 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    surajj4837
    wrote on 11 May 2021, 01:34 last edited by
    #1

    I m creating my application in Qt. I have integrated a 3D PCL
    viewer in a QVTWidget plugin. I want to change the standard functions of user input like left mouse click on the viewer window.

    Following are the class details:

    class SiLS : public QMainWindow, pcl::visualization::PCLVisualizerInteractorStyle
    {
       Q_OBJECT
    
        public:
           SiLS(QWidget *parent = nullptr);
           ~SiLS();
    
           void OnLeftButtonDown() override
           {
             std::cout << "Pressed left mouse button." << std::endl;
           }
    
        private slots:
    
        private:
           Ui::SiLS *ui;
    
        protected:
    
           pcl::visualization::PCLVisualizer::Ptr viewer;
    };
    
    SiLS::SiLS(QWidget *parent) : QMainWindow(parent) , ui(new Ui::SiLS)
    {
       ui->setupUi(this);
    
       // Set up the QVTK window
       viewer.reset (new pcl::visualization::PCLVisualizer ("viewer", false));
       ui->BEV_Display->SetRenderWindow(viewer->getRenderWindow());
       viewer->setupInteractor(ui->BEV_Display->GetInteractor(), ui->BEV_Display->GetRenderWindow(), SiLS::New());
       ui->BEV_Display->update();
    }
    
    SiLS::~SiLS()
    {
        delete ui;
    }
    
    1. But after left clicking inside the window I m not getting the print statement in output.

    2. After closing the application window I m getting following errors:

    ERROR: In /home/suraj/VTK/VTK-7.1.1/Common/Core/vtkObject.cxx, line 156 vtkObject (0x7ffda4148b80): Trying to delete object with non-zero reference count.
    
    Generic Warning: In /home/suraj/VTK/VTK-7.1.1/Common/Core/vtkObjectBase.cxx, line 93 Trying to delete object with non-zero reference count.
    

    Is there anything I m missing?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 May 2021, 21:39 last edited by
      #2

      Hi,

      @surajj4837 said in Override PCLVisualizerInteractorStyle mouse click:

      class SiLS : public QMainWindow, pcl::visualization::PCLVisualizerInteractorStyle

      Why the double inheritance ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        surajj4837
        wrote on 12 May 2021, 01:32 last edited by
        #3

        This might be one of the mistakes. I want to override the left click function of PCLVisualizer, which is member of SiLS class (which is the only class I have created). So I inherited the PCLVisualizerInteractorStyle which has the virtual function of left click.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 12 May 2021, 19:57 last edited by
          #4

          C++ does not work like that. Create a proper subclass and then use that one for the member variable.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          1/4

          11 May 2021, 01:34

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved