[Qt] LibreCAD 源码分析

librecad

src/

all source code


src/actions/

all action classes

src/command/

the rs_command class for command line framework

src/lib/

LibreCAD library

src/lib/actions/

the base types of actioninterface of all actions found in src/actions, rs_preview and rs_snapper defined here

src/lib/creation/

create entities with conditions

src/lib/debug/

RS_DEBUG class, debugging levels

src/lib/engine/

all entity (geometry/shape) classes defined here rs_settings are used to save program preferences in Qt-SQL

src/fileio/

src/lib/filters/

file input output

src/lib/gui/

rs_dialogfactory to provide communication with GUI parts, rs_grid, rs_painter

src/lib/information/

intersection, measure/info, locales

src/lib/math/

common math functions

src/lib/modification/

engine for modification actions

src/lib/scripting/

scripting support, not enabled yet


src/main/

The main function and application window


src/ui/

qg_actionfactory, create actions

qg_actionhandler, provide action slots to GUI parts

qg_dialogfactory, all gui parts communication with each other

src/ui/ Qt GUI forms


res/

holds all icon pictures used by LibreCAD

plugins/

some plugins for use with LibreCAD, which has its own pro file

scripts/

scripts executed at the end of build process for copy needed resources like fonts, translations and hatches

 

Factories

  • QG_ActionHandler
Responsible for starting CAD actions
  • RS_EventHandler
Responsible for routing UI events
  • QG_ActionFactory
Generate GUI actions and connection to CAD actions
  • QG_DialogFactory

   Access to GUI interface: Qt widgets

Drawing

  • RS_PainterQt
Responsible for the actual drawing of objects (onto a QPaintDevice)

Undo/Redo

  • RS_Undoable
Base class for all RS_Entity
This class simply wraps a single flag.
When false, the entity is valid.
When true, the entity is undone.
To undo/redo the entity, the flag has to be toggled.
  • RS_UndoCycle
This is a list of entities (RS_Undoable) modified in one transaction (cycle)
  • RS_Undo
This is one of RS_Document's base classes
It keeps a list of RS_UndoCycle, the undo/redo stack
Each creation/modification is added to the current undo cycle, which is pushed to the list then
Undo/Redo actions walk up or down the undo cycle list and toggles all entities in one cycle
On modification entities are not modified immediately, the entity is cloned, the original undone and the clone modified
With undo, the clone is undone and the original entity redone

CAD Entities

  • RS_Entity
Base class for all CAD entity types
原文地址:https://www.cnblogs.com/cxc1357/p/11797843.html