[Kde-games-devel] KDE/kdegames

Stefan Majewsky majewsky at gmx.net
Sat Jul 9 16:32:02 CEST 2011


SVN commit 1240604 by majewsky:

consistency: remove borders around game canvases

Most games already have a game canvas without margins and frames. This
commit removes these borders everywhere. The main motivation is
consistency, but I also think that no borders have other advantages:

1. They look much better with borderless window decorations.
2. Frames induce an additional rendering cost which can be avoided.
3. Frames are usually used for visual grouping, but this is not
   necessary for a game canvas with its intense themed appearance.
4. QGraphicsView has problems with establishing a 1:1 relation between
   scene and view coordinates when it has a frame.
5. Also 4px horizontal and vertical space saved!!!! ;-)

If you are the maintainer of one of the affected games and object to
this change, please let me know.
CCMAIL: kde-games-devel at kde.org

 M  +1 -4      bovo/gui/view.cc  
 M  +1 -0      granatier/src/gameview.cpp  
 M  +1 -0      kapman/gameview.cpp  
 M  +1 -0      kdiamond/src/view.cpp  
 M  +1 -0      kollision/mainwindow.cpp  
 M  +1 -0      palapeli/src/engine/view.cpp  


--- trunk/KDE/kdegames/bovo/gui/view.cc #1240603:1240604
@@ -35,11 +35,8 @@
 
 View::View(Scene* scene, const QColor& bgColor, QWidget *parent) : QGraphicsView(scene, parent),
            m_scene(scene) {
+    setFrameStyle(QFrame::NoFrame);
 //    setCacheMode(QGraphicsView::CacheBackground);
-    QPalette bgPal;
-    bgPal.setColor(backgroundRole(), bgColor);
-    setPalette(bgPal);
-    setAutoFillBackground(true);
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setMinimumSize(sizeHint());
--- trunk/KDE/kdegames/granatier/src/gameview.cpp #1240603:1240604
@@ -24,6 +24,7 @@
 
 GameView::GameView(Game * p_game) : QGraphicsView(new GameScene(p_game))
 {
+    setFrameStyle(QFrame::NoFrame);
     setFocusPolicy(Qt::StrongFocus);
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
--- trunk/KDE/kdegames/kapman/gameview.cpp #1240603:1240604
@@ -19,6 +19,7 @@
 #include "gamescene.h"
 
 GameView::GameView(Game * p_game) : QGraphicsView(new GameScene(p_game)) {
+	setFrameStyle(QFrame::NoFrame);
 	setFocusPolicy(Qt::StrongFocus);
 	// Forward the key press events to the Game instance
 	connect(this, SIGNAL(keyPressed(QKeyEvent*)), p_game, SLOT(keyPressEvent(QKeyEvent*)));
--- trunk/KDE/kdegames/kdiamond/src/view.cpp #1240603:1240604
@@ -24,6 +24,7 @@
 KDiamond::View::View(QWidget* parent)
 	: QGraphicsView(parent)
 {
+	setFrameStyle(QFrame::NoFrame);
 	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 	//optimize rendering
--- trunk/KDE/kdegames/kollision/mainwindow.cpp #1240603:1240604
@@ -33,6 +33,7 @@
                                 QGraphicsView::DontAdjustForAntialiasing );
 //    view->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
     view->setCacheMode( QGraphicsView::CacheBackground );
+    view->setFrameStyle(QFrame::NoFrame);
 
     setCentralWidget(view);
 
--- trunk/KDE/kdegames/palapeli/src/engine/view.cpp #1240603:1240604
@@ -36,6 +36,7 @@
 	, m_scene(0)
 	, m_zoomLevel(100)
 {
+	setFrameStyle(QFrame::NoFrame);
 	setMouseTracking(true);
 	setResizeAnchor(QGraphicsView::AnchorUnderMouse);
 	setTransformationAnchor(QGraphicsView::AnchorUnderMouse);


More information about the kde-games-devel mailing list