[Qt-creator] Switch header/source with private header

Typz thetypz at gmail.com
Thu May 31 14:42:45 CEST 2012


Hello,

Today i've had an issue with the switch header/source feature.
I have a project with 3 files: toto.h, toto_p.h and toto.cpp (typical Qt
code :-)
  - First, looking at toto.h, select 'switch header/source', which opens
toto.cpp: so far, so good. 'switch header/source' again brings toto.cpp,
nice.
  - Next, looking at toto_p.h, select 'switch header/source', which opens
toto.cpp: so far, so good.
  - Now if i select again 'switch header/source', i go back to toto_p.h...
which is consistent with the last switch, but i have no 'simple' way to get
back to toto.h.
So from this point, the switch header/source always bings: from toto.h or
toto_p.h to toto.cpp [OK], and from toto.cpp to toto_p.h...

Looking at the code, i see where this comes from: we correctly look for
matching header/source, but only if we have not stored the match yet.
After a successful lookup, we store the result (both directions) in a map,
to allow recalling it quickly.

This is not very usable, but i don't know how we could fix it. One idea
could be the switch header/source would iterate over the three files, so
that it goes toto.cpp -> toto_p.h -> toto.h -> toot.cpp...?
Or maybe it switch to the 'last' used alternative, and cycle other
alternatives only if i call the switch header/source again immediately
(with no other action/key press in between): toto.cpp -> toto.h (starts
with last used alternative) -> toto_p.h -> toto.h ..., while switching from
header to source is unaffected.

What do you think? Do you see another way out (except using the locator :-)
)
Best regards,

-- 
Francois
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20120531/df824595/attachment.html>


More information about the Qt-creator mailing list