Skip to content

Commit

Permalink
Fix Qt 5.15 build
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Oct 1, 2024
1 parent 932c299 commit eefa46a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions include/ui/gridsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class GridSettings {
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) {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/gridsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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);
Expand All @@ -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.
Expand Down

0 comments on commit eefa46a

Please sign in to comment.