Results 1 to 3 of 3

Thread: Use Qt Creator to create CMakeLists.txt for Widget UI Qt Application

  1. #1
    Join Date
    Apr 2017
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Use Qt Creator to create CMakeLists.txt for Widget UI Qt Application

    Hello,

    I am writing a scientific software that I would like to have a GUI. I have been using CMake so far for the compilation process which does not have a UI, just terminal output. For the UI, I want to use Qt and perferablly Qt Creator to help me build the UI. However, I want this to be nicely packaged in a directory and be built using CMake, not Qmake. I have seen lots of posts about how to open a CMakeLists.txt and import a project into Qt Creator, but can it go the other way? So Qt creator makes a standalone CmakeLists.txt for UI application where you don't need QT creator to build? Note: I am aware of the non-Qt option for C/C++ programs in Qt Creator but this is not for a UI, as I understand. Any suggestions would be helpful.

    Thanks!

  2. #2
    Join Date
    Apr 2017
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Use Qt Creator to create CMakeLists.txt for Widget UI Qt Application

    I was able to figure this out. What I did was use qt creator to make a seperate UI Widget application. I do all the UI design there and then simply copy the main* files (.ui, cpp) into the source directory of the software I am writing (which is set up for cmake). It seems to be working nicely.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,476
    Thanks
    252
    Thanked 709 Times in 699 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Use Qt Creator to create CMakeLists.txt for Widget UI Qt Application

    You should not have to copy anything. Having a build system that depends on copy guarantees you'll someday get the build system out of sync with the sources and causes unnecessary compilations of source files that haven't actually changed except that you copied them. Just put the relative path to your real main* files into the CMakeLists.txt file.

    I use CMake to build a set of libraries for distribution where the source code for the libraries is scattered over many different directories. I don't copy anything. I just set the sources in the CMakeLists.txt files to point to their actual locations on disk, relative to the CMakeLists.txt current directory.

    You still need to manually edit the CMakeLists.txt files to add / remove files. But editing of the .ui and source code files can take place with Qt Creator or any other code development IDE you want.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 15th October 2013, 09:32
  2. Replies: 10
    Last Post: 2nd September 2011, 10:35
  3. Create and use library Qt creator
    By posixprogrammer in forum Newbie
    Replies: 1
    Last Post: 28th February 2011, 09:59
  4. qt creator create class problem
    By foxhengxing in forum Qt Programming
    Replies: 2
    Last Post: 30th June 2010, 16:32
  5. How to Create child widget behind parent widget?
    By anupamgee in forum Qt Programming
    Replies: 6
    Last Post: 22nd June 2010, 13:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.