KReport

KReportDesignerSectionView.cpp
1/* This file is part of the KDE project
2 * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
3 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19//
20// ReportSceneView method implementations
21//
22#include "KReportDesignerSectionView.h"
23#include "KReportDesigner.h"
24
25#include "kreport_debug.h"
26
27KReportDesignerSectionView::KReportDesignerSectionView(KReportDesigner * designer, QGraphicsScene *scene, QWidget * parent)
28 : QGraphicsView(scene, parent)
29{
30 m_reportDesigner = designer;
31
32 viewport()->setMouseTracking(true);
34
36 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
37 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
39 setFrameStyle(0);
40 m_reportDesigner->setActiveScene(scene);
41
42}
43
44KReportDesignerSectionView::~KReportDesignerSectionView()
45{
46 viewport()->setMouseTracking(false);
47}
48
49//! @todo check
50void KReportDesignerSectionView::resizeContents(const QSize &s)
51{
52 if (size() == s) {
53 return;
54 }
57}
58
59KReportDesigner * KReportDesignerSectionView::designer() const
60{
61 return m_reportDesigner;
62}
63
64void KReportDesignerSectionView::mousePressEvent(QMouseEvent * e)
65{
66 m_reportDesigner->sectionMousePressEvent(this, e);
68}
69
70void KReportDesignerSectionView::mouseReleaseEvent(QMouseEvent * e)
71{
72 m_reportDesigner->sectionMouseReleaseEvent(this, e);
74}
75
76QSize KReportDesignerSectionView::sizeHint() const
77{
78 //kreportDebug() << scene()->width() << "x" << scene()->height();
79 return QSize(scene()->width(), scene()->height());
80}
81
The ReportDesigner is the main widget for designing a report.
void sectionMouseReleaseEvent(KReportDesignerSectionView *v, QMouseEvent *e)
Handle the mouse release event for a report section.
QWidget * viewport() const const
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseReleaseEvent(QMouseEvent *event) override
QGraphicsScene * scene() const const
ScrollBarAlwaysOff
void setMaximumSize(const QSize &)
void setMinimumSize(const QSize &)
void setMouseTracking(bool enable)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.