ksquares
gameboardview.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Matthew Williams <matt@milliams.com> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 ***************************************************************************/ 00009 00010 #ifndef GAMEBOARDVIEW_H 00011 #define GAMEBOARDVIEW_H 00012 00013 #include <QGraphicsView> 00014 00015 #include "gameboardscene.h" 00016 00025 class GameBoardView : public QGraphicsView 00026 { 00027 Q_OBJECT 00028 00029 public: 00035 explicit GameBoardView(QWidget* parent = 0); 00039 QSize minimumSizeHint() const {if(scene()==0) return QSize(); else return qobject_cast<GameBoardScene*>(scene())->minimumSizeHint();} 00040 public slots: 00042 void setBoardSize(); 00043 protected: 00045 void resizeEvent(QResizeEvent* event) {if (scene() != 0) fitInView(scene()->sceneRect(), Qt::KeepAspectRatio); QGraphicsView::resizeEvent(event);} 00046 }; 00047 00048 #endif // GAMEBOARDVIEW_H
KDE 4.2 API Reference