Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement with QML or C++?

Tags:

qt

qt5

qml

qtquick2

I've just started learning Qt recently, finding QML quite interesting for implementing UI component. Before the project really kick off, I've got some questions:

  • For a fresh start project, should I just use QML? Does QML be designed for replacing QWidget?)
  • If I go with QML, is there anything else must be implemented with C++? Or better implemented with C++ for better performance? (I know some customized UI components can be integrated through plugin) What's the relationship between QML and C++ widget?
  • As for performance or rendering issue, does QML better than native C++ widget?
like image 849
Robert Avatar asked Mar 25 '26 05:03

Robert


1 Answers

When you start a question with 'Should I use', it is quite a good hint that SO might not be the right place to ask it. Even more when there are only answers, which start with 'It depends on...'.

QML is not designed to replace QWidget. It is a different technique. Which one to use, depends on your requirements.

Whether or not you must implement additional stuff in C++ depends on your project. Some things are easier in C++, others in QML. And some stuff is not possible in QML at all.

There is no relationship between QML and C++ widgets.

And the performance of QML is in most cases more than sufficient. In almost every case QML is used to create user interfaces. I doubt that there are many cases where clicking a button or opening a dropbox folder is performance critical.

like image 157
Greenflow Avatar answered Mar 27 '26 13:03

Greenflow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!