コード例 #1
0
ファイル: LinesGrid.py プロジェクト: ongbe/FreeLayout
    def draw (self, painter, rect):
        if not self._visible:
            return

        lines = []
        baseLines = []

        start = self.closestNode (rect.topLeft ())

        i = round (start.x () / self._size) % self._step
        for x in xfrange (start.x (), rect.right (), self._size):
            line = QLineF (x, rect.top (), x, rect.bottom ())
            if i % self._step == 0:
                baseLines.append (line)
            else:
                lines.append (line)
            i += 1

        i = round (start.y () / self._size) % self._step
        for y in xfrange (start.y (), rect.bottom (), self._size):
            line = QLineF (rect.left (), y, rect.right (), y)
            if i % self._step == 0:
                baseLines.append (line)
            else:
                lines.append (line)
            i += 1

        painter.setPen (self._normalPen)
        painter.drawLines (lines)
        painter.setPen (self._baselinePen)
        painter.drawLines (baseLines)
コード例 #2
0
ファイル: LinesGrid.py プロジェクト: UncleRus/FreeLayout
    def draw(self, painter, rect):
        if not self._visible:
            return

        lines = []
        baseLines = []

        start = self.closestNode(rect.topLeft())

        i = round(start.x() / self._size) % self._step
        for x in xfrange(start.x(), rect.right(), self._size):
            line = QLineF(x, rect.top(), x, rect.bottom())
            if i % self._step == 0:
                baseLines.append(line)
            else:
                lines.append(line)
            i += 1

        i = round(start.y() / self._size) % self._step
        for y in xfrange(start.y(), rect.bottom(), self._size):
            line = QLineF(rect.left(), y, rect.right(), y)
            if i % self._step == 0:
                baseLines.append(line)
            else:
                lines.append(line)
            i += 1

        painter.setPen(self._normalPen)
        painter.drawLines(lines)
        painter.setPen(self._baselinePen)
        painter.drawLines(baseLines)
コード例 #3
0
ファイル: DotsGrid.py プロジェクト: UncleRus/FreeLayout
 def draw (self, painter, rect):
     if not self._visible:
         return
     start = self.closestNode (rect.topLeft ())
     painter.setPen (self._normalColor)
     for x in xfrange (start.x (), rect.right (), self._size):
         dots = []
         for y in xfrange (start.y (), rect.bottom (), self._size):
             dots.append (QPointF (x, y))
         painter.drawPoints (QPolygonF (dots))
コード例 #4
0
ファイル: DotsGrid.py プロジェクト: ongbe/FreeLayout
 def draw(self, painter, rect):
     if not self._visible:
         return
     start = self.closestNode(rect.topLeft())
     painter.setPen(self._normalColor)
     for x in xfrange(start.x(), rect.right(), self._size):
         dots = []
         for y in xfrange(start.y(), rect.bottom(), self._size):
             dots.append(QPointF(x, y))
         painter.drawPoints(QPolygonF(dots))