[Qt-creator] copy/add resources / src files

Ziller Eike Eike.Ziller at theqtcompany.com
Fri Feb 26 10:28:29 CET 2016


> On Feb 25, 2016, at 2:21 PM, ekke <ekke at ekkes-corner.org> wrote:
> 
> Hi Eike,
> 
> just tried adding ressources from another project as you described - worked.
> thx.
> never would have found this alone ;-)
> (and from J-P Nurmi in the meantime I learned that I have to add
> resource files in .pro to OTHER_FILES+= to get a better tree view)
> 
> for copying src files now I'll use this workflow:
> -- source project... show in finder, mark .cpp / .hpp, copy
> -- target project... show in finder, paste
> 
> then I have to manually add to .pro the names of copied cpp under SOURCES+=
> correct ?

Or use “Add existing..."

Br, Eike

> thx
> 
> ekke
> Am 25.02.16 um 13:46 schrieb Ziller Eike:
>>> On Feb 25, 2016, at 11:16 AM, ekke <ekke at ekkes-corner.org> wrote:
>>> 
>>> While preparing a blog artictle for BlackBerry 10 devs HowTo use Qt Creator for Qt 5.6 vs Eclipse Momentics (Cascades, Qt 4.8) I'm having some questions - don't know if I understood it right how QtCreator is doing "things"
>>> 
>>> copy / paste resources
>>>    Having two projects open and want to copy some icons from project A to project B
>>>    In Momentics I would mark some files from project A tree, then copy and in project B tree paste them.
>>>    This seems not to work with Qt Creator.
>>>    Is this the right way:
>>>    go to the file system
>>>    copy files from A to B (per ex. copy images/arrow.png, images/arrow at 2x.png,...)
>>>    if not exist create the images subfolder
>>>    then back to Qt Creator
>>>    select qml.qrc, add existing files, select the images and then they appear in qml.qrc and are under control of Qt Creator
>> Actually if you open the qrc file in an editor in Qt Creator (e.g. “Open in Editor” from context menu in project tree, or through locator (ctrl+k)),
>> and choose Add > Files there, then you are asked if you want to copy the files to the location of the qrc file if the files that you choose are not already located there.
>> 
>>> copy/paste src code
>>>    if I want to copy/paste .cpp, .h source files from another project,
>>>    I have to do it the same way as with resources described above ?
>> Qt Creator does not provide “file explorer” functionalities (beside the remove and rename, which are there because they are actually .pro/.pri file editing features).
>> Note that there are e.g. “Show in Explorer/Finder” in the context menu for nodes in the project tree.
>> 
>>> code generated from outside the project
>>>    I'm working on a DSL to generate code from an Eclipse Xtext model into a Qt project
>>>    (already done for Momentics/Cascades, now working to make this generator x-platform for Qt 5.6 mobile - will be open source)
>>>    I'm generating the code into a subfolder /src-gen
>>>    would it be ok to generate a src-gen.pri with HEADERS and SOURCES and include this file into my .pro ?
>> That sounds like a sensible approach to me. (Note that you should use $$PWD/..... to refer to files with a relative to the .pri file).
>> 
>> Br, Eike
>> 
>>> thanks for helping
>>> don't want to provide wrong recipes HowTo deal with copying / adding resources and src files into QtCreator projects
>>> -- 
>>> ekke (ekkehard gentz)
>>> 
> 

-- 
Eike Ziller, Principle Software Engineer - The Qt Company GmbH
 
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list