copy - add src files + resources into projects

  • Qt Champions 2016

    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 if I understood it right how QtCreator is doing "things"

    1. 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@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
      am I right that there's no automatical sync with file system ? so renaming, delete, add must be done from inside Qt Creator ?

    2. qml.qrc and QML
      looked at some samples and also if creating a new Qt Quick application,
      the main.qml was automatically and ONLY inside the qml.qrc file
      found another example - gallery from Qt 5.6 qt.labs.controls - where gallery.qml was visible inside the gallery.qrc
      and below the Resources folder there also was a QML folder also containing the same gallery.qrc
      what does this mean ?
      how will this be done ?
      what's the recommended way to deal with .qml files and .qrc

    3. 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 descirbed above ?

    4. code generated from outside the project
      I'm working on a DSL to generate code from a model into a 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 .pri with HEADERS and SOURCES and include this into my .pro

    thanks for helping
    don't want to provide wrong recipes HowTo deal with copying / adding resources and src files into QtCreator projects

    BTW: only targeted for mobile development, starting with android, then ios, later win10. Qt 5.6 with qt.labs.controls is a great starting point.

  • Qt Champions 2016

    preparing a blog series to help BlackBerry Cascades Devs with experience HowTo use Eclipse Momentics to start using QtCreator.

    would be cool to get some infos / hints to see if I understood it right - don't want to give wrong advice


  • Qt Champions 2016

    got question 2 about .qrc and QML answered:

    if placing the .qml files not only inside .qrc, but also as OTHER_FILES in .pro will cause Qt Creator to display these files under QML in a hierarchical way much better looking as the structure inside .qrc.
    So it's worth to sync both 'lists'

    still waiting for answers of the other questions.

  • Qt Champions 2016

    got answers from creator mailing list.

    1. copy/paste resources:
    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.

    3. copy/paste src code:
    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.

    4. generated code:
    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).

    now I can go on and prepare my blog

Log in to reply