[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [tikzkit] src/ui: grid drawing is done in the View now
From:       Dominik Haumann <dhaumann () kde ! org>
Date:       2014-04-30 22:16:28
Message-ID: E1Wfcnk-0000mg-Aw () scm ! kde ! org
[Download RAW message or body]

Git commit e6e6005198a06b7407c71c96c14643d6194266ae by Dominik Haumann.
Committed on 30/04/2014 at 22:16.
Pushed by dhaumann into branch 'master'.

grid drawing is done in the View now

M  +0    -35   src/ui/TikzScene.cpp
M  +0    -4    src/ui/TikzScene.h

http://commits.kde.org/tikzkit/e6e6005198a06b7407c71c96c14643d6194266ae

diff --git a/src/ui/TikzScene.cpp b/src/ui/TikzScene.cpp
index 91ba3a4..3c590e0 100644
--- a/src/ui/TikzScene.cpp
+++ b/src/ui/TikzScene.cpp
@@ -95,41 +95,6 @@ TikzEditMode TikzScene::editMode() const
     return d->editMode;
 }
 
-void TikzScene::drawBackground(QPainter *painter, const QRectF &rect)
-{
-    if (!rect.isValid()) {
-        qWarning() << "Scene bounding rect is invalid. Something is wrong!";
-        return;
-    }
-
-    // painting is in unit 'pt'
-
-    // desired unit
-    const tikz::Unit unit = tikz::Centimeter;
-    const Value one(1, unit);
-
-    tikz::Value left = \
                tikz::Value(tikz::Value(rect.left()).convertTo(unit).value());
-    left = tikz::Value(std::floor(left.value()), unit);
-
-    tikz::Value top = tikz::Value(tikz::Value(rect.top()).convertTo(unit).value());
-    top = tikz::Value(std::ceil(top.value()), unit);
-
-    QVarLengthArray<QLineF, 100> lines;
-    for (tikz::Value x = left; x.toPoint() < rect.right(); x += one) {
-        lines.append(QLineF(x.toPoint(), rect.top(), x.toPoint(), rect.bottom()));
-    }
-    for (tikz::Value y = top; y.toPoint() < rect.bottom(); y += one) {
-        lines.append(QLineF(rect.left(), y.toPoint(), rect.right(), y.toPoint()));
-    }
-
-    painter->save();
-    QPen pen(QColor(243, 243, 243));
-    pen.setWidth(0);
-    painter->setPen(pen);
-    painter->drawLines(lines.data(), lines.size());
-    painter->restore();
-}
-
 void TikzScene::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     // first let QGraphicsScene do its work
diff --git a/src/ui/TikzScene.h b/src/ui/TikzScene.h
index 031b3ac..6ea44b0 100644
--- a/src/ui/TikzScene.h
+++ b/src/ui/TikzScene.h
@@ -73,10 +73,6 @@ class TIKZUI_EXPORT TikzScene : public QGraphicsScene
         void editModeChanged(TikzEditMode mode) const;
 
     protected:
-        // Efficiently draws a grid in the background.
-        // For more information: \
http://www.qtcentre.org/threads/5609-Drawing-grids-efficiently-in-QGraphicsScene?p=28905#post28905
                
-        void drawBackground(QPainter *painter, const QRectF &rect) override;
-
         /**
          * Reimplemented to pass mouse press events to tool handler.
          */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic