[Qt-creator] Currently active file from GenericMakeStep or GenericProject?

Eike Ziller eike.ziller at nokia.com
Fri Jun 19 14:19:26 CEST 2009


Hi,

On Jun 19, 2009, at 1:47 PM, ext Frank Siegert wrote:

> Hi creators,
>
> Is there any way to access the file (name+path) which is currently
> active in the editor from the GenericMakeStep or GenericProject class?

Core::EditorManager::instance()->currentEditor()
(->file()->fileName(), that includes the path)

> I am trying to implement
> http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=252810
> (allow for dynamic build components in generic project's build  
> directory)
> because that is the only thing still slowing me down while developing
> with Qt Creator.

Nice.

> So I thought implementing such a replacement in GenericMakeStep::init
> would be the easiest and most local solution to the problem. But now I
> can't figure out how to access the currently active file from there.

Ah, why "most local"?
/me already sees the emails that these variables should also be used  
here-and-there.

You might be interested to have a look at Core::VariableManager, which  
is a class that was originally started to provide such kind of  
variable replacement.

It's more or less a hash of (variablename, value) pairs plus a method  
"resolve" which performs (very simple) variable expansion. It's  
currently not used anywhere, and the design might be a bit too simple  
for some things, but it might be a good place to start from. Would be  
nice to somehow avoid myString.replace("${CURRENT_EDITOR}",  
editorManager->currentEditor()) all over the place ;) . And it would  
make it possible to do the variable expansion in a more intelligent  
way at all places where it's used then.

BTW, you can find us on irc://irc.freenode.org/#qt-creator :)

Best regards, Eike

-- 
Eike Ziller
Software Engineer
Nokia, Qt Software
Phone  +49 (0)30 6392 3255
Fax    +49 (0)30 6392 3256
E-mail eike.ziller at nokia.com







More information about the Qt-creator-old mailing list