src/Mod/Start/README.md
This Workbench is intended to eventually replace (and be renamed to) Start. Its main reason for existing is to eliminate FreeCAD's dependency on QtWebEngine by redesigning Start to eliminate the HTML component.
The long-term plan for this workbench is to migrate from Qt Widgets to QtQuick/QML with a C++ backend providing access to things like FreeCAD's Recent Files list. This switch will happen sometime after we no longer have to support building on Ubuntu 20.04 LTS, which still uses Qt 5.12. The cMake integration of QML and C++ together in a single project is greatly improved in Qt 5.15 and later.
In the meantime the workbench is written in C++ so that the models can be reused later, and only the UI itself will have to change.
The main UI file for the Start screen is in Gui/StartView.cpp -- that class is a QScrollArea that gets embedded
into a new FreeCAD MDIView. Inside the scroll area are three regions:
QPushButtons with embedded QLayouts displaying an image and two lines of text. Currently
laid out manually in a QGridLayout, but eventually it would be nice to dynamically calculate that layout to allow the
buttons to exist on a single line when there is enough space for them.RecentFilesModel, a simple read-only interface to
FreeCAD's preferences system, where it gets the list of recent files. That class is inApp/RecentFilesModel.*. It is
implemented using a set of User Roles, one for each piece of data about a file. Not all data is available for all files.
For example, when given const QModelIndex &index, you can call index.data(DisplayedFilesModelRoles::author) to get
the "author" metadata item of an FCStd file. See the DisplayedFilesModelRoles enumeration for possible values. These
roles are also exposed to QML via their names.QListView, Gui/FileCardView.*, whose only function beyond the standard
QListView is to implement the "height for width" functionality, so the widget can properly resize based on the number
of file cards and the screen width, laying them out in a grid.FileCardDelegate class in Gui/FileCardDelegate.*. That class uses
a simple QVBoxLayout to paint the icon, filename, and file size.ExamplesModel in App/ExamplesModel.*. It fetches a read-only list of files from the FreeCAD
resources/examples directory and displays them.This Workbench does the minimum amount of design customization, preferring to allow Stylesheet authors control over the
display via the normal QSS mechanisms in Qt. There are three FreeCAD Parameters that control the spacing between the
widgets and the size of the icons, all in the BaseApp/Preferences/Mod/Start/ preferences group:
FileCardSpacing (default: 20). The space between and around the individual File Cards.FileThumbnailIconsSize (default: 128). The size of the file thumbnail on the File Cards.NewFileIconSize (default: 48). The size of the icons on each of the "new file" buttons.At present none of these are directly exposed to the user, and the new Start workbench does not have a preferences panel. The parameters are intended to be used by Preference Pack authors to assist in customization of FreeCAD themes. It is likely that this will be expanded once feedback from theme designers is received.