Warning, file /office/calligra/libs/pageapp/KoPACanvasItem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org>
0003    Copyright (C) 2010 Boudewijn Rempt <boud@valdyas.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 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    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KOPACANVASITEM_H
0022 #define KOPACANVASITEM_H
0023 
0024 #include <QGraphicsWidget>
0025 #include <QList>
0026 #include <KoPACanvasBase.h>
0027 
0028 #include "kopageapp_export.h"
0029 
0030 /// GraphicsWidget that shows a KoPAPage
0031 class KOPAGEAPP_EXPORT KoPACanvasItem : public QGraphicsWidget, public KoPACanvasBase
0032 {
0033     Q_OBJECT
0034 public:
0035     explicit KoPACanvasItem( KoPADocument * doc );
0036 
0037     void repaint() override;
0038 
0039     void setCursor(const QCursor &cursor) override;
0040 
0041     QWidget* canvasWidget() override { return 0; }
0042     const QWidget* canvasWidget() const override { return 0; }
0043 
0044     QGraphicsObject *canvasItem() override { return this; }
0045     const QGraphicsObject *canvasItem() const override{ return this; }
0046 
0047     /// reimplemented method
0048     void updateCanvas( const QRectF& rc ) override;
0049 
0050     /// reimplemented method
0051     void updateInputMethodInfo() override;
0052 
0053     /// Recalculates the size of the canvas (needed when zooming or changing pagelayout)
0054     void updateSize() override;
0055 
0056 public Q_SLOTS:
0057 
0058     void slotSetDocumentOffset(const QPoint &offset) { setDocumentOffset(offset); }
0059 
0060 Q_SIGNALS:
0061 
0062     void documentSize(const QSize &size);
0063 
0064     /**
0065      * Emitted when the entire controller size changes
0066      * @param size the size in widget pixels.
0067      */
0068     void sizeChanged( const QSize & size );
0069 
0070     /// Emitted when updateCanvas has been called.
0071     void canvasUpdated();
0072 
0073 protected:
0074     /// reimplemented method from superclass
0075     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
0076 
0077     /// reimplemented method from superclass
0078     void mousePressEvent( QGraphicsSceneMouseEvent *event ) override;
0079     /// reimplemented method from superclass
0080     void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ) override;
0081     /// reimplemented method from superclass
0082     void mouseMoveEvent( QGraphicsSceneMouseEvent *event ) override;
0083     /// reimplemented method from superclass
0084     void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) override;
0085     /// reimplemented method from superclass
0086     void keyPressEvent( QKeyEvent *event ) override;
0087     /// reimplemented method from superclass
0088     void keyReleaseEvent( QKeyEvent *event ) override;
0089     /// reimplemented method from superclass
0090     void wheelEvent ( QGraphicsSceneWheelEvent * event ) override;
0091     /// reimplemented method from superclass
0092     void closeEvent( QCloseEvent * event ) override;
0093     /// reimplemented method from superclass
0094     bool event( QEvent * event ) override;
0095     /// reimplemented method from superclass
0096     QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
0097     /// reimplemented method from superclass
0098     void inputMethodEvent(QInputMethodEvent *event) override;
0099 
0100     /// reimplemented method from superclass
0101     void resizeEvent( QGraphicsSceneResizeEvent * event ) override;
0102 
0103     /**
0104      * Shows the default context menu
0105      * @param globalPos global position to show the menu at.
0106      * @param actionList action list to be inserted into the menu
0107      */
0108     void showContextMenu( const QPoint& globalPos, const QList<QAction*>& actionList );
0109 };
0110 
0111 #endif /* KOPACANVAS_H */