File indexing completed on 2024-04-28 04:42:10
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com) 0003 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Lesser General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2.1 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Lesser General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Lesser General Public 0016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 // 0020 // ReportSceneView method implementations 0021 // 0022 #include "KReportDesignerSectionView.h" 0023 #include "KReportDesigner.h" 0024 0025 #include "kreport_debug.h" 0026 0027 KReportDesignerSectionView::KReportDesignerSectionView(KReportDesigner * designer, QGraphicsScene *scene, QWidget * parent) 0028 : QGraphicsView(scene, parent) 0029 { 0030 m_reportDesigner = designer; 0031 0032 viewport()->setMouseTracking(true); 0033 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 0034 0035 setCacheMode(QGraphicsView::CacheBackground); 0036 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 0037 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 0038 setDragMode(QGraphicsView::RubberBandDrag); 0039 setFrameStyle(0); 0040 m_reportDesigner->setActiveScene(scene); 0041 0042 } 0043 0044 KReportDesignerSectionView::~KReportDesignerSectionView() 0045 { 0046 viewport()->setMouseTracking(false); 0047 } 0048 0049 //! @todo check 0050 void KReportDesignerSectionView::resizeContents(const QSize &s) 0051 { 0052 if (size() == s) { 0053 return; 0054 } 0055 setMinimumSize(s); 0056 setMaximumSize(s); 0057 } 0058 0059 KReportDesigner * KReportDesignerSectionView::designer() const 0060 { 0061 return m_reportDesigner; 0062 } 0063 0064 void KReportDesignerSectionView::mousePressEvent(QMouseEvent * e) 0065 { 0066 m_reportDesigner->sectionMousePressEvent(this, e); 0067 QGraphicsView::mousePressEvent(e); 0068 } 0069 0070 void KReportDesignerSectionView::mouseReleaseEvent(QMouseEvent * e) 0071 { 0072 m_reportDesigner->sectionMouseReleaseEvent(this, e); 0073 QGraphicsView::mouseReleaseEvent(e); 0074 } 0075 0076 QSize KReportDesignerSectionView::sizeHint() const 0077 { 0078 //kreportDebug() << scene()->width() << "x" << scene()->height(); 0079 return QSize(scene()->width(), scene()->height()); 0080 } 0081