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

Ziller Eike Eike.Ziller at theqtcompany.com
Thu Feb 25 13:46:35 CET 2016

> 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)
> independent software architect
> international development native mobile business apps
> BlackBerry 10 | Qt Mobile (Android, iOS)
> workshops - trainings - bootcamps
> BlackBerry Elite Developer
> BlackBerry Platinum Enterprise Partner
> max-josefs-platz 30, D-83022 rosenheim, germany
> mailto:ekke at ekkes-corner.org
> blog: http://ekkes-corner.org
> apps and more: http://appbus.org
> twitter: @ekkescorner
> skype: ekkes-corner
> LinkedIn: http://linkedin.com/in/ekkehard/
> Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

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