2

I have installed QT5 in visual studio. I want to create my GUI dynamically at run-time. Hence I cannot use any designers or forms. How do I do that? Which template should I create in visual Studio? Also which QT libraries do I have to include to achieve the same?

2
  • Did you install the qt vs-addin? Commented Jun 25, 2016 at 9:41
  • @Wilmort Yes I did Commented Jun 25, 2016 at 12:29

2 Answers 2

2

Designers and forms are only helpers that end up with generating C++ code that you want to write yourself. So you can create a form (in designer), build your project and see generated code, from which you can learn how to create and setup UI objects. You can then leave those forms aside and write your code using generated one as code snippets.

Anyway, the short answer to you question "how to create my GUI dynamically at run-time" is: create objects of UI classes (such as QMainWindow) and manipulate then using Qt API

Which template should I create in visual Studio? - C++, Win32 Project

which QT libraries do I have to include? - Again, use Qt Creator as a "teacher". Once you have a project built in Qt Ctreator, look at its "Compile output" window. From there you will learn what compiler and linker settings are needed

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

Comments

0

Practice building the forms in Qt Designer. Then go to Form -> View Code and look at the layout code. This is an example of the C++ code that you can use yourself to build widgets at run time.

When you write your own widget without designer, you can simply subclass QWidget and add buttons, dropdowns, etc. Or you can try overriding paint events to do custom painting.

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.