mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-13 12:26:05 -05:00
Add checkbox to toggle grid lines
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "editor.h"
|
||||
#include <QCheckBox>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@@ -251,10 +252,14 @@ void Editor::displayMapGrid() {
|
||||
for (int i = 0; i <= map->getWidth(); i++) {
|
||||
int x = i * 16;
|
||||
QGraphicsLineItem *line = scene->addLine(x, 0, x, pixelHeight);
|
||||
line->setVisible(gridToggleCheckbox->isChecked());
|
||||
connect(gridToggleCheckbox, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
||||
}
|
||||
for (int j = 0; j <= map->getHeight(); j++) {
|
||||
int y = j * 16;
|
||||
QGraphicsLineItem *line = scene->addLine(0, y, pixelWidth, y);
|
||||
line->setVisible(gridToggleCheckbox->isChecked());
|
||||
connect(gridToggleCheckbox, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user