Results 1 to 2 of 2

Thread: problem propagating mouse events.

  1. #1
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default problem propagating mouse events.

    Hi I have a base class: GLWidget that inherits from QGLWidget:

    class GLWidget : public QGLWidget
    {
    Q_OBJECT
    ---
    ---
    protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int width, int height);

    virtual void mousePressEvent(QMouseEvent *event) {
    std::cout<<"GLWidget mousePressEvent"<<std::endl;
    }

    virtual void mouseMoveEvent(QMouseEvent *event);
    };

    Then I am deriving another class from GLWidget like so :

    class A : public GLWidget
    {
    Q_OBJECT
    public:
    A(QWidget* parent = 0);
    virtual ~A();
    protected:
    virtual void mousePressEvent(QMouseEvent *event) {
    std::cout<<"A::mousePressEvent"<<std::endl;
    }

    };

    now in my mainwindow.cpp, I instantiate my GLWidget and A objects.

    My question is how can I make my A::mousePressEvent() to be called? everytime I press my mouse on my mainWindow, my GLWidget::mousePressEvent is called. I want my A::mousePressEvent to be called. Could some one please help me?

    I called event->igonore in my GLWidget::mousePressEvent() but of no use.

    Thanks in advance.

    Venu

  2. #2
    Join Date
    Jun 2010
    Location
    India
    Posts
    50
    Thanks
    1
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem propagating mouse events.

    Post some more code to figure out the issue. your code isn't enough .

    everytime I press my mouse on my mainWindow, my GLWidget::mousePressEvent is called
    How did you do the above ?

Similar Threads

  1. Problem in Mouse Press Events & Vectors
    By dheeraj in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2008, 18:08
  2. Mouse Events
    By daviddoria in forum Qt Programming
    Replies: 6
    Last Post: 13th May 2008, 11:55
  3. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 10:14
  4. mouse events
    By xyzt in forum Newbie
    Replies: 3
    Last Post: 23rd March 2008, 11:14
  5. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 06:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.