Resolved issue #808. New feature. Global line width option.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-02-06 19:30:27 +02:00
parent 7fedd20319
commit 6c438f92e0
26 changed files with 189 additions and 86 deletions

View File

@ -44,6 +44,7 @@
- [#414] Add features from Qt Windows Extras.
- [#807] Issue with "Intersection" passmark.
- [#667] Check for updates - Test version.
- [#808] New feature. Global line width option.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -32,7 +32,6 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../dialogdatetimeformats.h"
#include "../dialogknownmaterials.h"
#include "../vmisc/def.h"
#include <QMessageBox>
#include <QDate>
@ -58,7 +57,8 @@ QStringList ComboBoxAllStrings(QComboBox *combo)
PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::PreferencesPatternPage),
m_knownMaterials()
m_knownMaterials(),
m_oldLineUnit(Unit::Mm)
{
ui->setupUi(this);
@ -70,6 +70,27 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
ui->doubleSpinBoxCurveApproximation->setMaximum(maxCurveApproximationScale);
ui->undoCount->setValue(settings->GetUndoCount());
//----------------------- Unit setup
InitUnits();
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
{
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
const qreal value = UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, lineUnit);
ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6);
ui->doubleSpinBoxLineWidth->setMinimum(UnitConvertor(ui->doubleSpinBoxLineWidth->minimum(), m_oldLineUnit,
lineUnit));
ui->doubleSpinBoxLineWidth->setMaximum(UnitConvertor(ui->doubleSpinBoxLineWidth->maximum(), m_oldLineUnit,
lineUnit));
ui->doubleSpinBoxLineWidth->setValue(value);
m_oldLineUnit = lineUnit;
});
m_oldLineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
ui->doubleSpinBoxLineWidth->setDecimals(m_oldLineUnit == Unit::Mm ? 1 : 6);
ui->doubleSpinBoxLineWidth->setMinimum(UnitConvertor(VCommonSettings::MinimalLineWidth(), Unit::Mm, m_oldLineUnit));
ui->doubleSpinBoxLineWidth->setMaximum(UnitConvertor(VCommonSettings::MaximalLineWidth(), Unit::Mm, m_oldLineUnit));
ui->doubleSpinBoxLineWidth->setValue(UnitConvertor(settings->GetLineWidth(), Unit::Mm, m_oldLineUnit));
InitDefaultSeamAllowance();
InitLabelDateTimeFormats();
@ -98,6 +119,7 @@ void PreferencesPatternPage::Apply()
// Scene antialiasing
settings->SetGraphicalOutput(ui->graphOutputCheck->isChecked());
settings->SetCurveApproximationScale(ui->doubleSpinBoxCurveApproximation->value());
settings->SetLineWidth(UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, Unit::Mm));
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, ui->graphOutputCheck->isChecked());
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, ui->graphOutputCheck->isChecked());
@ -198,6 +220,21 @@ void PreferencesPatternPage::InitComboBoxFormats(QComboBox *box, const QStringLi
}
}
//---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::InitUnits()
{
ui->comboBoxLineWidthUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
ui->comboBoxLineWidthUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
// set default unit
const Unit defUnit = QLocale().measurementSystem() == QLocale::MetricSystem ? Unit::Mm : Unit::Inch;
const qint32 indexUnit = ui->comboBoxLineWidthUnit->findData(static_cast<int>(defUnit));
if (indexUnit != -1)
{
ui->comboBoxLineWidthUnit->setCurrentIndex(indexUnit);
}
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
void PreferencesPatternPage::CallDateTimeFormatEditor(const T &type, const QStringList &predefinedFormats,

View File

@ -30,6 +30,7 @@
#define PREFERENCESPATTERNPAGE_H
#include <QWidget>
#include "../vmisc/def.h"
namespace Ui
{
@ -57,9 +58,11 @@ private:
Q_DISABLE_COPY(PreferencesPatternPage)
Ui::PreferencesPatternPage *ui;
QStringList m_knownMaterials;
Unit m_oldLineUnit;
void InitLabelDateTimeFormats();
void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString &currentFormat);
void InitUnits();
template <typename T>
void CallDateTimeFormatEditor(const T &type, const QStringList &predefinedFormats,

View File

@ -76,6 +76,49 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string>Bold line width</string>
</property>
<property name="text">
<string>Line width:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxLineWidth">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineWidthUnit"/>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -4694,8 +4694,7 @@ void MainWindow::Preferences()
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::RefreshDetailsLabel);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [](){VPattern::RefreshCurves();});
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [this](){emit doc->FullUpdateFromFile();});
QGuiApplication::restoreOverrideCursor();
if (guard->exec() == QDialog::Accepted)

