FreeCAD

Форк
0
/
QGIVertex.cpp 
69 строк · 2.6 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2013 Luke Parry <l.parry@warwick.ac.uk>                 *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24
#ifndef _PreComp_
25
# include <cassert>
26

27
# include <QPainter>
28
# include <QPainterPath>
29
# include <QStyleOptionGraphicsItem>
30
#endif
31

32
#include "QGIVertex.h"
33
#include "PreferencesGui.h"
34
#include "QGIPrimPath.h"
35

36

37
using namespace TechDrawGui;
38

39
QGIVertex::QGIVertex(int index) :
40
    projIndex(index),
41
    m_radius(2)
42
{
43
    QColor vertexColor = PreferencesGui::vertexQColor();
44
    setFill(vertexColor, Qt::SolidPattern);
45

46
    setRadius(m_radius);
47
}
48

49
void QGIVertex::setRadius(float r)
50
{
51
    m_radius = r;
52
    QPainterPath p;
53
    p.addEllipse(-r/2.0, -r/2.0, r, r);
54
    setPath(p);
55
}
56

57
void QGIVertex::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
58
{
59
    QStyleOptionGraphicsItem myOption(*option);
60
    myOption.state &= ~QStyle::State_Selected;
61

62
//    painter->setPen(Qt::blue);
63
//    painter->drawRect(boundingRect());          //good for debugging
64

65
//    m_brush.setColor(m_colCurrent);
66
//    m_brush.setStyle(m_fill);
67
//    setBrush(m_brush);
68
    QGIPrimPath::paint (painter, &myOption, widget);
69
}
70

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.