LibreCAD 3 GUI Revamp – GSoC 2020 Phase 2


With the end of another fun coding period, I’m here to bring you the updates on what work has been done in this period.

Again my mentors have been extremely helpful and the community too has been very responsive and helpful, giving me vital and useful feedback as I work on the project.

Documentation for GUI API

Documentation for GUI API has been added to the new librecad wiki. A page for every GUI class describing the function, syntax and an example for each function has been added, for both the normal GUI classes and InputGUI classes. An example on how to add and use the dialog widget and input guis has been added too.

Settings format changed from XML to JSON

The Settings/toolbar format has been changed from xml to json, to leverage the ability of validating the settings using a json schema and simplicity of json. Rapidjson library has been used for parsing and validating the json file.

Property Editor

Property editor has been added which allows us to change the properties of any of the created entities. The property editor shows up with the properties of all currently selected entities.

Changed the entity property instantaneously changes the entity to the new entity with the changed property. Properties changed work in accordance with the undo manager and hence can be undo.

Property editor makes use of the already existing input guis with the addition of a few more classes like the ListGUI, LineSelectGUI etc.

Other minor changes

Minor changes like addition of ok/cancel and removal of the row/column count constraint in the customizable toolbar, addition of build_constants file so that settings file location is determined by the cmake on installation and hence can be changed for different operating systems.

Thanks again to my mentors for their help, and to the community for helping and pointing out various bugs/changes in the features I’m working on.

Dev Log

Akhil Nair

LibreCAD 3 GUI Revamp – GSoC 2020 Phase 1

Hi everyone!

Phase 1 of the GSoC is now over and I’m happy to say that a lot of work has been managed to be done by now. Given the uncertainity surrounding my exams due to the pandemic we are facing, I began my work early in the month of may. All the milestones for the first period( and more so) has been completed.

My mentors Florian and Armin have been of great help and have helped me overcome every issue I’ve faced, as well as provided interesting and useful information as GSoC is at it’s core a great learning experience for us students. The community has also been helpful and interactive and helped me implement the features in the desired way and provided insight on what the users of LibreCAD would require.

Shifting of GUI from Lua to C++

MainWindow class has been added which has responsibilty of managing and initialization of the GUI. Toolbar, CliCommand and Layers classes have been updated to reflect the new changes.

All the lua scripts from lcUILua/ui which were responsible for the GUI initialization have been removed and all their functionality has been shifted to the C++ classes.

Operation Loading

Thanks to Florian’s idea of operation loading, the lua tools are now loaded automatically by the C++ code. The lua scripts define properties according to which the appropriate menu item, toolbar button and command is created for that particular tool.

This has made it easy to add lua tools without requiring to change the code in any of the other files.


The Lua GUI API has been added. Menu, MenuItem, ToolbarTab, ToolbarGroup, ToolbarButton have been added, and the MainWindow, CliCommand and Layers classes have been updated to add all the required lua gui api functions.

Mutiple callbacks, positioning of menu items, easy addition of commands to the commandline and other functionality have been added thanks to the addition of this api.

Removal of QtBridge

With the addition of the lua gui api, the qt bridge is no longer necessary and has been replaced with the lua bridge. Knowledge of qt is no longer required for using gui related functions and operations in the lua plugins.

Dialog Widget Lua GUI API

Lua GUI API has been extended to include many dialog widget classes that make it easy to create and use GUI widgets in lua plugins. The following classes have been added :-

DialogWidget , AngleGUI, ColorGUI, EntityGUI, ButtonGUI, ComboBox GUI, InputGUI, HorizontalGroupGUI, SliderGUI, TextGUI, NumberGUI, RadioButtonGUI, RadioGroupGUI, CoordinateGUI, CheckBoxGUI.

Unit Tests :-

Unit tests have been added for all the work done above.

Customizable Toolbar :-

Customizable toolbar has been added which allows the user to easily customize the toolbar buttons and groups into their desired order. The order is saved so the next time the user opens LibreCAD, the toolbar buttons are in the same order.

The order of buttons can be stored and imported in xml format, as well as a default order is available.

Benefits to the user :-

So what do you the user, benefit from the work done so far?

  • Lua plugins are easier to write, GUI related code can be written without requiring any knowledge of the Qt Framework, GUI can be easily manipulated.
  • Tool operations can be easily added without needing to change the code in any other part of the project.
  • Parts of the user documentation like the lua tools can be automatically generated thanks to the addition of the properties.
  • Dialog Widget API provides lots of easy to use GUI elements that can be used in the lua plugins to provide more interaction through the plugins without writing a lot of code.
  • Toolbar buttons can be ordered in the user’s desired way so that users can access the most frequently used tools easily.
  • The toolbar ordering is exported and imported in xml so can be easily transferred between different computers.

It’s been a lot of fun so far and I look forward to working on more things on the next two coding periods.

Thanks for reading!

Dev Log

Akhil Nair

LibreCAD 3 GUI Revamp – GSoC 2020


I’m Akhil and I’ll be participating in GSoC this year under LibreCAD for the GUI revamp of LibreCAD 3.

I will be mentored by Florian (Feragon) and Armin (LodOfBikes) this summer as I attempt to achieve all the goals laid out in my proposal.

My proposal aims to solve the following problems :-

1) Shifting LibreCAD 3 GUI Window management from Lua to C++. Having the main window and widget initialization in Lua doesn’t provide much advantage and instead serves as a disadvantage as Lua lacks the compiler checks, unit tests and debugging tools that are available with C++.

A MainWindow C++ class will be created which will take over the responsibility of window initialization and management from the lua scripts.

2) Users wishing to extend the functionality of LibreCAD with their own plugins using Lua need to know Qt should they wish to make changes and add GUI widgets.

A Lua GUI API will be added to make it much easier for users to create GUI widgets and interact with the LibreCAD 3 GUI without the hassle of needing to learn Qt. This will also help us maintain control over the style of the GUI, even those added by plugins. This API will be made to be as intuitive and easy to use as possible along with providing enough flexibility to meet the needs of most users.

3) Qt bindings will be removed and the toolbar will be overhauled to make it customizable by the user, so the user can now have easy access to whichever operation that they wish to use.

Documentation and at least one tutorial for the new Lua GUI API will be added. Efforts will be made to make the documentation as clear and informative as possible. Unit tests will also be added throughout the development process to ensure everything performs as expected.

I shall start off with the shifting of GUI from Lua to C++ and hope to have it done by the first coding period. After that I will add the LuaGUI API bit by bit, working on the customizable toolbar on the side. Finally the documentation and tutorials and all remaining tasks will be completed.

I am absolutely thrilled to be a part of this and look forward to a productive summer, learning and contributing to open source.

Thank you and stay safe everyone!

Project proposal

Link to the wiki