View File

@ -597,7 +597,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
int count = 0;
@ -786,25 +786,6 @@ void MainWindowsNoGUI::PrintTiled()
LayoutPrint();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshDetailsLabel call to ecalculate piece labels. For example after changing a font.
*/
void MainWindowsNoGUI::RefreshDetailsLabel()
{
const QHash<quint32, VPiece> *list = pattern->DataPieces();
QHash<quint32, VPiece>::const_iterator i = list->constBegin();
while (i != list->constEnd())
{
if (VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(i.key())))
{
tool->UpdatePatternInfo();
tool->UpdateDetailLabel();
}
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> &details)
{
@ -848,7 +829,8 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
painter.end();
@ -934,7 +916,7 @@ void MainWindowsNoGUI::SvgFile(const QString &name, QGraphicsRectItem *paper, QG
painter.begin(&generator);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthHairLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
painter.end();
@ -954,7 +936,7 @@ void MainWindowsNoGUI::PngFile(const QString &name, QGraphicsRectItem *paper, QG
QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
scene->render(&painter, r, r, Qt::IgnoreAspectRatio);
image.save(name);
@ -1004,7 +986,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, QGraphicsRectItem *paper, QG
}
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
scene->render(&painter, r, r, Qt::IgnoreAspectRatio);
painter.end();
@ -1460,7 +1442,8 @@ bool MainWindowsNoGUI::IsLayoutGrayscale() const
QImage image(target.size(), QImage::Format_RGB32);
image.fill(Qt::white);
QPainter painter(&image);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
scenes.at(i)->render(&painter, target, paper->rect(), Qt::KeepAspectRatio);
painter.end();

View File

@ -60,7 +60,6 @@ public slots:
void PrintPreviewTiled();
void PrintOrigin();
void PrintTiled();
void RefreshDetailsLabel();
protected slots:
void ExportFMeasurementsToCSV();
protected:

View File

@ -530,20 +530,6 @@ void VPattern::LiteParseIncrements()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::RefreshCurves()
{
QHash<quint32, VDataTool*>::const_iterator i = tools.constBegin();
while (i != tools.constEnd())
{
if (VAbstractSpline *vTool = qobject_cast<VAbstractSpline *>(i.value()))
{
vTool->FullUpdateFromFile();
}
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
int VPattern::ElementsToParse() const
{

View File

@ -107,8 +107,6 @@ public:
void LiteParseIncrements();
static void RefreshCurves();
static const QString AttrReadOnly;
int ElementsToParse() const;

View File

@ -70,6 +70,7 @@ const QString settingPatternHideMainPath = QStringLiteral("pattern/hi
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance");
const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont");
const QString settingPatternLineWidth = QStringLiteral("pattern/lineWidth");
const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale");
const QString settingPatternShowCurveDetails = QStringLiteral("pattern/showCurveDetails");
@ -98,6 +99,7 @@ const QString settingLabelUserTimeFormats = QStringLiteral("label/userTimeFormat
// Reading settings file is very expensive, cache curve approximation to speed up getting value
qreal curveApproximationCached = -1;
QString localeCached = QString();
qreal lineWidthCached = 0;
//---------------------------------------------------------------------------------------------------------------------
QStringList ClearFormats(const QStringList &predefinedFormats, QStringList formats)
@ -1053,3 +1055,34 @@ void VCommonSettings::SetShowCurveDetails(bool value)
{
setValue(settingPatternShowCurveDetails, value);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VCommonSettings::GetLineWidth() const
{
if (lineWidthCached <= 0)
{
lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), value(settingPatternLineWidth, 1.2).toDouble(),
VCommonSettings::MaximalLineWidth());
}
return lineWidthCached;
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLineWidth(qreal width)
{
lineWidthCached = qBound(VCommonSettings::MinimalLineWidth(), width, VCommonSettings::MaximalLineWidth());
setValue(settingPatternLineWidth, lineWidthCached);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VCommonSettings::WidthMainLine() const
{
return GetLineWidth() / 25.4 * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VCommonSettings::WidthHairLine() const
{
return WidthMainLine()/3.0;
}

View File

@ -194,8 +194,34 @@ public:
bool IsShowCurveDetails() const;
void SetShowCurveDetails(bool value);
static qreal DefaultLineWidth();
static qreal MinimalLineWidth();
static qreal MaximalLineWidth();
qreal GetLineWidth() const;
void SetLineWidth(qreal width);
qreal WidthMainLine() const;
qreal WidthHairLine() const;
private:
Q_DISABLE_COPY(VCommonSettings)
};
//---------------------------------------------------------------------------------------------------------------------
inline qreal VCommonSettings::DefaultLineWidth()
{
return 1.2; // mm
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VCommonSettings::MinimalLineWidth()
{
return 0.5; // mm
}
//---------------------------------------------------------------------------------------------------------------------
inline qreal VCommonSettings::MaximalLineWidth()
{
return 5.0; // mm
}
#endif // VCOMMONSETTINGS_H

View File

@ -95,7 +95,8 @@ QPainterPath VAbstractSpline::shape() const
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, SceneScale(scene()));
const qreal width = ScaleWidth(m_isHovered ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine(),
SceneScale(scene()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(m_id);
setPen(QPen(CorrectColor(this, curve->GetColor()), width, LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));

View File

@ -76,7 +76,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
QPointF point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
QPointF point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id));
mainLine = new VScaledLine(QLineF(point1 - point2, QPointF()), this);
mainLine->SetBasicWidth(widthHairLine);
mainLine->SetBoldLine(false);
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
}
@ -132,14 +132,14 @@ void VToolLinePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
mainLine->SetBasicWidth(widthMainLine);
mainLine->SetBoldLine(true);
VToolSinglePoint::hoverEnterEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
mainLine->SetBasicWidth(widthHairLine);
mainLine->SetBoldLine(false);
VToolSinglePoint::hoverLeaveEvent(event);
}

View File

@ -182,7 +182,8 @@ QString VToolLine::getTagName() const
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, SceneScale(scene()));
const qreal width = ScaleWidth(m_isHovered ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine(),
SceneScale(scene()));
setPen(QPen(CorrectColor(this, lineColor), width, LineStyleToPenStyle(m_lineType)));

View File

@ -120,7 +120,7 @@ QString VToolPiecePath::getTagName() const
//---------------------------------------------------------------------------------------------------------------------
void VToolPiecePath::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
qreal width = widthHairLine;
qreal width = qApp->Settings()->WidthHairLine();
const qreal scale = SceneScale(scene());
if (scale > 1)

View File

@ -909,7 +909,7 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos)
void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen toolPen = pen();
toolPen.setWidthF(ScaleWidth(widthHairLine, SceneScale(scene())));
toolPen.setWidthF(ScaleWidth(qApp->Settings()->WidthHairLine(), SceneScale(scene())));
setPen(toolPen);
m_seamAllowance->setPen(toolPen);

View File

@ -55,7 +55,7 @@ VisPieceSpecialPoints::VisPieceSpecialPoints(const VContainer *data, QGraphicsIt
supportColor2(Qt::darkGreen)
{
m_rectItem = InitItem<VCurvePathItem>(supportColor2, this);
m_rectItem->SetWidth(widthHairLine);
m_rectItem->SetWidth(qApp->Settings()->WidthHairLine());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -35,8 +35,6 @@
#include <QGraphicsView>
static const qreal defPointRadiusPixel = (2./*mm*/ / 25.4) * PrintDPI;
const qreal widthMainLine = (1.2/*mm*/ / 25.4) * PrintDPI;
const qreal widthHairLine = widthMainLine/3.0;
const qreal minVisibleFontSize = 5;
qreal SceneScale(QGraphicsScene *scene)

View File

@ -32,8 +32,6 @@
#include <QtGlobal>
#include <QStyleOptionGraphicsItem>
extern const qreal widthMainLine;
extern const qreal widthHairLine;
extern const qreal minVisibleFontSize;
class QGraphicsScene;

View File

@ -28,41 +28,43 @@
#include "scalesceneitems.h"
#include "global.h"
#include "../vmisc/vabstractapplication.h"
#include <QPen>
//---------------------------------------------------------------------------------------------------------------------
VScaledLine::VScaledLine(QGraphicsItem *parent)
: QGraphicsLineItem(parent),
basicWidth(widthMainLine)
m_isBoldLine(true)
{}
//---------------------------------------------------------------------------------------------------------------------
VScaledLine::VScaledLine(const QLineF &line, QGraphicsItem *parent)
: QGraphicsLineItem(line, parent),
basicWidth(widthMainLine)
m_isBoldLine(true)
{}
//---------------------------------------------------------------------------------------------------------------------
void VScaledLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen lPen = pen();
lPen.setWidthF(ScaleWidth(basicWidth, SceneScale(scene())));
lPen.setWidthF(ScaleWidth(m_isBoldLine ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine(),
SceneScale(scene())));
setPen(lPen);
PaintWithFixItemHighlightSelected<QGraphicsLineItem>(this, painter, option, widget);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VScaledLine::GetBasicWidth() const
bool VScaledLine::IsBoldLine() const
{
return basicWidth;
return m_isBoldLine;
}
//---------------------------------------------------------------------------------------------------------------------
void VScaledLine::SetBasicWidth(const qreal &value)
void VScaledLine::SetBoldLine(bool bold)
{
basicWidth = value;
m_isBoldLine = bold;
}
//---------------------------------------------------------------------------------------------------------------------
@ -74,7 +76,7 @@ VScaledEllipse::VScaledEllipse(QGraphicsItem *parent)
void VScaledEllipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
const qreal scale = SceneScale(scene());
const qreal width = ScaleWidth(widthMainLine, scale);
const qreal width = ScaleWidth(qApp->Settings()->WidthMainLine(), scale);
QPen visPen = pen();
visPen.setWidthF(width);

View File

@ -46,13 +46,13 @@ public:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
qreal GetBasicWidth() const;
void SetBasicWidth(const qreal &value);
bool IsBoldLine() const;
void SetBoldLine(bool bold);
private:
Q_DISABLE_COPY(VScaledLine)
qreal basicWidth;
bool m_isBoldLine;
};
class VScaledEllipse : public QGraphicsEllipseItem

View File

@ -45,6 +45,7 @@
#include "../vwidgets/global.h"
#include "../vgeometry/vgobject.h"
#include "../vmisc/vabstractapplication.h"
#include "vmaingraphicsscene.h"
#include "vmaingraphicsview.h"
#include "vgraphicssimpletextitem.h"
@ -258,7 +259,7 @@ void VControlPointSpline::Init()
this->setZValue(100);
controlLine = new VScaledLine(this);
controlLine->SetBasicWidth(widthHairLine);
controlLine->SetBoldLine(false);
controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
controlLine->setVisible(false);
}

View File

@ -29,6 +29,7 @@
#include "vcurvepathitem.h"
#include "../vwidgets/global.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vmisc/vabstractapplication.h"
#include <QPainter>
@ -37,9 +38,8 @@ VCurvePathItem::VCurvePathItem(QGraphicsItem *parent)
: QGraphicsPathItem(parent),
m_directionArrows(),
m_points(),
m_defaultWidth(widthMainLine)
{
}
m_defaultWidth(qApp->Settings()->WidthMainLine())
{}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VCurvePathItem::shape() const

View File

@ -42,6 +42,7 @@
#include <Qt>
#include "global.h"
#include "../vmisc/vabstractapplication.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@ -117,7 +118,7 @@ void VMainGraphicsScene::InitOrigins()
{
origins.clear();
QPen originsPen(Qt::green, widthHairLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen originsPen(Qt::green, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QBrush axisTextBrush(Qt::green);
const qreal arrowAngle = 35.0;
const qreal arrowLength = 12.0;

View File

@ -28,6 +28,7 @@
#include "vscenepoint.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
#include "../vgeometry/vpointf.h"
#include "global.h"
#include "vgraphicssimpletextitem.h"
@ -53,7 +54,7 @@ VScenePoint::VScenePoint(QGraphicsItem *parent)
{
m_namePoint = new VGraphicsSimpleTextItem(this);
m_lineName = new VScaledLine(this);
m_lineName->SetBasicWidth(widthHairLine);
m_lineName->SetBoldLine(false);
m_lineName->setLine(QLineF(0, 0, 1, 0));
m_lineName->setVisible(false);
@ -173,7 +174,8 @@ void VScenePoint::RefreshLine()
//---------------------------------------------------------------------------------------------------------------------
void VScenePoint::ScaleMainPenWidth(qreal scale)
{
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, scale);
const qreal width = ScaleWidth(m_isHovered ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine(),
scale);
setPen(QPen(CorrectColor(this, m_baseColor), width));
}

View File

@ -175,16 +175,7 @@ void VSimpleCurve::keyReleaseEvent(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VSimpleCurve::ScalePenWidth()
{
qreal width = 1;
if (m_isHovered)
{
width = widthMainLine;
}
else
{
width = widthHairLine;
}
qreal width = m_isHovered ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine();
width = ScaleWidth(width, SceneScale(scene()));
setPen(QPen(CorrectColor(this, m_curve->GetColor()), width, LineStyleToPenStyle(m_curve->GetPenStyle())));
}