mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-15 04:15:36 -05:00
Fix Qt 5.15 build
This commit is contained in:
@@ -23,16 +23,16 @@ public:
|
||||
int offsetY = 0;
|
||||
Style style = Style::Solid;
|
||||
QColor color = Qt::black;
|
||||
QList<qreal> getHorizontalDashPattern() const { return this->getDashPattern(this->width); }
|
||||
QList<qreal> getVerticalDashPattern() const { return this->getDashPattern(this->height); }
|
||||
QVector<qreal> getHorizontalDashPattern() const { return this->getDashPattern(this->width); }
|
||||
QVector<qreal> getVerticalDashPattern() const { return this->getDashPattern(this->height); }
|
||||
|
||||
static QString getStyleName(Style style);
|
||||
static GridSettings::Style getStyleFromName(const QString &name);
|
||||
private:
|
||||
static const QMap<Style, QString> styleToName;
|
||||
|
||||
QList<qreal> getCenteredDashPattern(uint length, qreal dashLength, qreal gapLength) const;
|
||||
QList<qreal> getDashPattern(uint length) const;
|
||||
QVector<qreal> getCenteredDashPattern(uint length, qreal dashLength, qreal gapLength) const;
|
||||
QVector<qreal> getDashPattern(uint length) const;
|
||||
};
|
||||
|
||||
inline bool operator==(const GridSettings &a, const GridSettings &b) {
|
||||
|
||||
@@ -22,7 +22,7 @@ GridSettings::Style GridSettings::getStyleFromName(const QString &name) {
|
||||
// We do some extra work here to A: try and center the dashes away from the intersections, and B: keep the dash pattern's total
|
||||
// length equal to the length of a grid square. This keeps the patterns looking reasonable regardless of the grid size.
|
||||
// Otherwise, the dashes can start to intersect in weird ways and create grid patterns that don't look like a rectangular grid.
|
||||
QList<qreal> GridSettings::getCenteredDashPattern(uint length, qreal dashLength, qreal gapLength) const {
|
||||
QVector<qreal> GridSettings::getCenteredDashPattern(uint length, qreal dashLength, qreal gapLength) const {
|
||||
const qreal minEdgesLength = 0.6*2;
|
||||
if (length <= dashLength + minEdgesLength)
|
||||
return {dashLength};
|
||||
@@ -36,7 +36,7 @@ QList<qreal> GridSettings::getCenteredDashPattern(uint length, qreal dashLength,
|
||||
const qreal edgeLength = (length - mainLength) / 2;
|
||||
|
||||
// Fill the pattern
|
||||
QList<qreal> pattern = {0, edgeLength};
|
||||
QVector<qreal> pattern = {0, edgeLength};
|
||||
for (int i = 0; i < numDashes-1; i++) {
|
||||
pattern.append(dashLength);
|
||||
pattern.append(gapLength);
|
||||
@@ -47,7 +47,7 @@ QList<qreal> GridSettings::getCenteredDashPattern(uint length, qreal dashLength,
|
||||
return pattern;
|
||||
}
|
||||
|
||||
QList<qreal> GridSettings::getDashPattern(uint length) const {
|
||||
QVector<qreal> GridSettings::getDashPattern(uint length) const {
|
||||
switch (this->style) {
|
||||
|
||||
// Equivalent to setting Qt::PenStyle::Solid with no dash pattern.
|
||||
|
||||
Reference in New Issue
Block a user