1
/***************************************************************************
2
* Copyright (c) 2016 Wandererfan <WandererFan@gmail.com> *
4
* This file is part of the FreeCAD CAx development system. *
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. *
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. *
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 *
21
***************************************************************************/
23
#include "PreCompiled.h"
28
# include <QPainterPath>
29
# include <QStyleOptionGraphicsItem>
32
#include <App/Material.h>
33
#include <Base/Parameter.h>
34
#include <Mod/TechDraw/App/Preferences.h>
37
#include "PreferencesGui.h"
39
using namespace TechDraw;
40
using namespace TechDrawGui;
42
QGICMark::QGICMark(int index) : QGIVertex(index)
51
cmPath.moveTo(0.0, m_size);
52
cmPath.lineTo(0.0, -m_size);
53
cmPath.moveTo(m_size, 0.0);
54
cmPath.lineTo(-m_size, 0.0);
58
void QGICMark::setSize(float s)
64
void QGICMark::setThick(float t)
70
QColor QGICMark::getCMarkColor()
72
return PreferencesGui::centerQColor();
75
void QGICMark::setPrettyNormal() {
76
m_colCurrent = getCMarkColor();
80
void QGICMark::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
82
QStyleOptionGraphicsItem myOption(*option);
83
myOption.state &= ~QStyle::State_Selected;
85
QGIVertex::paint (painter, &myOption, widget);
88
QRectF QGICMark::boundingRect() const
90
return shape().controlPointRect();
93
QPainterPath QGICMark::shape() const
96
QPainterPathStroker stroker;
97
stroker.setWidth(getMarkFuzz());
98
outline = stroker.createStroke(path());
102
double QGICMark::getMarkFuzz() const
104
return Preferences::getPreferenceGroup("General")->GetFloat("MarkFuzz", 5.0);