mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-04 11:30:52 +01:00
Build fix for non-C++17 compatible systems
std::variant/std::visit was only introduced with C++17. Remove its usage.
We don't even need it in these cases since QColor has an implicit constructor accepting Qt::GlobalColor.
Follow-up for b69c7b1027
This commit is contained in:
committed by
Laurent Trinques
parent
e9a5fded5c
commit
de80d10f5e
@@ -21,7 +21,6 @@
|
|||||||
#include "../elementscene.h"
|
#include "../elementscene.h"
|
||||||
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief CustomElementGraphicPart::CustomElementGraphicPart
|
@brief CustomElementGraphicPart::CustomElementGraphicPart
|
||||||
@@ -938,7 +937,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
|||||||
else if (_filling == FdiagFilling) brush.setStyle(Qt::FDiagPattern);
|
else if (_filling == FdiagFilling) brush.setStyle(Qt::FDiagPattern);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static const QMap<Filling, std::variant<Qt::GlobalColor, QColor>>
|
static const QMap<Filling, QColor>
|
||||||
filling_style_map = {
|
filling_style_map = {
|
||||||
{BlackFilling, Qt::black},
|
{BlackFilling, Qt::black},
|
||||||
{WhiteFilling, Qt::white},
|
{WhiteFilling, Qt::white},
|
||||||
@@ -1096,14 +1095,11 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
|||||||
|
|
||||||
brush.setStyle(Qt::SolidPattern);
|
brush.setStyle(Qt::SolidPattern);
|
||||||
auto color = filling_style_map.find(_filling);
|
auto color = filling_style_map.find(_filling);
|
||||||
if (color != filling_style_map.end())
|
if (color != filling_style_map.end()) { brush.setColor(*color); }
|
||||||
{
|
|
||||||
std::visit([&](auto&& color) { brush.setColor(color); }, *color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply pen color
|
// Apply pen color
|
||||||
static const QMap<Color, std::variant<Qt::GlobalColor, QColor>> color_map =
|
static const QMap<Color, QColor> color_map =
|
||||||
{{GreenColor, Qt::green},
|
{{GreenColor, Qt::green},
|
||||||
{RedColor, Qt::red},
|
{RedColor, Qt::red},
|
||||||
{BlueColor, Qt::blue},
|
{BlueColor, Qt::blue},
|
||||||
@@ -1268,10 +1264,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto style_ = color_map.find(_color);
|
auto style_ = color_map.find(_color);
|
||||||
if (style_ != color_map.end())
|
if (style_ != color_map.end()) { pen.setColor(*style_); }
|
||||||
{
|
|
||||||
std::visit([&](auto&& color) { pen.setColor(color); }, *style_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply antialiasing
|
//Apply antialiasing
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
||||||
|
|
||||||
@@ -605,11 +604,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
else if (style_value == "eleve") pen.setWidthF(5.0);
|
else if (style_value == "eleve") pen.setWidthF(5.0);
|
||||||
|
|
||||||
} else if (style_name == "filling") {
|
} else if (style_name == "filling") {
|
||||||
static const QMap<
|
static const QMap<QString, QPair<Qt::BrushStyle, QColor>>
|
||||||
QString,
|
|
||||||
QPair<
|
|
||||||
Qt::BrushStyle,
|
|
||||||
std::variant<Qt::GlobalColor, QColor>>>
|
|
||||||
filling_style_map = {
|
filling_style_map = {
|
||||||
{"white", {Qt::SolidPattern, Qt::white}},
|
{"white", {Qt::SolidPattern, Qt::white}},
|
||||||
{"black", {Qt::SolidPattern, Qt::black}},
|
{"black", {Qt::SolidPattern, Qt::black}},
|
||||||
@@ -912,12 +907,10 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
if (style_ == filling_style_map.end()) { continue; }
|
if (style_ == filling_style_map.end()) { continue; }
|
||||||
|
|
||||||
brush.setStyle(style_->first);
|
brush.setStyle(style_->first);
|
||||||
std::visit(
|
brush.setColor(style_->second);
|
||||||
[&](auto&& color) { brush.setColor(color); },
|
|
||||||
style_->second);
|
|
||||||
}
|
}
|
||||||
} else if (style_name == "color") {
|
} else if (style_name == "color") {
|
||||||
static const QMap<QString, std::variant<Qt::GlobalColor, QColor>> color_style_map = {
|
static const QMap<QString, QColor> color_style_map = {
|
||||||
{"red", Qt::red},
|
{"red", Qt::red},
|
||||||
{"blue", Qt::blue},
|
{"blue", Qt::blue},
|
||||||
{"green", Qt::green},
|
{"green", Qt::green},
|
||||||
@@ -1085,9 +1078,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
auto style_ = color_style_map.find(style_value);
|
auto style_ = color_style_map.find(style_value);
|
||||||
if (style_ == color_style_map.end()) { continue; }
|
if (style_ == color_style_map.end()) { continue; }
|
||||||
|
|
||||||
std::visit(
|
pen.setColor(*style_);
|
||||||
[&](auto&& color) { pen.setColor(color); },
|
|
||||||
*style_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user