Offering a tool to help structure new Qt/KDE projects

Hello the KDE community,

I’m a user of KDE neon for years. Yesterday, while I was contemplating to use KF6 widgets or Kirigami2 for my software GUI, I was wondering if my little tool, Qleany, can help some KDE developers quick start their own projects ?

For the last year, I challenged myself to write a C++/Qt6 project, Skribisto, following the clean architecture and SOLID precepts. Six months ago, this project evolved to a tool to generate a complete structure to start-up new projects, a tool that I already use with Skribisto and in my job. Now, at v0.3.0, I’m quite happy with the result !

You can find Qleany here. It’s composed of a library and a generator tool. First, you write a manifest file to define your project details. Then, you generate the structure of hundred of files. Finally, you fill some blanks and create your UI.

I understand than it would not be the first “project structure generator”, nor the last, I only hope to offer my little contribution with Qleany.

It can be renamed Kleany if you find it funny. You can say that I was not very inspired with the name…

The Readme is helpful and there is a running example in the repo.

Some parts are still unstable or running but in reflection. For example, I’m still unsure about my approach of the async undo-redo system since I found limitations.

Suggestions and constructive critics are of course welcome.

Originally, I targeted only an integration with Qt Design Studio projects (so QML projects too) and QWidgets projects. I was more focused on the back end behind the UIs, so the blank Uis are not (yet) generated. For the KDE community, an evolution could be the generation of these blank UI to offer a structure “ready-to-build”.
If some KDE developers deem my project worthwhile, I can write generators for a KF6 Widget UI frame and Kirigami2 UI frame. And I can add a root CMakeLists.txt file to make it ready to be built.

What do you think ? Do you have any ideas of improvement ?

6 Likes

What’s different between this and KAppTemplates?

Wow that’s quite amazing, well done!

I don’t have sadly more feedback than that, but I think the idea of a generator like that is really cool. I will have to tinker with it at some point.

I would say that the Qleany is complementary to KAppTemplate. KAppTemplate does the blank, basic frame, Qleany fills it and offer a maintainable, growable, testable structure for the project. Whole libraries are entirely generated, code included.

Qleany offers to generate smartly from a manifest. This generator leverage the Domain-driven design (DDD), SOLID and the Clean Architecture.

Before writing this manifest, you have to think about what project you want to create.

  • First, before generating anything, you have to think about the business entities and the relations between them. The reality of the business the way a practitioner of this business. A car retailer doesn’t care about your code, he only sees cars, clients, brands, sales and a software able to expose them all. You have here the first entities and you (the dev) begins to see the relationships between them. Write these entities in the manifest.

  • Then, think about the features and use cases (one feature contains one or several use cases) that you want to expose to your GUI/CLI/API, with inputs and outputs. Feature: selling. Use cases: cancel_sell, sell_to_business, sell_to_person, …
    Write them in the manifest.

When you are comfortable with your business logic, generate the structure and the hundred of C++ and CMakeLists files. You will have to fill some blanks (search for Q_UNIMPLEMENTED), but 50% of your project will be done thanks to a smart generator. You can already begin to create you UI and use the classes, functions, signal and models generated by Qleany and tailored to your business need.

Thank you, I realize that it could better explained in the first paragraphs of the Readme

1 Like

Thank you, I am looking forward for your feedback. I’m of course available if you need further explanations.

Hello,

I added the generation of a blank QtWidgets UI. Now, when you will test it, you will have two choices:

  • play directly with the integrated examples
  • do as a real user of Qleany would : build the shared libs, install them, install Qleany gui from PyPI, run qleany init in an empty folder, run the GUI with qleany command, select the generated qleany.yaml in Qleany GUI. Finally click on “list all” & “generate all”. A buildable structure will be generated, entirely buildable.

Enjoy!

Hello,

Added in v0.4.2 :
Generation of minimal UIs:

  • QtWidgets
  • QtQuick

Integration of generated imports to existing QML projects or Qt Design Studio projects. With mocks.

Allow multiple UIs in the same projects (but cleanly separated).

Still studying generation of KDE KF6 Widgets and KF6 Kirigami minimal UIs based on the templates generated by KDevelop.

Hello,

New in v0.5.1:

  • Add integration with existing QML projects.
  • Tidying strings to be compliant with KDE’s compile definitions like QT_NO_CAST_* . Exceptions will stay and must be allowed.
  • add the command “qleany check” to validate the manifest based on a json schema.

New project using Qleany and KF6 Kirigami : Qleany Editor
It will be a visual editor for the manifest with nice blocks, lists and fields to fill. It’s not a text editor. I’m using this project as a proof-of-concept, a test-bed for integration with a KDE project and as a useful tool complementing Qleany generator.

Enjoy and give feedbacks !

Hello,

New in v0.5.4 and interesting to KDE devs:

  • Add the generation of KF6 Kirigami UI, based on KDevelop’s Kirigami template.
  • Integration of QML mocks to Kirigami, so as to develop the UI detached from the backend.

I hope all this work will find some use in future KDE projects.

Have fun !

1 Like