• [Qt] Librecad 源码分析


    libraries

    • jwwlib
    • libdxfrw:一个免费的C++库,用于读写文本格式或二进制格式的DXF文件(C++ library to read and write DXF/DWG files)
    • muparser:一个跨平台的公式解析库,它可以自定义多参数函数,自定义常量、变量及一元前缀、后缀操作符,二元操作符等,它将公式编译成字节码,所以计算起来非常快

    librecad

    • src:源文件
      • action:动作类
      • cmd:命令行
      • lib:各种库
        • actions:处理各种响应事件
        • creation
        • debug
        • engine
        • fileio
        • filter
        • generators
        • gui:界面显示
        • information
        • math
        • modification
        • printing
        • scripting
      • main:启动程序和窗口
      • plugins:插件
      • test
      • ui:界面控制

     

     qc_applicationwindow

     1 /**
     2  * Redraws all mdi windows.
     3  */
     4 void QC_ApplicationWindow::redrawAll()
     5 {
     6     if (mdiAreaCAD)
     7     {
     8         foreach (const QC_MDIWindow* win, window_list)
     9         {
    10             if (win)
    11             {
    12                 QG_GraphicView* gv = win->getGraphicView();
    13                 if (gv) {gv->redraw();}
    14             }
    15         }
    16     }
    17 }

    librecadsrcui

    qg_graphicView

    updateGridStatusWidget()

    1 /**
    2  * Sets the text for the grid status widget in the left bottom corner.
    3  */
    4 void QG_GraphicView::updateGridStatusWidget(const QString& text)
    5 {
    6    emit gridStatusChanged(text);
    7 }

    wheelEvent()

    1 /**
    2  * mouse wheel event. zooms in/out or scrolls when
    3  * shift or ctrl is pressed.
    4  */
    5 void QG_GraphicView::wheelEvent(QWheelEvent *e) {...}

     librecadsrclibgui

    rs_graphicview

    centerOffsetX()

     1 /**
     2  * Centers the drawing in x-direction.
     3  */
     4 void RS_GraphicView::centerOffsetX() {
     5     if (container && !zoomFrozen) {
     6         offsetX = (int)(((getWidth()-borderLeft-borderRight)
     7                          - (container->getSize().x*factor.x))/2.0
     8                         - (container->getMin().x*factor.x)) + borderLeft;
     9     }
    10 }

    zoomScroll()

     1 /**
     2  * Scrolls in the given direction.
     3  */
     4 void RS_GraphicView::zoomScroll(RS2::Direction direction) {
     5     switch (direction) {
     6     case RS2::Up:
     7         offsetY-=50;
     8         break;
     9     case RS2::Down:
    10         offsetY+=50;
    11         break;
    12     case RS2::Right:
    13         offsetX+=50;
    14         break;
    15     case RS2::Left:
    16         offsetX-=50;
    17         break;
    18     }
    19     adjustOffsetControls();
    20     adjustZoomControls();
    21     //    updateGrid();
    22 
    23     redraw();
    24 }

    librecadsrcactions

    rs_actiondrawline()

    <QCursor>

    The QCursor class provides a mouse cursor with an arbitrary shape

    <QDockWidget>

    The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop

    参考:

     https://blog.csdn.net/Caoyang_He/article/details/80343945

  • 相关阅读:
    HTTP协议详解
    10本Linux免费电子书
    面试高级算法梳理笔记
    Linux服务器的那些性能参数指标
    2016 年开发者头条十大文章系列
    程序员如何优雅的挣零花钱
    [oracle] oracle权限传递
    [oracle] 两种权限:系统权限VS对象权限
    [oracle] 系统权限管理
    [oracle] 重要服务启动与停止命令行
  • 原文地址:https://www.cnblogs.com/cxc1357/p/11884417.html
Copyright © 2020-2023  润新知