1 /* 2 SPDX-FileCopyrightText: 2011 Andi Fischer <andi.fischer@hispeed.ch> 3 SPDX-FileCopyrightText: 2012 Ralf Habacker <ralf.habacker@freenet.de> 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #ifndef LAYOUTGRID_H 9 #define LAYOUTGRID_H 10 11 #include <QColor> 12 #include <QFont> 13 14 class UMLScene; 15 class QRectF; 16 17 /** 18 * @author Andi Fischer 19 * This class handles the layout grid, which is drawn in the background 20 * of the scene. It is used only in UMLScene. 21 */ 22 class LayoutGrid 23 { 24 public: 25 explicit LayoutGrid(UMLScene *scene); 26 ~LayoutGrid(); 27 28 void paint(QPainter *painter, const QRectF &rect); 29 30 QRect gridRect() const; 31 void setGridRect(const QRect& rect); 32 33 int gridSpacingX() const; 34 int gridSpacingY() const; 35 void setGridSpacing(int sizeX, int sizeY); 36 37 const QColor& gridDotColor() const; 38 void setGridDotColor(const QColor& color); 39 40 const QColor& gridCrossColor() const; 41 void setGridCrossColor(const QColor& color); 42 43 const QColor& textColor() const; 44 void setTextColor(const QColor& color); 45 46 QFont textFont() const; 47 void setTextFont(const QFont& font); 48 49 bool isVisible() const; 50 void setVisible(bool visible); 51 52 bool isTextVisible() const; 53 void setTextVisible(bool visible); 54 55 private: 56 UMLScene *m_scene; 57 int m_gridSpacingX; 58 int m_gridSpacingY; 59 QColor m_gridDotColor; 60 bool m_isVisible; 61 }; 62 63 #endif // LAYOUTGRID_H 64