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

List:       kde-commits
Subject:    playground/games/magazynier
From:       Niels Slot <nielsslot () gmail ! com>
Date:       2010-10-31 18:53:35
Message-ID: 20101031185335.49E5AAC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1191620 by nielsslot:

Align the scene to the center of the view and paint the background correctly.

 M  +4 -1      levelModel.cpp  
 M  +0 -1      window.cpp  


--- trunk/playground/games/magazynier/levelModel.cpp #1191619:1191620
@@ -20,6 +20,7 @@
 #include <KDebug>
 #include <QGraphicsItem>
 #include <QGraphicsSceneMouseEvent>
+#include <QGraphicsView>
 #include <KLocale>
 #include <QStringList>
 #include <QVector>
@@ -183,7 +184,9 @@
 
 void LevelModel::drawBackground(QPainter *painter, const QRectF &rect) //{{{
 {
-	painter->drawPixmap(0, 0, Renderer::instance()->getBackground());
+	QGraphicsView* view = views().first();
+	QPointF topLeft = view->mapToScene(0, 0);
+	painter->drawPixmap(topLeft, Renderer::instance()->getBackground());
 } //}}}
 
 void LevelModel::moveFromEmptyToEmpty(QPoint pos, QPoint delta) //{{{
--- trunk/playground/games/magazynier/window.cpp #1191619:1191620
@@ -62,7 +62,6 @@
 	m_view = new QGraphicsView();
 	m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 	m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-	m_view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
 
 	m_undoStack = new KUndoStack(this);
 	setupActions();
[prev in list] [next in list] [prev in thread] [next in thread] 

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