Why isn't there a QML binding of most common Qt widgets?

Writing a QML plasmoid is very easy and convenient, but can give you a few headaches if you need to do something you can easily do in c++ (e.g. read a file) but without a qml binding. Why isn’t there a binding (like the ones Kirigami/PlasmaCore already do) for all the Qt components without a QML equivalent? QFile, QFileInfo, QMimeData, QProcess just to name a few. Are there security problems with this? Or are they just considered “not so useful”?

The question of “why isn’t there a binding” doesn’t really make sense since a binding is something that sets the value of an object’s property. What you really want is some kind of way to use things like QFile, QFileInfo, etc. in QML, right?

Yeah exactly, a “native” way that do not require to build a c++ widget but only require a plain qml file

There are a few reasons:

  • Not all C++ API maps nicely to QML. Some stuff cannot really be exposed directly or would need to expose the functionality in a different way
  • When writing regular applications the typical approach is to only do UI in QML and use C++ for all business logic. This makes sense in general, but clashes with the idea of QML-only applets
  • Nobody has done it, partly because it’s not that useful for traditional applications

I got it! It surely is better to write the logic in c++, but if it really simple I think this kind of “bindings” (I don’t know how to call it) could be really useful, also given the fact that on the kde store only pure qml widgets can be installed easily

If someone (me, for example) would just write this kind of bindings, would they be merged in the plasma desktop? If yes, I’d happily contribute with this!