Qt World Summit: Submit your Presentation

Can't use parameter *event

  • Hi everyone. Here is a problem, for some reason(i'm 2 days trying to figure it out) i can't use parameter of reimplemented function(in other projects i remember i could).


    void mousePressEvent(QMouseEvent *event);

    My Custom class which simply create graphicsView and stuff in it:

    class myGview : public QGraphicsView

    And when i, in body of that function trying use event - nothing happens. I mean normaly, it would be possible to use arrow member selector after i typing out "event" but i press .dot, nothing happens, it do not transform in to -> as any pointer objects do.

    It should work, and i need to use it like this:


    Would be thankful of any help!

  • Does it compile if you manually type the '->' and you call a valid member function? Did you include the QMouseEvent header?

    #include <QMouseEvent>

  • @mchinand said in Can't use parameter *event:
    Did you include the QMouseEvent header?

    Well that's a shame.
    Delete this topic fast admin plz.

  • Lifetime Qt Champion


    @Engelard, don't worry, it can't happen to everybody. Furthermore, that mistake of yours might help somebody else in the future.

    Just mark the thread as solved and keep on hacking :)

Log in to reply