[Qt-creator] Find references of virtual functions?

Christian Kandeler christian.kandeler at qt.io
Mon Sep 14 11:30:01 CEST 2020


On Fri, 11 Sep 2020 20:59:51 +0000
"Murphy, Sean" <smurphy at walbro.com> wrote:

> Say I've got a class inheritance design like so:
> 
> class Abstract
> {
>   virtual void foo() = 0;
> }
> 
> class Base : public Abstract
> {
>   virtual void foo();
> }
> 
> class Child : public Base
> {
>   virtual void foo() override;
> }
> 
> class Grandchild : public Child
> {
>   virtual void foo() override;
> }
> 
> Is there any way in Qt Creator to only show me the places where Grandchild::foo() is called?  Right now, I'm finding that even if I go to grandchild.cpp, put my cursor on void Grandchild::foo(), and then select "Find Reference to Symbol Under Cursor", it shows me every instance of EVERY foo() called anywhere in the program

That's certainly the right default mode, as only finding the function according to the static type of the object would be misleading. I suppose one could add another action that does that, but it seems to go against the concept of virtual functions in general.


Christian


More information about the Qt-creator mailing list