0

I have a current C++ program built using GNU make. It is reasonably large - about a dozen .cpp files and a similar number of headers.

It all runs off the command line and currently just outputs to cout and cerr.

I want to add Qt interface elements to it - what is the best way to do this?

(I have built some Qt stuff in the past (not for a few years) though I am rusty - the C++ code I have now works and I don't want to change that, just fix the way it outputs information to the end user.)

3
  • It's unclear what you're actually asking, as well as what you've tried (if anything). Ignoring your current makefile, how would you go about creating a makefile for a new qt-based program? Just do that, and then add in your existing sources (along with Qt-appropriate changes for the UI). Commented Dec 15, 2015 at 21:32
  • I am hoping for some practical pointers. "Just do that" isn't one. Commented Dec 15, 2015 at 21:35
  • Stack Overflow is not a site that accepts broad / open-ended questions, but yours seems to be exactly that. You need to be able to get yourself started before posting here. Commented Dec 15, 2015 at 21:36

1 Answer 1

2

You didn't specify whether you're interested in Qt Widgets or Qt Quick, so I'll assume widgets.

Fire up Qt Creator, and create a new Qt Widgets project. Open designer mode by double clicking on the .ui file that was created and start creating the interface that you want. If you just want somewhere to start integrating your logic, dump your existing code into mainwindow.cpp (or whatever you called it) and refactor it as you learn more about Qt.

For example, one of your buttons might cause a slot to be invoked, and you could then do all of your stuff in that slot.

There are also a lot of non-gui-related utility classes like QCommandLineParser that may help you out.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.