Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Multiplatform project file organization: Separate "Upstream" project for core functions?
Forum Update on Monday, May 27th 2025

Multiplatform project file organization: Separate "Upstream" project for core functions?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 541 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Backflip9
    wrote on 25 Feb 2019, 19:45 last edited by
    #1

    Hi, I've developed a C++ Qt desktop application, and I want to port it to Android, and eventually iOS. I'm sure that some of my code will have to be repurposed for the different UI layout that i'll setup on mobile, but there are definitely some functions that will work exactly the same, such as functions that crunch strings or generate save/cache files. How should I go about organizing these common functions so that they're all stored in headers that don't pertain to a specific Qt project? Do people commonly run into this problem when porting their projects to other platforms?

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Feb 2019, 20:21 last edited by
      #2

      Hi and welcome to devnet,

      The most common is to cleanly separate the UI and the core logic. Then you can build/specialise your UI for the target platform. A bit like the model view paradigm where the data and it representation are clearly separated.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply 27 Feb 2019, 18:34
      1
      • M Offline
        M Offline
        mrdebug
        wrote on 25 Feb 2019, 20:21 last edited by
        #3

        Hi.
        When I have to write an application for mobiles too I use Qml.
        The code is the same except one function for to calculate the points for inch.
        So the code is the same for desktop and mobiles.

        Need programmers to hire?
        www.labcsp.com
        www.denisgottardello.it
        GMT+1
        Skype: mrdebug

        1 Reply Last reply
        1
        • S SGaist
          25 Feb 2019, 20:21

          Hi and welcome to devnet,

          The most common is to cleanly separate the UI and the core logic. Then you can build/specialise your UI for the target platform. A bit like the model view paradigm where the data and it representation are clearly separated.

          B Offline
          B Offline
          Backflip9
          wrote on 27 Feb 2019, 18:34 last edited by
          #4

          @SGaist Good point, I see the advantages of model-based UI elements now. Do you have an example of a cross-platform project's file structure on hand? Do some people have a separate git repo for their core logic?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 27 Feb 2019, 19:43 last edited by
            #5

            Unless you are re-using your core libraries in several project, it's pretty rare to have it in a separate repo.

            Hover you can have several sub-projects. For example one for a library containing your core logic and one for the application itself.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            1/5

            25 Feb 2019, 19:45

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved